实验要求:
为R1和R2之间做一条备份路由。
相关资料:
首先看一下Cisco制定的各个路由协议的管理距离(AD):
1.直接相连:0
2.静态路由:1
3.EIGRP 汇总路由(summary route):5
4.外部BGP:20
5.内部EIGRP:90
6:IGRP:100
7.OSPF:110
9.RIP(v1,v2):120
10.外部EIGRP:170
11.内部BGP:200
FloatingStatusRoute
因为静态路由的AD比一些动态路由协议的AD高,假如你又想优先采用动态路由,而让静态路由作为备份路由的话,就可以在配置静态路由的时候指定一个AD值,这个AD值要比你采用的动态路由协议要高才行.所以一般当动态路由正常的时候,你在路由表里是看不到这条静态路由的;当动态路由出问题的时候,静态路由开始生效,于是出现在路由表里,这样的静态路由就叫做浮动静态路由(floatingstaticroute)。
实验步骤:
因为涉及到的设备比较少,我这里面就把模拟器中的配置全部复制出来
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host R1
R1(config)#no ip domain-look
R1(config)#line con 0
R1(config-line)#logg syn
R1(config-line)#exec-t 0 0
R1(config-line)#int s0/0/0
R1(config-if)#ip add 172.16.10.10 255.255.255.0 //配置IP地址
R1(config-if)#clo
R1(config-if)#clock ra
R1(config-if)#clock rate 64000
R1(config-if)#no shut
%LINK-5-CHANGED: Interface Serial0/0/0, changed state to up
R1(config-if)#
R1(config-if)#int s
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0/0, changed state to up
R1(config-if)#int s0/1/0
R1(config-if)#ip add 172.16.20.10 255.255.255.0 //配置IP地址
R1(config-if)#cl
R1(config-if)#clock r
R1(config-if)#clock rate 64000
R1(config-if)#no shut
%LINK-5-CHANGED: Interface Serial0/1/0, changed state to up
R1(config-if)#
R1(config-if)#int
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1/0, changed state to up
R1(config-if)#int fa0/0
R1(config-if)#ip add 192.168.10.1 255.255.255.0
R1(config-if)#no shut
%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)#
R1(config-if)#exit
R1(config)#rou
R1(config)#router rip //配置RIP动态路由协议
R1(config-router)#version 2
R1(config-router)#nett
R1(config-router)#netwo
R1(config-router)#network 172.16.10.0
R1(config-router)#network 172.16.20.0
R1(config-router)#network 192.168.10.0
R1(config-router)#exit
R1(config)#end
%SYS-5-CONFIG_I: Configured from console by console
R1#
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#ip route 192.168.20.0 255.255.255.0 172.16.20.20 125
R2
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host R2
R2(config)#no ip domain-look
R2(config)#line con 0
R2(config-line)#logg syn
R2(config-line)#exec-t 0 0
R2(config-line)#int s0/0/0
R2(config-if)#ip add 172.16.10.20 255.255.255.0 //配置IP地址
R2(config-if)#no shut
%LINK-5-CHANGED: Interface Serial0/0/0, changed state to up
R2(config-if)#
R2(config-if)#int s
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0/0, changed state to up
R2(config-if)#int s0/1/0
R2(config-if)#ip add 172.16.20.20 255.255.255.0 //配置IP地址
R2(config-if)#no shut
%LINK-5-CHANGED: Interface Serial0/1/0, changed state to up
R2(config-if)#
R2(config-if)#int
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1/0, changed state to up
R2(config-if)#int fa0/0
R2(config-if)#ip add 192.168.20.1 255.255.255.0
R2(config-if)#no shut
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R2(config-if)#
R2(config-if)#exit
R2(config)#rou
R2(config)#router rip //配置RIP动态路由协议
R2(config-router)#version 2
R2(config-router)#network 192.168.20.0
R2(config-router)#network 172.16.10.0
R2(config-router)#network 172.16.20.0
R2(config-router)#exit
R2(config)#end
R2#show ip route
Codes:C-connected,S-static,I-IGRP,R-RIP,M-mobile,B-BGP
D-EIGRP,EX-EIGRPexternal,O-OSPF,IA-OSPFinterarea
N1-OSPFNSSAexternaltype1,N2-OSPFNSSAexternaltype2
E1-OSPFexternaltype1,E2-OSPFexternaltype2,E-EGP
i-IS-IS,L1-IS-ISlevel-1,L2-IS-ISlevel-2,ia-IS-ISinterarea
*-candidatedefault,U-per-userstaticroute,o-ODR
P-periodicdownloadedstaticroute
Gatewayoflastresortisnotset
172.16.0.0/24issubnetted,2subnets
C 172.16.10.0isdirectlyconnected,Serial0/0/0
C 172.16.20.0isdirectlyconnected,Serial0/0/1
R 192.168.10.0/24[120/1]via172.16.20.10,00:00:17,Serial0/0/1
[120/1]via172.16.10.10,00:00:17,Serial0/0/0
C 192.168.20.0/24isdirectlyconnected,FastEthernet0/0
Succe***ateis100percent(5/5),round-tripmin/avg/max=62/62/63ms
R2#conft
//配置一条浮动路由
R2(config)#ip route192.168.10.0 255.255.255.0 172.16.20.10 125
R2(config)#end
R2#show ip route
Codes:C-connected,S-static,I-IGRP,R-RIP,M-mobile,B-BGP
D-EIGRP,EX-EIGRPexternal,O-OSPF,IA-OSPFinterarea
N1-OSPFNSSAexternaltype1,N2-OSPFNSSAexternaltype2
E1-OSPFexternaltype1,E2-OSPFexternaltype2,E-EGP
i-IS-IS,L1-IS-ISlevel-1,L2-IS-ISlevel-2,ia-IS-ISinterarea
*-candidatedefault,U-per-userstaticroute,o-ODR
P-periodicdownloadedstaticroute
Gatewayoflastresortisnotset
//这里我们看不到那条浮动路由,但是如果我们关闭Rip协议,也就是当Rip协议不能正常工作的时候,我们就会看到那条浮动路由
172.16.0.0/24issubnetted,2subnets
C 172.16.10.0isdirectlyconnected,Serial0/0/0
C 172.16.20.0isdirectlyconnected,Serial0/0/1
R 192.168.10.0/24[120/1]via172.16.20.10,00:00:23,Serial0/0/1
[120/1]via172.16.10.10,00:00:23,Serial0/0/0
C 192.168.20.0/24isdirectlyconnected,FastEthernet0/0
//关闭Rip协议,同样在router1上也关闭Rip,这里不再写出,与router2相同
R2(config)#no router rip
Codes:C-connected,S-static,I-IGRP,R-RIP,M-mobile,B-BGP
D-EIGRP,EX-EIGRPexternal,O-OSPF,IA-OSPFinterarea
N1-OSPFNSSAexternaltype1,N2-OSPFNSSAexternaltype2
E1-OSPFexternaltype1,E2-OSPFexternaltype2,E-EGP
i-IS-IS,L1-IS-ISlevel-1,L2-IS-ISlevel-2,ia-IS-ISinterarea
*-candidatedefault,U-per-userstaticroute,o-ODR
P-periodicdownloadedstaticroute
Gatewayoflastresortisnotset
172.16.0.0/24issubnetted,2subnets
C 172.16.10.0isdirectlyconnected,Serial0/0/0
C 172.16.20.0isdirectlyconnected,Serial0/0/1
S 192.168.10.0/24[125/0]via172.16.20.10
C 192.168.20.0/24isdirectlyconnected,FastEthernet0/0
R2#
浮动静态路由不同于其他的静态路由,浮动静态路由不能永久的保持在路由选择表中,它仅仅会出现在一条首选路由发生故障(连接失败)的时候。
转载于:https://blog.51cto.com/lilei/408135