步骤一、配置备份缺省路由
当R1与R2间的主链路发生故障时,R1可以使用备份缺省路由通过备份链路与192.168.0.0/24进行通信。
在R1上配置备份缺省路由。
[R1]ip route-static 0.0.0.0 0.0.0.0 10.1.22.2 preference 80
步骤二、 验证备份缺省路由
关闭R1与R2上的G0/0/1接口模拟链路故障,然后查看R1的路由表。比较关闭接口前后的路由表变化情况。
[R1]interface GigabitEthernet0/0/1
[R1-GigabitEthernet0/0/1]shutdown
[R1-GigabitEthernet0/0/1]quit
在R1上查看路由表
[R1]display ip routing-table
Route Flags: R - relay, D - download to fib
Routing Tables: Public
Destinations : 12 Routes : 12
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 Static 80 0 RD 10.1.22.2 GigabitEthernet0/0/2
172.16.1.0/24 Static 80 0 RD 10.1.22.2 GigabitEthernet0/0/2
上述路由表中,缺省路由0.0.0.0的Preference值为80,表明备用的缺省路由已生效。
PC1>ping 192.168.0.254
Ping 192.168.0.254: 32 data bytes, Press Ctrl_C to break
From 192.168.0.254: bytes=32 seq=1 ttl=254 time=16 ms
From 192.168.0.254: bytes=32 seq=2 ttl=254 time=32 ms
From 192.168.0.254: bytes=32 seq=3 ttl=254 time=16 ms
From 192.168.0.254: bytes=32 seq=4 ttl=254 time=16 ms
From 192.168.0.254: bytes=32 seq=5 ttl=254 time=15 ms
网络并未因为R1与R2之间的主链路被关闭而中断。在PC1上执行tracert命令,查看数据包的转发路径。
PC1>tracert 192.168.0.254
traceroute to 192.168.0.254, 8 hops max
(ICMP), press Ctrl+C to stop
1 10.1.1.254 47 ms <1 ms 16 ms
2 10.1.22.2 46 ms 47 ms 16 ms
3 192.168.0.254 31 ms 16 ms 15 ms
结果显示PC1报文到达目的地192.168.0.254通过备份链路到达。
配置文件
<R1>display current-configuration
ip route-static 0.0.0.0 0.0.0.0 10.1.12.2
ip route-static 0.0.0.0 0.0.0.0 10.1.22.2 preference 80
ip route-static 172.16.1.0 255.255.255.0 10.1.12.2
ip route-static 172.16.1.0 255.255.255.0 10.1.22.2 preference 80
<R2>display current-configuration
ip route-static 10.1.1.0 255.255.255.0 10.1.12.1
ip route-static 10.1.1.0 255.255.255.0 10.1.22.1 preference 80
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。