实验拓扑
接口配置就略过了
唯一需要注意的是需要在4个路由器上配置静态路由
Router2(config)#ip route 1.1.1.1 255.255.255.255 192.168.14.2
Router3(config)#ip route 1.1.1.1 255.255.255.255 192.168.25.2
反过来回包也是指定一下静态路由
Router0(config)#ip route 192.168.1.0 255.255.255.0 192.168.14.1
Router1(config)#ip route 192.168.1.0 255.255.255.0 192.168.25.1
然后配置R2 HSRP 优先级120
Router2(config)#int f0/1
Router2(config-if)#standby 1 priority 120
Router2(config-if)#standby 1 ip 192.168.1.254
看下sh run
interface FastEthernet0/1
ip address 192.168.1.253 255.255.255.0
duplex auto
speed auto
standby version 2
standby 1 ip 192.168.1.254
R3 优先级110
Router3(config)#int f0/1
Router3(config-if)#st
Router3(config-if)#standby 1 ip
Router3(config-if)#standby 1 ip 192.168.1.254
Router3(config-if)#standby 1 pri
Router3(config-if)#standby 1 priority 110
%HSRP-6-STATECHANGE: FastEthernet0/1 Grp 1 state Speak -> Standby
已经可以看到接口状态变了
看下两个路由器上的standby 信息
Router2#show standby br
P indicates configured to preempt.
|
Interface Grp Pri P State Active Standby Virtual IP
Fa0/1 1 120 Active local 192.168.1.252 192.168.1.254
Router2#
Router3#show standby brief
P indicates configured to preempt.
|
Interface Grp Pri P State Active Standby Virtual IP
Fa0/1 1 110 Standby 192.168.1.253 local 192.168.1.254
Router3#
用pc ping 1.1.1.1 都是通的
把R2的链路断开
Router2(config-if)#sh
Router2(config-if)#
%HSRP-6-STATECHANGE: FastEthernet0/1 Grp 1 state Active -> Init
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to administratively down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
pc上有几个丢包,但是很快就起来了,说明切换到备份节点上了
看下R3的日志
Router3#
%HSRP-6-STATECHANGE: FastEthernet0/1 Grp 1 state Standby -> Active
Router3#sh standby brief
P indicates configured to preempt.
|
Interface Grp Pri P State Active Standby Virtual IP
Fa0/1 1 110 Active local unknown 192.168.1.254
R3已经变成老大了
R2 目前不可用
Router2#show standby brief
P indicates configured to preempt.
|
Interface Grp Pri P State Active Standby Virtual IP
Fa0/1 1 120 Init unknown unknown 192.168.1.254
Router2#
当链路恢复后,手动抢占
Router2(config-if)#standby 1 preempt
Router2(config)#do show standby brief
P indicates configured to preempt.
|
Interface Grp Pri P State Active Standby Virtual IP
Fa0/1 1 120 Speak unknown unknown 192.168.1.254
Router2(config)#
%HSRP-6-STATECHANGE: FastEthernet0/1 Grp 1 state Speak -> Standby
%HSRP-6-STATECHANGE: FastEthernet0/1 Grp 1 state Standby -> Active
Router2(config)#do show standby brief
P indicates configured to preempt.
|
Interface Grp Pri P State Active Standby Virtual IP
Fa0/1 1 120 Active local unknown 192.168.1.254
霸占成功
原文地址:http://blog.51cto.com/433266/2113704