一、鏈路追蹤的概念:bash
當網絡中存在着HSRP的備份路由器時,能夠配置HSRP的上行鏈路追蹤,當指定的追蹤接口down掉時,立刻減少該HSRP設備的優先級,使另外一個備份設備能立刻被激活成爲ACTIVE狀態,並接替down掉的設備繼續引導路由數據,實現網絡的暢通性網絡
二、拓撲規劃:ide
三、案例實施:oop
1)、各設備配置:spa
R1配置:3d
interface Loopback0 ipaddress 202.102.12.1 255.255.255.0 interface Serial1/0 ipaddress 172.16.0.1 255.255.255.252 serial restart-delay 0 clock rate 64000 ! interface Serial1/1 ipaddress 172.16.0.5 255.255.255.252 serial restart-delay 0 clock rate 64000
R2配置:rest
interface FastEthernet0/0.10 encapsulation dot1Q 10 ipaddress 192.168.10.1 255.255.255.0 ipnat inside ipvirtual-reassembly standby 10 ip 192.168.10.254 standby 10 priority 120 standby 10 preempt standby 10 track Serial1/0 30 ! interface FastEthernet0/0.20 encapsulation dot1Q 20 ipaddress 192.168.20.1 255.255.255.0 ipnat inside ipvirtual-reassembly standby 20 ip 192.168.20.254 standby 20 preempt interface Serial1/0 ipaddress 172.16.0.2 255.255.255.252 ipnat outside ipvirtual-reassembly serial restart-delay 0 ip route 0.0.0.0 0.0.0.0 Serial1/0 ip nat inside source list 100 interfaceSerial1/0 overload
R3配置:blog
interface FastEthernet0/0.10 encapsulation dot1Q 10 ipaddress 192.168.10.2 255.255.255.0 ipnat inside ipvirtual-reassembly standby 10 ip 192.168.10.254 standby10 preempt ! interface FastEthernet0/0.20 encapsulation dot1Q 20 ipaddress 192.168.20.2 255.255.255.0 ipnat inside ipvirtual-reassembly standby 20 ip 192.168.20.254 standby 20 priority 120 standby 20 preempt standby 20 track Serial1/1 30 interface Serial1/1 ipaddress 172.16.0.5 255.255.255.252 ipnat outside ipvirtual-reassembly serial restart-delay 0 ip route 0.0.0.0 0.0.0.0 Serial1/1 ip nat inside source list 100 interfaceSerial1/1 overload
Sw1配置:接口
interface FastEthernet0/0 switchport mode trunk ! interface FastEthernet0/1 switchport mode trunk ! interface FastEthernet0/2 switchport mode trunk ! interface FastEthernet0/3 switchport access vlan 10 ! interface FastEthernet0/4 switchport access vlan 20 vlan database vlan10 vlan20
Sw2配置:ip
interface FastEthernet0/0 switchport mode trunk ! interface FastEthernet0/1 switchport mode trunk ! interface FastEthernet0/2 switchport mode trunk ! interface FastEthernet0/3 switchport access vlan 10 ! interface FastEthernet0/4 switchport access vlan 20 vlan database vlan10 vlan20
PC1配置:
no ip routing interface FastEthernet0/0 ipaddress 192.168.10.100 255.255.255.0 noip route-cache duplex auto speed auto ip default-gateway 192.168.10.254
PC2配置:
no ip routing interface FastEthernet0/0 ipaddress 192.168.20.100 255.255.255.0 noip route-cache duplex auto speed auto ip default-gateway 192.168.20.254
PC3配置:
no ip routing interface FastEthernet0/0 ipaddress 192.168.10.200 255.255.255.0 noip route-cache duplexauto speed auto ip default-gateway 192.168.10.254
PC4配置:
no ip routing interface FastEthernet0/0 ipaddress 192.168.20.200 255.255.255.0 noip route-cache ip default-gateway 192.168.20.254
2)、配置完成後查看R2和R3的HSRP信息:
R2:
R3:
此時在PC2上跟蹤一下到202.102.12.1的路由狀況
在PC3上跟蹤到202.102.12.1的路有狀況
此時將R1的接口S1/0設置爲shutdown模式,再查看HSRP信息:
R2:
R3:
此時再在PC1和PC2上跟蹤到202.102.12.1的路由,發現R3自動接管原先的路由:
PC1:
PC3: