R1#sh run
no ip domain lookup ip domain name lab.local ip sla monitor 1 type echo protocol ipIcmpEcho 12.1.1.2 source-ipaddr 12.1.1.1 ## from 12.1.1.1 to 12.1.1.2 是主线路 timeout 100 threshold 2 frequency 2track 1 ip route 0.0.0.0 0.0.0.0 reachability
! interface FastEthernet0/0 no ip address shutdown duplex auto speed auto ! interface Serial0/0 ip address 12.1.1.1 255.255.255.0 clock rate 2000000 ! interface FastEthernet0/1 no ip address shutdown duplex auto speed auto ! interface Serial0/1 ip address 13.1.1.1 255.255.255.0 clock rate 2000000 ! ip route 0.0.0.0 0.0.0.0 12.1.1.2 track 1 ip route 0.0.0.0 0.0.0.0 13.1.1.2 10 正常情况下R1#sh ip route
Gateway of last resort is 12.1.1.2 to network 0.0.0.01.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0 12.0.0.0/24 is subnetted, 1 subnets C 12.1.1.0 is directly connected, Serial0/0 13.0.0.0/24 is subnetted, 1 subnets C 13.1.1.0 is directly connected, Serial0/1S* 0.0.0.0/0 [1/0] via 12.1.1.2 当主线路ping不通时候 R1#sh ip routeGateway of last resort is 13.1.1.2 to network 0.0.0.0
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0 13.0.0.0/24 is subnetted, 1 subnets C 13.1.1.0 is directly connected, Serial0/1S* 0.0.0.0/0 [10/0] via 13.1.1.2