接上回,接下来为大家展示另一种解决方案
解决方案二:
应用路由最长匹配原则
目标:
通过实验场景让大家理解路由最长匹配原则
根据上回已经部署好的网络做出修改,新的路由示意图如下:
恢复被关闭的 R1的E0/1接口和R4的E0/0接口 (操作步骤省略)
进一步做出修改之前我们首先要了解R1和R4两台设备上都配置了哪些静态路由,虽然这些是我们自己做滴;
R1#show running-config | section ip route //检查R1上都配置了哪些静态路由
ip route 55.1.1.1 255.255.255.255 Ethernet0/1 12.1.1.2
ip route 55.1.1.1 255.255.255.255 Serial1/0 5
根据设计好的新的方案做出修改:
R1(config)#no ip route 55.1.1.1 255.255.255.255 Serial1/0 5
R1(config)#ip route 0.0.0.0 0.0.0.0 e0/1 12.1.1.2
R1(config)#ip route 0.0.0.0 0.0.0.0 s1/0 5
验证:
R1#show ip route static | begin Gateway
Gateway of last resort is 12.1.1.2 to network 0.0.0.0
S* 0.0.0.0/0 [1/0] via 12.1.1.2, Ethernet0/1
55.0.0.0/32 is subnetted, 1 subnets
S 55.1.1.1 is directly connected, Ethernet0/1
R4#show running-config | section ip route //检查R4上都配置了哪些静态路由
ip route 11.1.1.1 255.255.255.255 Ethernet0/0 24.1.1.2
ip route 11.1.1.1 255.255.255.255 Ethernet0/3 34.1.1.3 5
ip route 55.1.1.1 255.255.255.255 Ethernet0/1 45.1.1.5
根据设计好的新的方案做出修改:
R4(config)#no ip route 11.1.1.1 255.255.255.255 Ethernet0/3 34.1.1.3 5
R4(config)#ip route 0.0.0.0 0.0.0.0 e0/0 24.1.1.2
R4(config)#ip route 0.0.0.0 0.0.0.0 e0/3 34.1.1.3 5
验证:
R4#show ip route static | begin Gateway
Gateway of last resort is 24.1.1.2 to network 0.0.0.0
S* 0.0.0.0/0 [1/0] via 24.1.1.2, Ethernet0/0
11.0.0.0/32 is subnetted, 1 subnets
S 11.1.1.1 [1/0] via 24.1.1.2, Ethernet0/0
55.0.0.0/32 is subnetted, 1 subnets
S 55.1.1.1 [1/0] via 45.1.1.5, Ethernet0/1
测试解决方案:
R1#traceroute 55.1.1.1 source 11.1.1.1 numeric
Type escape sequence to abort.
Tracing the route to 55.1.1.1
VRF info: (vrf in name/id, vrf out name/id)
1 12.1.1.2 0 msec 0 msec 0 msec
2 24.1.1.4 1 msec 0 msec 0 msec
3 45.1.1.5 2 msec * 2 msec
R5#traceroute 11.1.1.1 source 55.1.1.1 nu
R5#traceroute 11.1.1.1 source 55.1.1.1 numeric
Type escape sequence to abort.
Tracing the route to 11.1.1.1
VRF info: (vrf in name/id, vrf out name/id)
1 45.1.1.4 0 msec 1 msec 0 msec
2 24.1.1.2 1 msec 0 msec 1 msec
3 12.1.1.1 2 msec * 2 msec
关闭R1 e0/1 和R4 e0/0 接口模拟R2故障
观察R1和R4的路由表并再次测试
R1#show ip route static | begin Gateway
Gateway of last resort is 0.0.0.0 to network 0.0.0.0
S* 0.0.0.0/0 is directly connected, Serial1/0
R4#show ip route static | begin Gateway
Gateway of last resort is 34.1.1.3 to network 0.0.0.0
S* 0.0.0.0/0 [5/0] via 34.1.1.3, Ethernet0/3
55.0.0.0/32 is subnetted, 1 subnets
S 55.1.1.1 [1/0] via 45.1.1.5, Ethernet0/1
R1#traceroute 55.1.1.1 source 11.1.1.1 numeric
Type escape sequence to abort.
Tracing the route to 55.1.1.1
VRF info: (vrf in name/id, vrf out name/id)
1 13.1.1.3 10 msec 8 msec 9 msec
2 34.1.1.4 9 msec 9 msec 10 msec
3 45.1.1.5 9 msec * 10 msec
R5#traceroute 11.1.1.1 source 55.1.1.1 numeric
Type escape sequence to abort.
Tracing the route to 11.1.1.1
VRF info: (vrf in name/id, vrf out name/id)
1 45.1.1.4 1 msec 2 msec 1 msec
2 34.1.1.3 1 msec 0 msec 1 msec
3 13.1.1.1 10 msec * 10 msec
总结:
应用默认路由结合明细路由的解决方案,更贴近实际工作环境;
当主要链路故障之后,设备能够自动切换到备用链路,并根据控制层面的默认路由将所有数据从备用链路发送出去。
注:做这个解决方案实验的同时,请始终记住路由表决策的八字真言: 最长匹配、递归查询。
(未完待续) 敬请关注后续,谢谢。