实例如下图示:
HSRP 默认每3秒种发送一个hello消息。 standby <number> timers <间隔时间> <没收到的间隔时间切换> 如: standby 39 timers 5 15 定义39组5秒交换一次hello信息,如15秒内没收到hello信息将开始切换。 config t track <track-number> interface <interface-name> line-protocol int vlan<number> standby <number> track <track-number> 如: config t track 1 interface FastEthernet0/1 line-protocol int vlan39 standby 39 track 1 完整配置命令如下: R1: interface FastEthernet0/0 ip address 12.1.1.1 255.255.255.0 no sh interface FastEthernet0/1 ip address 13.1.1.1 255.255.255.0 no sh router rip version 2 network 12.0.0.0 network 13.0.0.0 CoreSW1: vlan database vlan38 vlan39 config t interface Port-channel1 switchport mode trunk no sh int range f1/14 - 15 switch mode trunk duplex full speed 1000 channel-group 1 mode on no sh interface FastEthernet0/0 ip address 12.1.1.2 255.255.255.0 no sh track 1 interface FastEthernet0/0 line-protocol track 2 interface Port-channel1 line-protocol int vlan38 ip add 10.38.38.251 255.255.255.0 ip helper-address 10.39.39.39 standby 38 ip 10.38.38.254 standby 38 timers 5 15 standby 38 priority 130 standby 38 preempt standby 38 track 1 standby 38 track 2 int vlan39 ip address 10.39.39.251 255.255.255.0 ip helper-address 10.39.39.39 standby 39 ip 10.39.39.254 standby 39 timers 5 15 standby 39 priority 150 standby 39 preempt standby 39 track 1 standby 39 track 2 router rip version 2 network 10.0.0.0 network 12.0.0.0 int f1/0 //接PC1 switch port access vlan 38 duplex full speed 1000 CoreSW2: vlan database vlan38 vlan39 config t interface Port-channel1 switchport mode trunk no sh int range f1/14 - 15 switch mode trunk duplex full speed 1000 channel-group 1 mode on no sh interface FastEthernet0/1 ip address 13.1.1.3 255.255.255.0 no sh track 1 interface FastEthernet0/1 line-protocol track 2 interface Port-channel1 line-protocol int vlan38 ip add 10.38.38.252 255.255.255.0 ip helper-address 10.39.39.39 standby 38 ip 10.38.38.254 standby 38 timers 5 15 standby 38 priority 150 standby 38 preempt standby 38 track 1 standby 38 track 2 int vlan39 ip address 10.39.39.252 255.255.255.0 ip helper-address 10.39.39.39 standby 39 ip 10.39.39.254 standby 39 timers 5 15 standby 39 priority 130 standby 39 preempt standby 39 track 1 standby 39 track 2 router rip version 2 network 10.0.0.0 network 13.0.0.0 int f1/0 //接PC2 switch port access vlan 39 duplex full speed 1000 PC1: ip 10.38.38.1 255.255.255.0 10.38.38.254 PC2: ip 10.39.39.2 255.255.255.0 10.39.39.254