What is HSRP and how does the active router election work?
HSRP (Hot Standby Router Protocol) is a Cisco-proprietary FHRP (First Hop Redundancy Protocol) that provides transparent failover of a first-hop IPv4 device. The active router is elected based on priority (highest wins), with the highest IP (Internet Protocol) address as tiebreaker.
* Priority-based HSRP active election. *
HSRP roles in a group:
- Active router: Receives and forwards packets destined for the virtual MAC (Media Access Control). Sends periodic Hello messages
- Standby router: Monitors the active router and immediately takes over if it fails. Also sends Hello messages
- Other routers: In Listen state — they know the virtual IP but aren't active or standby. They listen for Hellos and participate if both active and standby fail
Election criteria (in priority order):
- Highest HSRP priority → becomes active (range 0-255, default = 100)
- Tie-breaker: If priorities are equal → highest IPv4 address on the HSRP interface wins
Configuration:
Router(config-if)# standby 1 ip 192.168.1.1 ! Virtual IP (the default gateway)
Router(config-if)# standby 1 priority 150 ! Set priority (default 100)
Router(config-if)# standby 1 preempt ! Enable preemption
Virtual MAC address format: 0000.0c07.acXX where XX is the HSRP group number in hex.
- Group 1 →
0000.0c07.ac01 - Group 10 →
0000.0c07.ac0a
Important: By default, the router with the highest IPv4 address is elected active. It's always better to explicitly set priorities so you control which router is active, rather than leaving it to IP (Internet Protocol) address chance.
Go deeper:
Hot Standby Router Protocol (Wikipedia) — priority-based active/standby election, the virtual IP, and per-version virtual MAC ranges.