依据路由的AD值,其实就是优先级!动态路由的优先级高,手动添加的静态路由优先级低。当动态路由出现问题时,原有的路由会失效,路由器会自动选择静态路由,保证网络不中断!
实验
实验拓扑图
实验要求:
为Router1和Router2之间做一条备份路由。
相关资料:
首先看一下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)。
实验步骤:
1、首先了解什么是浮动路由,通俗的理解就是一条备份线路
2、利用Visio画出拓扑图
3、规划IP地址
4、用PacketTracer5.0进行模拟实验。
具体实验步骤:
因为涉及到的设备比较少,我这里面就把模拟器中的配置全部复制出来
Router1
Router>en
Router#conft
Enterconfigurationcommands,oneperline. EndwithCNTL/Z.
//配置IP地址
Router(config)#ints0/0/0
Router(config-if)#ipaddress172.16.10.10255.255.255.0
Router(config-if)#clockrate64000
Router(config-if)#noshut
Router(config-if)#exit
Router(config)#ints0/0/1
Router(config-if)#ipaddress172.16.20.10255.255.255.0
Router(config-if)#clockrate64000
Router(config-if)#noshut
Router(config-if)#exit
Router(config)#hostnameRouter1
Router1(config)#intf0/0
Router1(config-if)#ipaddress192.168.10.254255.255.255.0
Router1(config-if)#noshut
Router1(config-if)#exit
//配置RIP动态路由协议
Router1(config)#routerrip
Router1(config-router)#version2
Router1(config-router)#network172.168.10.0
Router1(config-router)#network172.168.20.0
Router1(config-router)#network192.168.10.0
Router1(config-router)#exit
Router1(config)#end
//配置一条浮动路由
Router1(config)#iproute192.168.20.0255.255.255.0172.16.20.20125
Router2
Router>en
Router#conft
Router(config)#hostnamerouer2
//配置IP地址
rouer2(config)#ints0/0/0
rouer2(config-if)#ipaddress172.16.10.20255.255.255.0
rouer2(config-if)#noshut
rouer2(config-if)#exit
rouer2(config)#ints0/0/1
rouer2(config-if)#ipaddress172.16.20.20255.255.255.0
rouer2(config-if)#noshut
rouer2(config-if)#exit
rouer2(config)#intf0/0
rouer2(config-if)#ipaddress192.168.20.254255.255.255.0
rouer2(config-if)#noshut
rouer2(config-if)#exit
//配置RIP动态路由协议
rouer2(config)#routerrip
rouer2(config-router)#version2
rouer2(config-router)#network192.168.20.0
rouer2(config-router)#network172.16.10.0
rouer2(config-router)#network172.16.20.0
rouer2(config-router)#exit
rouer2(config)#end
rouer2#showiproute
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
Successrateis100percent(5/5),round-tripmin/avg/max=62/62/63ms
rouer2#conft
//配置一条浮动路由
rouer2(config)#iproute192.168.10.0255.255.255.0172.16.20.10125
rouer2(config)#end
rouer2#showiproute
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相同
rouer2#conft
rouer2(config)#norouterrip
rouer2#showiproute
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
rouer2#