Cisco 设备hsrp配置

R3#conf t
R3(config -t)#no ip domain lookup
R3(config -t)#ip routing
R3#vlan data
R3(vlan)#vlan 2

R3(vlan)#vlan 3

R3(config-t)int vlan 2
R3(config-if)#ip address 192.168.1.1255.255.255.0
R3(config-t)int vlan 3
R3(config-if)#ip address 192.168.2.1255.255.255.0

将端口f1/13f1/14分别加入VLAN 2 ,VLAN 3
下面创建HSRP
R3(config-t)int vlan 2
R3(config-if)#standby 1 ip192.168.1.254  (HSRP组地址,即为VLAN中电脑的网关地址)
R3(config-if)#standby 1 ip priority 120HSRP组优先值)
R3(config-if)#standby 1 preempt  (抢占成为活动路由,不能忘记)
R3(config-if)#standby 1 timers 3 10(默认hello* hold*时间)
R3(config-if)#standby 1 track f1/13 20*(端口跟踪,在F1/13在所在的链路出现故障时,把自己的优先级减20R4优先级110,比R3高,R4抢占活动路由)
R3(config-t)int vlan 3
R3(config-t)standby 2 ip 192.168.2.254
R3(config-t)standby 2 priority 110(优先值110R4优先值为120R3为备份路由,所以不用设置track端口跟踪)
R3(config-t)standby 2 preempt
R3(config-t)standby 2 timers 3 10
..................................
R4配置和R3一样,只是注意VLAN IP 地址设置不要重复。
我的设置R4(VLAN2192.168.1.2) (VLAN 3 192.168.2.2)
interface Vlan2
ip address 192.168.1.2 255.255.255.0
standby 1 ip 192.168.1.254
standby 1 priority 110
standby 1 preempt
!
interface Vlan3
ip address 192.168.2.2 255.255.255.0
standby 2 ip 192.168.2.254
standby 2 priority 120
standby 2 preempt
standby 2 track FastEthernet1/13 20
!

调试

R1#show standbybrief        //查看HSRP简要信息


R1#showstandby        //查看HSRP详细信息