First-hop redundancy in practice

Hosts keep one default gateway address. A first-hop redundancy protocol lets two or more routers share that address, so one can fail without anyone changing their settings.

The three protocols

HSRPVRRPGLBP
StandardCiscoOpen (RFC 5798, VRRPv3)Cisco
RolesActive and standby; others listenMaster and backupsOne active virtual gateway (AVG) and up to four forwarders (AVF)
Hellos to224.0.0.2 (v1) or 224.0.0.102 (v2), UDP 1985224.0.0.18, IP protocol 112224.0.0.102, UDP 3222
Virtual MAC0000.0C07.ACxx (v1), 0000.0C9F.Fxxx (v2)0000.5E00.01xx0007.B400.xxyy, one per forwarder
Default timersHello 3 s, hold 10 sAdvertisement 1 s; master down after about 3.6 sHello 3 s, hold 10 s
Pre-emptionOff unless standby 1 preemptOn by defaultOff for the AVG, on for forwarders
Load sharingOnly with several groupsOnly with several groupsBuilt in: each host gets a forwarder's MAC
Groups0–255 (v1), 0–4095 (v2)1–2550–1023

Highest priority wins (default 100); on a tie, the highest interface address. HSRP version 2 is the one to use: more groups and IPv6 support. CARP is the open-source cousin found on BSD firewalls; it is not on Cisco devices.

A basic HSRP pair

! R1
interface GigabitEthernet0/0
 ip address 192.168.1.1 255.255.255.0
 standby version 2
 standby 1 ip 192.168.1.254
 standby 1 priority 110
 standby 1 preempt
! R2
interface GigabitEthernet0/0
 ip address 192.168.1.2 255.255.255.0
 standby version 2
 standby 1 ip 192.168.1.254
 standby 1 preempt

show standby brief shows each group's state, the active and standby routers and the virtual address. Without preempt on R1, R1 does not take the active role back after a reboot.

Why the gateway did not fail over

A classic lab surprise: shut the active router's uplink and the hosts lose the internet, yet HSRP does nothing. HSRP only watches the hellos on the LAN side. R1 still sends them, so it stays active and drops the traffic ((1)).

Interface tracking fixes it. R1 lowers its own priority when its uplink goes down; R2 has a higher priority then and, with preempt, takes over ((2)).

track 1 interface GigabitEthernet0/1 line-protocol
interface GigabitEthernet0/0
 standby 1 track 1 decrement 20

When it misbehaves

SymptomLikely causeCheck
Both routers activeHellos do not reach each other: wrong VLAN, a filtered port, or an authentication, group or version mismatchshow standby on both; the peer's address must appear
The better router never takes overpreempt is missing on itshow standby shows Preemption disabled
Failover is slowDefault timers (10 s hold)Lower them, e.g. standby 1 timers 1 3
Uplink failure ignoredNo trackingAdd a track object and a decrement