HSRP ( hot standby router protocol)
版权声明:原创作品,谢绝转载!否则将追究法律责任。 |
R1 S0:10.1.1.1/24
R2 E0: 172.12.23.2/24 S0: 10.1.1.2
R3 E0: 172.12.23.3/24 S0: 10.1.1.3
Virtual Router 172.12.23.10/24
初始配置
R1:
conf t
int s0
encap f
no arp f
no frame inver
ip ad 10.1.1.1. 255.255.255.0
frame map ip 10.1.1.2 102 b
frame map ip 10.1.1.3 103 b
no shut
end
R2
conf t
int s0
encap f
no arp
no frame inver
ip ad 10.1.1.2 255.255.255.0
frame map ip 10.1.1.1 201 b
frame map ip 10.1.1.3 201 b
no shut
exit
int e 0
ip ad 172.12.23.2 255.255.255.0
no shut
end
R3
conf t
int s 0
encap f
ip ad 10.1.1.3 255.255.255.0
no arp f
no frame inver
frame map ip 10.1.1.1 301 b
frame map ip 10.1.1.2 301 b
no shut
exit
int e 0
ip ad 172.12.23.3 255.255.255.0
no shut
end
配置基本的HSRP
R2
conf t
int e 0
standby 2 ip 172.12.23.10
exit
R3
conf t
int e 0
standby 2 ip 172.12.23.10
exit
校验
R2#sh stand Ethernet1/0 - Group 2 State is Active 2 state changes, last state change 00:02:47 Virtual IP address is 172.12.23.10 Active virtual MAC address is 0000.0c07.ac02 Local virtual MAC address is 0000.0c07.ac02 (default) Hello time 3 sec, hold time 10 sec Next hello sent in 0.208 secs Preemption disabled Active router is local Standby router is 172.12.23.3, priority 100 (expires in 9.316 sec) Priority 100 (default 100) IP redundancy name is "hsrp-Et1/0-2" (default) R3#sh standby Ethernet1/0 - Group 2 State is Standby 1 state change, last state change 00:00:57 Virtual IP address is 172.12.23.10 Active virtual MAC address is 0000.0c07.ac02 Local virtual MAC address is 0000.0c07.ac02 (default) Hello time 3 sec, hold time 10 sec Next hello sent in 2.472 secs Preemption disabled Active router is 172.12.23.2, priority 100 (expires in 7.368 sec) Standby router is local Priority 100 (default 100) IP redundancy name is "hsrp-Et1/0-2" (default) Virtual router的Virtual MAC地址用十六进制表示为00-00-0C-07-AC-XX,其中XX就是所定义的Group序号。本例中Group序号为2,所以Virtual MAC地址为0000.0c07.ac02
HSRP优先级设置
在上例中,R2为Active Router.如果想使R3成为Active Router,在R3上配置比R2高的优先级即可(默认为100,范围0~255)
conf t
int e 0
standby 2 priority 200
standby 2 preempt
end
在R3上只配置STANDBY 2 PRIORITY 200是不够的,因为路由器并不会自动的改变Active 状态,所以参数preempt的作用就是强制将优先级高的路由器变为Active状态。更改后在R3上做show standby校验,把结果和上面的校验比较一下。
R3#sh stand Ethernet1/0 - Group 2 State is Active 2 state changes, last state change 00:00:19 Virtual IP address is 172.12.23.10 Active virtual MAC address is 0000.0c07.ac02 Local virtual MAC address is 0000.0c07.ac02 (default) Hello time 3 sec, hold time 10 sec Next hello sent in 1.248 secs Preemption enabled Active router is local Standby router is 172.12.23.2, priority 100 (expires in 9.468 sec) Priority 200 (configured 200) IP redundancy name is "hsrp-Et1/0-2" (default) 下面来讨论standby <group number> track 的用法
R3
conf t
int e 0
standby 2 track s 0
exit
当设置Track的端口DOWN掉的时候,此设备的HSRP优先级会自动降低。继续在R3上配置
int s 0
shut
end
现在我们来看看R3上的校验
R3#sh stand Ethernet1/0 - Group 2 State is Active 1 state change, last state change 00:04:23 Virtual IP address is 172.12.23.10 Active virtual MAC address is 0000.0c07.ac02 Local virtual MAC address is 0000.0c07.ac02 (default) Hello time 3 sec, hold time 10 sec Next hello sent in 0.860 secs Preemption enabled Active router is local Standby router is 172.12.23.2, priority 100 (expires in 8.804 sec) Priority 190 (configured 200) Track interface Serial2/0 state Down decrement 10 IP redundancy name is "hsrp-Et1/0-2" (default) 优先级默认降低10,也可自行配置,命令是
standby track s 0 <1~255>
配置HSRP验证和时钟
R2
conf t
int e 0
standby 2 authentication ccie
standby 2 timers 10 20
end
R3
conf t
int e 0
standby 2 authentication ccie
standby 2 time 10 20
end
验证最多为8个字符,默认为cisco.
timers后第一个时间间隔为HELLO TIME,默认为3,范围1~255 单位是second
timers后第二个时间间隔为HOLD TIME,默认为10,范围1~255,但必须比HELLO TIME大,如果设置错误,系统会有提示。单位是second.
校验
R2#sh stand Ethernet1/0 - Group 2 State is Standby 7 state changes, last state change 00:10:01 Virtual IP address is 172.12.23.10 Active virtual MAC address is 0000.0c07.ac02 Local virtual MAC address is 0000.0c07.ac02 (default) Hello time 10 sec, hold time 20 sec Next hello sent in 7.056 secs Authentication text "ccie" Preemption disabled Active router is 172.12.23.3, priority 190 (expires in 16.156 sec) Standby router is local Priority 100 (default 100) Track interface Serial2/0 state Up decrement 10 IP redundancy name is "hsrp-Et1/0-2" (default) R3#sh stand Ethernet1/0 - Group 2 State is Active 1 state change, last state change 00:27:44 Virtual IP address is 172.12.23.10 Active virtual MAC address is 0000.0c07.ac02 Local virtual MAC address is 0000.0c07.ac02 (default) Hello time 10 sec, hold time 20 sec Next hello sent in 2.104 secs Authentication text "ccie" Preemption enabled Active router is local Standby router is 172.12.23.2, priority 100 (expires in 13.036 sec) Priority 190 (configured 200) Track interface Serial2/0 state Down decrement 10 IP redundancy name is "hsrp-Et1/0-2" (default) 配置过程和校验时显示的端口可能不太一致,是因为为了简化书写,还有不同的IOS显示出的结果排列会不同,但内容是一样的。 本文出自 “穿过地狱去看海” 博客,谢绝转载! 本文出自 51CTO.COM技术博客 |



cj231210
博客统计信息
热门文章
最新评论
友情链接


