在RIP网络中建立浮动静态路由

                                          浮动静态路由
 
*注:本文章是用来供广大网友学习的、里面有些会提到一些网络专业用语、或者英文缩写。网络初学者如果看不懂的我们可以共同学习,共同探讨、有同学有看不懂的地方可以加本人QQ或者YY来探讨。(QQ:914560310、YY:283755973)“//”后不是命令输出、是说明。
 
我们来说下浮动静态路由。本实验的目的就是通过修改静态路由的管理距离为130,使得路由器在选中时优先选择RIP,而静态路由作为备份。增强网络的连接性。
通过本实验可以掌握浮动静态路由的原理、配置以及备份应用。
拓扑图如下(使用的路由器是2811):
 
/
本实验通过修改静态路由的管理距离为130,使得路由器在选中时优先选择RIP,而静态路由作为备份。
路由器R1配置如下:
R1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#ip route 2.2.2.0 255.255.255.0 192.168.12.2 130     //在启用静态路由的同时将静态路由的管理距离设置为130
R1(config)#router rip
R1(config-router)#version 2
R1(config-router)#no auto-summary
R1(config-router)#network 1.1.1.0
R1(config-router)#network 192.168.21.0
R1(config-router)#
 
路由器R2的配置如下:
R2#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
R2(config)#ip route 1.1.1.0 255.255.255.0 192.168.12.1 130
R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#no auto-summary
R2(config-router)#network 192.168.21.0
R2(config-router)#network 2.2.2.0
R2(config-router)#
 
在R1上查看路由表:
R1#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route
 
Gateway of last resort is not set
 
     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
     2.0.0.0/24 is subnetted, 1 subnets
R       2.2.2.0 [120/1] via 192.168.21.2, 00:00:21, FastEthernet0/0
C    192.168.12.0/24 is directly connected, Serial0/3/0
C    192.168.21.0/24 is directly connected, FastEthernet0/0
R1#
以上R1路由表的输出可以看出:路由器将RIP放入路由表中,因为RIP的管理距离是120,小于我们刚才设置的静态路由的130,所以RIP变成这个网络连接的首选项、而静态路由处于备份状态。
 
我们在R1上将“f0/0”接口关闭然后查看路由表看是什么样的状态:
R1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#inter f0/0     //进入“f0/0”接口、
R1(config-if)#shutdown    //关闭接口
 
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to administratively down
 
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to down
 
R1(config-if)#exit        //退回到上一模式
R1(config)#exit          //退回到上一模式
R1#
%SYS-5-CONFIG_I: Configured from console by console
 
R1#show ip route         //查看路由表
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route
 
Gateway of last resort is not set
 
     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
     2.0.0.0/24 is subnetted, 1 subnets
S       2.2.2.0 [130/0] via 192.168.12.2
C    192.168.12.0/24 is directly connected, Serial0/3/0
R1#
以上R的路由表输出表示:当接口“f0/0”down掉的时候我们设置的静态路由显示出来了。这个网络的连接还是没有问题的。很好的解释了浮动静态路由做为备份的工作原理。以及他的优点。
 
在R1上我们再把“f0/0”开启然后查看路由表:
R1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#inter f0/0
R1(config-if)#no shutdown
 
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
 
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
 
R1(config-if)#end      //不管在哪一模式下都能退回到特权模式
R1#
%SYS-5-CONFIG_I: Configured from console by console
 
R1#show ip route      //查看路由表
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route
 
Gateway of last resort is not set
 
     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
     2.0.0.0/24 is subnetted, 1 subnets
R       2.2.2.0 [120/1] via 192.168.21.2, 00:00:06, FastEthernet0/0
C    192.168.12.0/24 is directly connected, Serial0/3/0
C    192.168.21.0/24 is directly connected, FastEthernet0/0
R1#
*以上输出表明:当路由器R1上的接口“f0/0”恢复工作后,浮动静态路由也恢复到了备份的地位。


                                                                                               (*原创作品、谢绝转载、如需转载请注明出处~)

相关内容