Prerequisites
- Two routers (or L3 switches) on the same segment
- A free IP address for the virtual gateway
01The principle
Routers in the same HSRP group share a virtual IP address and a virtual MAC address, which hosts use as their gateway. The highest priority is active; the other waits. By default, priority is 100, hellos go out every 3 seconds and the active router is declared lost after 10 seconds.
HSRP is Cisco-proprietary. VRRP (RFC 5798) does the same job as an open standard, between different vendors’ equipment.
02Primary router
A priority above the default, and preempt to take back the active role when it returns. The preemption delay gives the router time to converge after a reboot before taking over. Object tracking lowers the priority if the uplink fails.
Version 2 extends the group range and supports IPv6; it must match on both sides, as must authentication.
track 10 interface GigabitEthernet0/1 line-protocol
!
interface GigabitEthernet0/0
ip address 172.16.6.2 255.255.255.0
standby version 2
standby 1 ip 172.16.6.100
standby 1 priority 105
standby 1 preempt delay minimum 60
standby 1 track 10 decrement 10
standby 1 authentication md5 key-string <secret>03Backup router
preempt is essential here too. Without it, when the primary’s priority drops to 95, the backup (100) would stay in standby: the active router never gives up its role by itself, preemption is what lets the higher-priority router take it.
interface GigabitEthernet0/0
ip address 172.16.6.3 255.255.255.0
standby version 2
standby 1 ip 172.16.6.100
standby 1 preempt
standby 1 authentication md5 key-string <secret>04Verify
On the hosts, the gateway is 172.16.6.100. Cut the primary router’s uplink: its priority drops to 95, below the backup’s 100, which becomes active. Restore the link: after the 60-second delay, the primary takes over again.
show standby brief
show standby
show track 10Key takeaways
- One shared virtual IP, one active router.
- Priority 100 by default; preempt on both sides for tracking to work.
- track: hand over the role when the uplink fails.
- preempt delay: take over only once converged.
Example addresses.