What Is VRRP?
VRRP is a fault-tolerant protocol that improves network reliability. VRRP switches services from the master to the backup when the next hop of the master becomes faulty, providing continuous and reliable communication services.
Why Do We Need VRRP?
As networks rapidly develop and applications diversify, various value-added services (VASs), such as Internet Protocol television (IPTV) and video conferencing, are being widely deployed. As a result, network reliability is required to ensure uninterrupted service transmission for users.
Hosts are usually connected to an external network through a default gateway. If the gateway fails, the hosts connected to it will not be able to communicate with the external network, causing service interruptions.
Network diagram of a default gateway on a LAN
VRRP provides a better option. It groups multiple devices into a virtual device, whose IP address is configured as the default gateway address to back up the default gateway. If a gateway fails, VRRP elects a different gateway to forward traffic, thereby ensuring reliable network communication. As shown in the following figure, when the master device fails, the traffic destined for the default gateway is forwarded by the backup device.
Network diagram of a VRRP group
How Does VRRP Work?
Three States of VRRP
Three states are defined in a VRRP state machine: Initialize, Master, and Backup. Only the device that is in the Master state can forward packets destined for the virtual IP address. The following table describes the three states in detail.
State |
Description |
---|---|
Initialize |
VRRP is unavailable. A device in the Initialize state does not process VRRP Advertisement packets. A device usually enters the Initialize state when it starts or detects a fault. |
Master |
A VRRP device in the Master state takes over all the forwarding tasks of the virtual routing device and sends VRRP Advertisement packets to the virtual router periodically. |
Backup |
A VRRP device in the Backup state does not take over the forwarding tasks of the virtual routing device, and receives the VRRP Advertisement packets from the master device periodically to determine whether the master device is working properly. |
VRRP Election Mechanism
The virtual router which is composed of several routers is called a VRRP group. A VRRP group is like a router. After a VRRP group is created, the devices elect the master device based on the configured priorities, as shown in the following figure.
Process of electing the master device
VRRP Implementations
As shown in the following figure, router A, router B, and router C compose a virtual router through VRRP configurations. The virtual router uses an IP address that is the same as the actual IP address of one device among the three routers (the device is designated as the master device) or another IP address on the same network segment as that of the three routers. In this example, the IP address of the virtual router is the same as that of router A. As such, router A is the master device, and device B and device C are backup devices. The default gateway of Client1 to Client3 is 10.10.0.1. As the master device, router A processes the packets that Client1 to Client3 send to the default gateway 10.10.0.1.
VRRP implementations
When the master device fails, router B and router C will elect a new master device. The new master device starts to respond to ARP packets towards the virtual IP address and periodically sends VRRP Advertisement packets.
The VRRP implementations are described as follows in detail:
- VRRP selects the master based on the priorities of devices in a VRRP group. The master device sends gratuitous ARP packets to notify devices or hosts that are connected to it of the virtual MAC address, and then starts forwarding packets.
- The master device periodically sends VRRP Advertisement packets to all backup devices in the VRRP group to advertise its configurations (such as the priority) and operating status.
- If the master device fails, the backup device with the highest priority is elected as the new master.
- After a master/backup switchover, the new master device immediately sends gratuitous ARP packets carrying the virtual MAC and IP addresses to allow devices or hosts that are connected to it to update corresponding MAC entries. After the update is complete, user traffic is switched to the new master device, with users being unaware of the switching process.
- If the original master device recovers and it is the IP address owner (its priority is 255), it immediately switches to the Master state. If the original master device recovers and its priority is lower than 255, it switches to the Backup state, and its original priority is restored.
- If the priority of a backup device is higher than that of a master device, VRRP determines whether to re-elect a new master, depending on the backup device's working mode (preemption or non-preemption).
VRRP Application Scenarios
On the network, VRRP not only triggers a master/backup switchover when the master device fails, but also monitors the status of a certain interface or route.
Association Between VRRP and the Interface Status
As shown in the following figure, VRRP is associated with the status of the uplink interface. When a fault occurs on the uplink interface for forwarding traffic on the master device, the priority of the master device will decrease. When the priority of the master device is lower than that of the backup device, the backup device will assume the master role. This minimizes the impact of the uplink interface fault on service forwarding.
Association between VRRP and the interface status
Association Between VRRP and the Route Status
As shown in the following figure, VRRP is associated with the status of the uplink route. When a fault related to the uplink route occurs, the priority of the master device will decrease. When the priority of the master device is lower than that of the backup device, the backup device will assume the master role. This minimizes the impact of the uplink route fault on service forwarding.
Association between VRRP and the route status
- Author: Li Yefan
- Updated on: 2021-12-03
- Views: 21422
- Average rating: