L3 · fhrp · reviewed
HSRP
Hot Standby Router Protocol
Cisco’s first-hop group: one Active, one Standby, virtual MAC 0000.0c07.acXX, and a Hello on UDP/1985 so the Standby knows when to take over.
Presenter modeEmbed this figure
Why it exists
Hosts need a default gateway that survives a router failure. HSRP gives a LAN one virtual IP and one well-known virtual MAC that an Active router owns and a Standby is ready to take. IntroductionRFC 2281 · INFORMATIONAL · March 1998
HSRP is Cisco’s protocol. VRRP (RFC 5798) solves the same problem with different multicast addresses, virtual MAC range, and defaults — notably preempt on by default. They do not interoperate. PriorityRFC 5798 · PROPOSED STANDARD · March 2010
Active and Standby for one virtual gateway
Two routers join group 1 for 192.0.2.1. Highest priority becomes Active; the next becomes Standby. The Standby forwards nothing until Holdtime expires.
Both routers join HSRP group 1 with virtual address 192.0.2.1. Hellos go to 224.0.0.2 UDP/1985. The host’s gateway is the virtual address. Host · gw 192.0.2.1: Gateway 192.0.2.1. R1 · pri 120: Group 1. R2 · pri 100: Group 1. Upstream.
- Link
- Blocking
- Packet in flight
- Discarded
- Emphasis
Text equivalent of this diagram
| Element | Kind | State |
|---|---|---|
| Host · gw 192.0.2.1 | host | Gateway: 192.0.2.1 |
| R1 · pri 120 | router | Group: 1 |
| R2 · pri 100 | router | Group: 1 |
| Upstream | cloud | — |
| Host · gw 192.0.2.1 — R1 · pri 120 | link | up |
| Host · gw 192.0.2.1 — R2 · pri 100 | link | up |
| R1 · pri 120 — Upstream | link | up |
| R2 · pri 100 — Upstream | link | up |
Both routers join HSRP group 1 with virtual address 192.0.2.1. Hellos go to 224.0.0.2 UDP/1985. The host’s gateway is the virtual address.
What changed
- R1 · pri 120: Group → 1
- R2 · pri 100: Group → 1
- Host · gw 192.0.2.1: Gateway → 192.0.2.1
- Emphasis on Host · gw 192.0.2.1
How it works
HSRP runs over UDP port 1985 to 224.0.0.2 with TTL 1. Messages carry version, opcode (Hello, Coup, Resign), state, Hellotime, Holdtime, priority, group, clear-text authentication, and the virtual IP. Packet formatsRFC 2281 · INFORMATIONAL · March 1998
Highest priority becomes Active; next becomes Standby. Equal priority breaks ties on higher IP address. Default Hellotime 3 s and Holdtime 10 s; the Standby takes over when the Active’s Holdtime expires without a Hello. Packet formatsRFC 2281 · INFORMATIONAL · March 1998
On Ethernet the virtual MAC is 00-00-0C-07-AC-XX where XX is the group. Only the Active accepts that MAC and sources Hellos from it so bridges learn the failover. GeneralRFC 2281 · INFORMATIONAL · March 1998
Preempt is off by default on Cisco platforms. Enable it with a delay so a returning primary does not take traffic before its routing protocols converge. Coup is the message that claims Active. Packet formatsRFC 2281 · INFORMATIONAL · March 1998
On the wire
Constructed examples, encoded from the field table below them — not captured traffic.
- UDP
- Destination port 1985, multicast 224.0.0.2, TTL 1. Routers source from their real interface address, not the virtual IP, so peers can tell each other apart. RFC 2281
- HSRP message
- Version through Virtual IP Address as defined for HSRP version 0. RFC 2281
Configure it
interface Vlan10 standby 1 ip 192.0.2.1 standby 1 priority 120 standby 1 preempt delay minimum 60Group 1 owns 192.0.2.1 (HSRPv1 / RFC 2281 layout). Priority 120 prefers this router. Preempt with a 60-second delay so IGP/BGP can converge before Coup takes Active.
Common mistake: Enabling `standby version 2` on only one peer. HSRPv2 uses a different multicast group and will not interoperate with v1 — both sides go Active.
RFC 2281 §5.1
interface Vlan10 standby 1 timers 3 10Hellotime 3 s, Holdtime 10 s — the RFC 2281 recommended defaults. Holdtime must stay greater than Hellotime.
RFC 2281 §5.1
track 1 interface GigabitEthernet0/0/1 line-protocol interface Vlan10 standby 1 track 1 decrement 30Uplink failure drops priority by 30 so the Standby can win when preempt is enabled on the peer path.
Common mistake: Tracking without preempt on the higher-priority peer after recovery — the role may not return when the uplink heals.
interface Vlan10 standby 1 authentication md5 key-string <configured out of band>Clear-text authentication in RFC 2281 is weak; modern platforms prefer MD5 (or better) key strings. Mismatched auth produces dual-Active just like a blocked Hello path.
RFC 2281 §5.1
Verify
show standby brief- Group, priority, state (Active/Standby), and virtual IP.
show standby- Timers, virtual MAC, preempt, and tracked objects.
Caveats
- Marked draft: syntax has not been checked against Cisco documentation or a device.
- RFC 2281 documents the version-0/v1 packet shown in this atlas; Cisco HSRPv2 is a separate extension — keep versions matched across peers.
- No Junos or FRR snippet: those platforms run VRRP for this problem.
When it breaks
Symptom first, because that is what you have when it happens.
Both routers are active, and hosts report a duplicate address.
Narrow it down
- Confirm each router hears the other’s hellos.
- Compare the group number, the authentication and the version on both.
- Check whether an access list or a VLAN mismatch is blocking the hellos.
Cause
The two cannot hear each other, so each concludes it is the only candidate and takes the role. Different group numbers or a version mismatch is a partition in effect even when the link is fine.
Fix
Align group, version and authentication, and restore the path. Version 1 and version 2 use different multicast addresses and will not interoperate.
StatesRFC 2281 · INFORMATIONAL · March 1998The virtual address answers but traffic through it is dropped after an upstream failure.
Narrow it down
- Check whether the active router kept the role after losing its uplink.
- Look for interface or object tracking on the upstream.
- Confirm the standby has a working path.
Cause
HSRP watches its own group and nothing beyond it. A router with a dead uplink is a healthy active router and keeps attracting traffic it cannot forward.
Fix
Track the upstream interface or a route and decrement priority on failure, so the role follows the path rather than the device.
The intended router does not take over after it comes back from a reload.
Narrow it down
- Compare the configured priorities.
- Check whether preemption is enabled on the higher-priority router.
- Look for a preempt delay that has not expired.
Cause
Without preemption the higher-priority router waits rather than taking the role back, which is the default and frequently what is wanted — but not when a specific router is meant to be primary.
Fix
Enable preemption with a delay long enough for the router to finish converging its routing protocols. Preempting before the routing table is populated moves traffic onto a router that cannot yet forward it.
After a reload the higher-priority router becomes Active immediately and black-holes traffic for tens of seconds.
Narrow it down
- Check whether preempt is enabled without a delay.
- Confirm whether the IGP or BGP table was populated when the role moved.
- Look at interface uptime versus first Active transition.
Cause
Preempt without delay takes Active as soon as the LAN interface is up, which is before routing protocols finish.
Fix
Configure a preempt delay that covers worst-case IGP/BGP convergence on that platform.
The Active/Standby pair flaps or the Standby briefly becomes Active under light loss.
Narrow it down
- Compare Hellotime and Holdtime on both routers.
- Confirm Holdtime is greater than Hellotime and preferably at least three times Hellotime.
- Check for ACL or QoS drops of multicast to 224.0.0.2.
Cause
Holdtime expired because Hellos were delayed or the configured Holdtime was too aggressive relative to Hellotime or loss.
Fix
Align timers; keep Holdtime ≥ 3× Hellotime; ensure Hellos are not filtered.
Packet formatsRFC 2281 · INFORMATIONAL · March 1998
Design notes
Track the uplink or a critical object and decrement priority on failure. Without tracking, an Active with a dead upstream is a black hole that looks healthy.
One group has one Active forwarder. Load sharing needs multiple groups with Active roles split and hosts pointed at different virtual addresses — or GLBP.
Version 0/1 (RFC 2281 layout, 224.0.0.2) and Cisco HSRPv2 (different multicast and message format) do not interoperate. A version mismatch looks like a partition: both sides go Active.
Do not run HSRP and VRRP for the same gateway problem on one segment. Two elections, two virtual MACs, no shared state.
Misconceptions
- “HSRP and VRRP are the same thing with different names.”
- They solve the same problem and differ in detail: HSRP is Cisco’s and uses a different virtual MAC range, different multicast addresses and the terms active and standby rather than master and backup. They do not interoperate, and running both on one segment gives two independent first-hop protocols.
- “The standby router shares the traffic load.”
- It forwards nothing. Sharing load requires several groups with the active role split between them and hosts pointed at different virtual addresses — or GLBP, which was built to do it in one group.
- “Preemption should always be on.”
- It should usually be on with a delay. A router that preempts the instant its interface comes up takes the role before its routing protocols have converged, and forwards into a routing table that is still empty.
More walkthroughs
Healthy Active, dead pathfailure
The Active loses its uplink and keeps sending Hellos. Hosts still send to the virtual MAC until interface tracking decrements priority.
R1 is Active with a working uplink. Hellos keep R2 in Standby. Host traffic leaves through R1. Host. R1 Active: State Active. R2 Standby: State Standby. Upstream.
- Link
- Blocking
- Packet in flight
- Discarded
- Emphasis
Text equivalent of this diagram
| Element | Kind | State |
|---|---|---|
| Host | host | — |
| R1 Active | router | State: Active |
| R2 Standby | router | State: Standby |
| Upstream | cloud | — |
| Host — R1 Active | link | up |
| Host — R2 Standby | link | up |
| R1 Active — Upstream | link | up |
| R2 Standby — Upstream | link | up |
R1 is Active with a working uplink. Hellos keep R2 in Standby. Host traffic leaves through R1.
What changed
- R1 Active: State → Active
- R2 Standby: State → Standby
- Emphasis: Path OK
Preempt only after routing convergesdesign-choice
Without preempt, a recovered higher-priority router stays Standby. With preempt and no delay, it takes Active before its routing table is ready.
R1 reloads. R2 becomes Active. R1 returns with priority 150 but preempt is off — the Cisco default — so R1 stays Standby until R2 fails. R1 · pri 150: State Standby (no preempt). R2 · pri 100: State Active. IGP domain.
- Link
- Blocking
- Packet in flight
- Discarded
- Emphasis
Text equivalent of this diagram
| Element | Kind | State |
|---|---|---|
| R1 · pri 150 | router | State: Standby (no preempt) |
| R2 · pri 100 | router | State: Active |
| IGP domain | cloud | — |
| R1 · pri 150 — R2 · pri 100 | link | up |
| R1 · pri 150 — IGP domain | link | up |
| R2 · pri 100 — IGP domain | link | up |
R1 reloads. R2 becomes Active. R1 returns with priority 150 but preempt is off — the Cisco default — so R1 stays Standby until R2 fails.
RFC 2281 describes Coup when a router wishes to become Active; Cisco’s default is not to preempt unless configured.
What changed
- R2 · pri 100: State → Active
- R1 · pri 150: State → Standby (no preempt)
- Higher priority, still Standby
Terms
- VRRP priority
- Master election value. 255 is reserved for the address owner. Preempt is on by default in RFC 5798; Cisco HSRP preempts only when configured.