Router1(config)# int GigabitEthernet 0/0
Router1(config)# ip address 192.168.1.1 255.255.255.255.0
Router1(config-if)# standby 1 ip add 192.168.1.254 //激活HSRP,设置虚拟网关地址
Router1(config-if)# standby 1 priority 120 //设定HSRP优先级,具有最高优先级的HSRP为活动路由器默认100
Router1(config-if)# standby 1 preempt //开启抢占
Router1(config-if)# standby 1 track interface GigabitEthernet 0/1 30 //跟踪接口,若接口down则优先级减30
Router2(config)# int GigabitEthernet 0/0
Router2(config)# ip address 192.168.1.2 255.255.255.255.0
Router2(config-if)# standby 1 ip add 192.168.1.254
Router2(config-if)# standby 1 priority 120
Router2(config-if)# standby 1 preempt
Router1# show standby brief //查看hsrp信息