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
| HSRP | VRRP | GLBP | |
|---|---|---|---|
| Standard | Cisco | Open (RFC 5798, VRRPv3) | Cisco |
| Roles | Active and standby; others listen | Master and backups | One active virtual gateway (AVG) and up to four forwarders (AVF) |
| Hellos to | 224.0.0.2 (v1) or 224.0.0.102 (v2), UDP 1985 | 224.0.0.18, IP protocol 112 | 224.0.0.102, UDP 3222 |
| Virtual MAC | 0000.0C07.ACxx (v1), 0000.0C9F.Fxxx (v2) | 0000.5E00.01xx | 0007.B400.xxyy, one per forwarder |
| Default timers | Hello 3 s, hold 10 s | Advertisement 1 s; master down after about 3.6 s | Hello 3 s, hold 10 s |
| Pre-emption | Off unless standby 1 preempt | On by default | Off for the AVG, on for forwarders |
| Load sharing | Only with several groups | Only with several groups | Built in: each host gets a forwarder's MAC |
| Groups | 0–255 (v1), 0–4095 (v2) | 1–255 | 0–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 preemptshow 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 20When it misbehaves
| Symptom | Likely cause | Check |
|---|---|---|
| Both routers active | Hellos do not reach each other: wrong VLAN, a filtered port, or an authentication, group or version mismatch | show standby on both; the peer's address must appear |
| The better router never takes over | preempt is missing on it | show standby shows Preemption disabled |
| Failover is slow | Default timers (10 s hold) | Lower them, e.g. standby 1 timers 1 3 |
| Uplink failure ignored | No tracking | Add a track object and a decrement |