What is VRRP
VRRP (Virtual Router Redundancy Protocol) is a standard protocol used to create a virtual gateway. It lets hosts on a LAN make use of redundant routing platforms by configuring only a single static default route on the hosts. This is commonly deployed on Fast Ethernet, Gigabit Ethernet, and 10-Gigabit Ethernet interfaces, running in an active/passive configuration, also referred to as a primary/backup relationship.
Typically, all hosts within the same subnet point their default route to the same gateway as the next hop. Packets destined for other subnets are forwarded to that gateway, which then forwards them onward. If the gateway fails, every host relying on it loses connectivity to external networks. VRRP solves this by combining several router devices into a single virtual router device, whose IP address serves as the default gateway. When the active gateway device fails, VRRP elects a new device to take over traffic handling, keeping communication uninterrupted.
How VRRP Works
VRRP defines three states for a device: Initialize, Master, and Backup. Only a device in the Master state forwards packets sent to the virtual IP address.
· Initialize: The starting state. A device in this state does not process VRRP advertisement messages. Devices typically enter this state at startup or upon detecting a fault.
· Master: The device in this state takes on all forwarding for the virtual router and periodically sends VRRP advertisement messages to the rest of the group.
· Backup: A device in this state does not forward traffic. It periodically receives VRRP advertisement messages from the Master to confirm the Master is still working properly.
After the VRRP group is established, devices elect a Master based on configured priority. The operating process is as follows:
1. Devices in the group elect a Master based on priority. The Master notifies connected devices or hosts of the virtual MAC address by sending gratuitous ARP packets, and takes on the forwarding task.
2. The Master periodically sends VRRP advertisement messages to all Backup devices, announcing its configuration information (such as priority) and operational status.
3. If the Master fails, the Backup devices re-elect a new Master based on priority.
4. When the Master switches from one device to another, the new Master immediately sends gratuitous ARP packets carrying the virtual MAC and virtual IP address, refreshing the MAC table entries of connected hosts or devices and redirecting traffic to itself. This is fully transparent to users.
5. If a Backup device's priority becomes higher than the Master's, whether a new election is triggered depends on whether the Backup is operating in preemptive or non-preemptive mode.
VRRP requires only a single virtual IP address and minimal advertisement traffic to maintain this arrangement, with no interaction required from the hosts themselves.
Why VRRP is Beneficial
The core value of VRRP lies in redundancy and intelligent traffic routing:
· Eliminates a single point of failure: Traffic forwarding no longer depends on one physical gateway device. As long as one device in the group is healthy, hosts continue to reach external networks without interruption.
· Simplifies host configuration: Hosts only need a single, unchanging static default gateway address, removing the need for dynamic route discovery on the host side.
· Transparent failover: The switch from one Master to another — including the gratuitous ARP refresh — happens without any host-side reconfiguration or manual intervention.
· Flexible administrative control: Priority can be assigned per device, and preemptive or non-preemptive behavior can be chosen, letting administrators control which device should take over and when.