浮动路由的配置!

Posted handsomeboy-东

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了浮动路由的配置!相关的知识,希望对你有一定的参考价值。

文章目录

浮动路由

1.浮动路由的特点

如下图三,浮动路由R2能在主路由R1和R2之间通信失效的情况下充当备用路由

2.浮动路由的配置实验

图三:

路线一:PC1–R1–R3–PC2
备用路线二:PC1–R1–R2–R3–PC2

1)配置R1、R2和R3的IP地址
R1:

[R1-GigabitEthernet0/0/0]ip address 192.168.10.254 24
Apr  5 2021 08:59:34-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R1-GigabitEthernet0/0/0]interface g0/0/1
[R1-GigabitEthernet0/0/1]ip address 20.0.0.1 24
Apr  5 2021 09:00:01-08:00 R1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[R1-GigabitEthernet0/0/1]interface g2/0/0
[R1-GigabitEthernet2/0/0]ip address 10.0.0.1 24
Apr  5 2021 09:00:33-08:00 R1 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP 
on the interface GigabitEthernet2/0/0 has entered the UP state. 

R2:

[R2-GigabitEthernet0/0/0]ip address 20.0.0.2 24
Apr  5 2021 09:02:53-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R2-GigabitEthernet0/0/0]interface g0/0/1
[R2-GigabitEthernet0/0/1]ip address 30.0.0.1 24
Apr  5 2021 09:03:15-08:00 R2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 

R3:

[R3-GigabitEthernet2/0/0]ip address 10.0.0.2 24
Apr  5 2021 09:05:32-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet2/0/0 has entered the UP state. 
[R3-GigabitEthernet2/0/0]
[R3-GigabitEthernet2/0/0]interface g0/0/0
[R3-GigabitEthernet0/0/0]ip address 30.0.0.2 24
Apr  5 2021 09:06:13-08:00 R3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R3-GigabitEthernet0/0/0]interface g0/0/1
[R3-GigabitEthernet0/0/1]ip address 192.168.20.254 24
[R3-GigabitEthernet0/0/1]
Apr  5 2021 09:06:36-08:00 R3 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 

2)在R1上配置路线一的静态路由

[R1]ip route-static 192.168.20.0 24 10.0.0.2

3)在R3上配置路线一的静态路由,用PC1 ping PC2结果显示路线一为通信状态

[R3]ip route-static 192.168.10.0 24 10.0.0.1
PC>ping 192.168.20.1

Ping 192.168.20.1: 32 data bytes, Press Ctrl_C to break
Request timeout!
Request timeout!
From 192.168.20.1: bytes=32 seq=3 ttl=126 time=16 ms
From 192.168.20.1: bytes=32 seq=4 ttl=126 time=31 ms
From 192.168.20.1: bytes=32 seq=5 ttl=126 time=16 ms

--- 192.168.20.1 ping statistics ---
  5 packet(s) transmitted
  3 packet(s) received
  40.00% packet loss
  round-trip min/avg/max = 0/21/31 ms

4)查看R1路由表会发现它的静态路由优先级为60,R3上一样,然后在R1和R3上配置路由优先级大于60的浮动路由

[R1-GigabitEthernet0/0/0]display ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 14       Routes : 14       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       10.0.0.0/24  Direct  0    0           D   10.0.0.1        GigabitEthernet
2/0/0
       10.0.0.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
2/0/0
     10.0.0.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
2/0/0
       20.0.0.0/24  Direct  0    0           D   20.0.0.1        GigabitEthernet
0/0/1
       20.0.0.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
     20.0.0.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
   192.168.10.0/24  Direct  0    0           D   192.168.10.254  GigabitEthernet
0/0/0
 192.168.10.254/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
 192.168.10.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0

>    192.168.20.0/24  Static  60   0          RD   10.0.0.2        GigabitEthernet

2/0/0
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

5)在R1上配置路线二的路由优先级为70的浮动路由

[R1]ip route-static 192.168.20.0 24 20.0.0.2 preference 70

6)在R3上配置路线二的路由优先级为70的浮动路由

[R3]ip route-static 192.168.10.0 24 30.0.0.1 preference 70

7)在R2上配置到192.168.10.0和192.168.20.0网段的静态路由

[R2]ip route-static 192.168.10.0 24 20.0.0.1
[R2]ip route-static 192.168.20.0 24 30.0.0.2

8)查看R1的路由表会发现浮动路由的配置没有显示,此时进入R1的GE2/0/0输入”shutdown“关闭接口,断开路线一的通信,再次查看R1路由表就会发现浮动路由的配置

R1与R3断开连接

[R1]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 11       Routes : 11       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       20.0.0.0/24  Direct  0    0           D   20.0.0.1        GigabitEthernet
0/0/1
       20.0.0.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
     20.0.0.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
   192.168.10.0/24  Direct  0    0           D   192.168.10.254  GigabitEthernet
0/0/0
 192.168.10.254/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
 192.168.10.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
   

> 192.168.20.0/24  Static  70   0          RD   20.0.0.2        GigabitEthernet

0/0/1
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

总结

浮动路由可做主路由的备用路由,当主路由正常通信时不会显示在路由表中,当主路由通信失效时,浮动路由作为备用路由进行通信,此时其路由配置会显示在路由表中

以上是关于浮动路由的配置!的主要内容,如果未能解决你的问题,请参考以下文章

浮动路由的配置

配置浮动路由

企业浮动路由配置实例

eNSP中浮动路由的配置

华为运营商级路由器配置示例 | IPv4浮动静态路由

华为静态浮动路由的配置方法