浮动路由的配置!

浮动路由

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

总结

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

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 7
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值