VRRP Implementation and Configuration
VRRP Implementation and Configuration
Contents
1. Introduction to VRRP
2. VRRP Implementation
4 Huawei Confidential
Problems Faced by a Single Gateway
Is it feasible to configure
multiple gateways to
implement redundancy?
Router Router
Switch Switch
Ethernet Ethernet
5 Huawei Confidential
Overview of VRRP
⚫ VRRP groups several routers into a virtual router. If one of routers fails, traffic can be
switched to another router, ensuring service continuity and reliability.
Physical network topology Logical network topology
R1 R2 Virtual router
Virtual IP address:
192.168.1.254/24
GE0/0/0 VRRP GE0/0/0
192.168.1.251/24 192.168.1.252/24
Switch Switch
6 Huawei Confidential
• In this example:
▫ There are two routers on the LAN: R1 and R2. The IP addresses of R1 and
R2 are 192.168.1.251/24 and 192.168.1.252/24, respectively.
7 Huawei Confidential
Basic VRRP Concepts (2)
⚫ Virtual router: Each VRRP group forms a virtual
router that is a logical device. A VRRP group
forms only one virtual router.
Virtual IP address: 192.168.1.254
R1 Virtual MAC address: 0000- R2 ⚫ Virtual IP address and virtual MAC address: A
5e00-0101
GE0/0/0
192.168.1.251/24
GE0/0/0
192.168.1.252/24
virtual router has its own IP address and MAC
VRRP
address. The IP address is specified by the
Switch network administrator during VRRP
configuration. A virtual router can have one or
more IP addresses. Generally, this IP address is
9 Huawei Confidential
VRRP Packet Format
⚫ VRRP has only one packet type — Advertisement packets. Advertisement packets are
multicast packets and can be transmitted only in the same broadcast domain. The
destination multicast address of Advertisement packets is 224.0.0.18.
Ethernet Header IP Header VRRP Packet
Count IP
Ver Type Virtual Rtr ID Priority
Addrs
10 Huawei Confidential
▫ Ver: VRRP has two versions. VRRPv2 applies only to IPv4 networks, and
VRRPv3 applies to both IPv4 and IPv6 networks.
▫ Priority: Priority of the VRRP router that sends the VRRP packet.
▫ Adver Int: Interval for sending VRRP Advertisement packets. The default
value is 1s.
11 Huawei Confidential
Contents
1. Introduction to VRRP
2. VRRP Implementation
12 Huawei Confidential
VRRP State Machine
⚫ The VRRP state machine has three states: Initialize, Master, and Backup.
Initialize
13 Huawei Confidential
1. Sends a VRRP Advertisement packet each time the 1. Receives VRRP Advertisement packets from the master router and
ADVER_INTERVAL timer expires. checks whether the master router is working properly based on
2. Uses the virtual MAC address to respond to ARP Request packets information in the packets.
destined for the virtual IP address. 2. Does not respond to an ARP Request packet carrying a virtual IP
4. Allows a virtual IP address to be pinged by default. 3. Discards IP packets sent to the virtual MAC address.
5. When multiple devices are in Master state, they compare their IP 4. Discards IP packets sent to the virtual IP address.
addresses in received packets with the same priority. If the IP 5. Resets the MASTER_DOWN timer but does not compare IP
address in the packet is greater than the local IP address, the device addresses if it receives a VRRP Advertisement packet carrying a
switches to the Backup state. If the IP address in the packet is less VRRP priority higher than or equal to the local VRRP priority.
Master state.
14 Huawei Confidential
VRRP Master/Backup Election (1)
Master/Backup election when VRRP priorities
Master Backup are different
2 2
1. The VRRP priority of R1's interface is 200, and that of R2's interface is
Backup Backup
100. When the two devices are initialized, they both switch to the Backup
state.
R1 R2
Master Backup
2. R1 and R2 switch from the Backup state to the Master state after the
GE0/0/0 GE0/0/0
192.168.1.251/24 192.168.1.252/24 MASTER_DOWN timer expires. Therefore, R1 switches to the Master
4
Priority: 200 3 Priority: 100 state faster than R2.
1 1 3. R1 and R2 send VRRP packets to each other to elect the master. The
Switch
router with a higher priority is elected as the master, so R1 is elected as
the master.
4. After R1 is elected as the master, it immediately sends gratuitous ARP
packets to advertise the virtual MAC address to the connected devices
and hosts.
PC1 PC2 PC3
IP: 192.168.1.1/24 IP: 192.168.1.2/24 IP: 192.168.1.3/24
Gateway: Gateway: Gateway:
192.168.1.254 192.168.1.254 192.168.1.254 Gratuitous ARP packet
15 Huawei Confidential
• If the device with a higher priority and the device with a lower priority start in
sequence, the device with a higher priority enters the Master state first. After
receiving a VRRP Advertisement packet with a higher priority, the device with a
lower priority remains in Backup state.
• If the device with a lower priority and the device with a higher priority start in
sequence, the device with a lower priority switches from the Backup state to the
Master state first. After receiving the VRRP Advertisement packet with a lower
priority, the device with a higher priority switches to the Master state.
VRRP Master/Backup Election (2)
Master Master
2
Master/Backup election when VRRP priorities
2
are the same
Backup Backup
1. The VRRP priorities of GE0/0/0 interfaces on R1 and R2 are both 200.
R1 R2 When the two devices are initialized, they both switch to the Backup
Backup Master state.
GE0/0/0 GE0/0/0 2. Because the priorities of R1 and R2 are the same, R1 and R2 switch
192.168.1.251/24 192.168.1.252/24 from the Backup state to the Master state after the MASTER_DOWN
4 timer expires.
Priority: 200 3 Priority: 200 3. R1 and R2 exchange VRRP packets with the same priority. R1 and R2
1 1 compare their interface IP addresses to select the master. Because the
interface IP address of R2 is greater than that of R1, R2 is selected as
Switch the master.
4. After R2 is elected as the master, it immediately sends gratuitous ARP
packets to advertise the virtual MAC address to the connected devices
and hosts.
16 Huawei Confidential
• If the device with a higher priority and the device with a lower priority start in
sequence, the device with a higher priority enters the Master state first. After
receiving a VRRP Advertisement packet with a higher priority, the device with a
lower priority remains in Backup state.
• If the device with a lower priority and the device with a higher priority start in
sequence, the device with a lower priority switches from the Backup state to the
Master state first. After receiving the VRRP Advertisement packet with a lower
priority, the device with a higher priority switches to the Master state.
VRRP Master/Backup Election (3)
17 Huawei Confidential
• In most cases, the interface IP address of a VRRP router does not overlap with
the IP address of a virtual router. That is, an independent IP address is planned
for the virtual router instead of the interface IP address of a router. There is also
an exception. For example, if IP addresses are insufficient on some networks, the
interface IP address of a router may be used as the IP address of the virtual
router. In this case, the router becomes the master.
Switch Switch
18 Huawei Confidential
• If the master gives up the master role (for example, the master is deleted from
the VRRP group), it sends VRRP Advertisement packets carrying a priority of 0 to
the backups. Without waiting for the MASTER_DOWN timer to expire, the backup
router with the highest priority switches to the Master state after a specified
switching time. This switching time is called Skew_Time.
• If the master cannot send VRRP Advertisement packets due to network faults, the
backups cannot learn the running status of the master immediately. In this
situation, the backup router with the highest priority switches to the Master state
after the MASTER_DOWN timer expires.
VRRP Active/Standby Switchback (1)
R1 R2 R1 R2
Switch Switch
1. In normal situations, the master forwards user packets. 2. When R1 fails, a new VRRP master/backup election is
As shown in the figure, all user traffic reaches the performed. As shown in the figure, R2 becomes the
Internet through R1. new master to forward user packets.
19 Huawei Confidential
VRRP Active/Standby Switchback (2)
Master Backup
PC1 PC2
state until the master fails even when detecting that the
PC3
priority of the master is lower than that of the backup.
3. After R1 recovers, a new VRRP master/backup election
is performed. R1 becomes the new master to forward
user packets because R1 has a higher priority than R2.
20 Huawei Confidential
• When the preemption mode is enabled for a VRRP group and an active/standby
switchover is performed, the switching time is as follows:
• In preemption mode, if the master is unstable or the network quality is poor, the
VRRP group frequently switches, causing frequent update of ARP entries. To
resolve this problem, you can set a preemption delay. After the preemption delay
plus the value of the MASTER_INTERVAL timer, if the master becomes stable, a
switchback is performed.
Contents
1. Introduction to VRRP
2. VRRP Implementation
21 Huawei Confidential
VRRP Load Balancing
⚫ In the scenario where multiple virtual routers (VRRP groups) are created and each physical router plays different
roles in different VRRP groups, the virtual IP addresses of different virtual routers function as different intranet
gateway addresses to implement load balancing.
VRRP
Vrid 2 Backup Vrid 2 Master
Virtual ip: 192.168.1.251 Virtual ip: 192.168.1.251
Priority: 100 Priority: 200
Switch
22 Huawei Confidential
VRRP Monitoring the Uplink Interface Status
Master Backup
VRRP
Switch
23 Huawei Confidential
• If association between VRRP and the uplink interface is not configured and the
uplink interface or link of R1 (master) in the VRRP group fails, the VRRP group
cannot detect the fault and the master cannot forward traffic. In this case, the
active/standby switchover cannot be performed, causing a traffic blackhole.
Association Between VRRP and BFD
⚫ With association between VRRP and BFD enabled, when the backup detects a fault
through BFD, the backup switches to the Master state immediately without waiting
for the MASTER_DOWN timer to expire. This implements millisecond-level
active/standby switchover.
R1 R2
GE0/0/0 GE0/0/0
192.168.1.251/24 192.168.1.252/24
Master BFD session
Backup
Switch
24 Huawei Confidential
• If the link between devices in a VRRP group fails, VRRP Advertisement packets
cannot be exchanged to negotiate the Master or Backup state. A backup switches
to the Master state when the MASTER_DOWN timer expires. During the waiting
period, user traffic is still forwarded to the master, resulting in user traffic loss.
• A BFD session is established between the master and backup in a VRRP group
and is bound to the VRRP group. BFD immediately detects communication faults
in the VRRP group and instructs the VRRP group to perform an active/standby
switchover, minimizing service interruptions.
• For association between VRRP and BFD, a VRRP group adjusts priorities according
to the BFD session status and determines whether to perform an active/standby
switchover according to the adjusted priorities. In practice, delayed preemption is
configured on the master and immediate preemption is configured on the
backup. When the backup detects that the BFD session goes Down, it increases
its priority to be higher than the priority of the master to implement a fast
switchover. After the fault is rectified and the BFD session goes Up, the new
master reduces its priority and sends a VRRP Advertisement packet. After the
delay, the new master becomes the backup again.
Application of VRRP and MSTP
SW1 SW2
Instance 1 vlan 10 primary Instance 1 vlan 10 secondary
Instance 2 vlan 20 secondary Instance 2 vlan 20 primary
SW3
25 Huawei Confidential
• MSTP maps one or more VLANs to an MSTI. Multiple VLANs share a spanning
tree, and MSTP implements load balancing.
1. Introduction to VRRP
2. VRRP Implementation
26 Huawei Confidential
Basic VRRP Configuration Commands (1)
1. Create a VRRP group and configure a virtual IP address for the VRRP group.
[interface-GigabitEthernet0/0/0] vrrp vrid virtual-router-id virtual-ip virtual-address
The virtual IP address of a VRRP group must be unique. Interfaces in the same VRRP group must use the same
VRID.
2. Configure a priority for each device in the VRRP group.
In most cases, the priority of the master is higher than that of the backup.
27 Huawei Confidential
Basic VRRP Configuration Commands (2)
5. Associate the VRRP group with an interface.
[interface-GigabitEthernet0/0/0] vrrp vrid virtual-router-id track interface interface-type interface-number [
increased value-increased | reduced value-decreased ]
You can configure the device to increase or decrease its priority when detecting an uplink interface or link fault.
The IP address owner and Eth-Trunk member interfaces cannot be associated with VRRP.
6. Associate the VRRP group with a BFD session.
28 Huawei Confidential
VRRP Configuration Example
GE0/0/1 R1 configuration:
Master R1 R2 Backup [R1] interface GigabitEthernet0/0/0
GE0/0/0 GE0/0/0 [R1-GigabitEthernet0/0/0] ip address 192.168.1.253 24
192.168.1.253/24 192.168.1.252/24
[R1-GigabitEthernet0/0/0] vrrp vrid 1 virtual-ip 192.168.1.254
Switch
[R1-GigabitEthernet0/0/0] vrrp vrid 1 priority 120
[R1-GigabitEthernet0/0/0] vrrp vrid 1 preempt-mode timer delay 10
[R1-GigabitEthernet0/0/0] vrrp vrid 1 track interface
GigabitEthernet0/0/1 reduced 30
HostA HostB HostC
IP: 192.168.1.1/24 IP: 192.168.1.2/24 IP: 192.168.1.3/24
Gateway: Gateway: Gateway:
192.168.1.254 192.168.1.254 192.168.1.254
R2 configuration:
Requirements: [R2] interface GigabitEthernet0/0/0
• R1 and R2 form a VRRP group. R1 is the master and R2 is the backup.
[R2-GigabitEthernet0/0/0] ip address 192.168.1.252 24
• The preemption mode is used when the master recovers. The preemption
delay is 10 seconds. [R2-GigabitEthernet0/0/0] vrrp vrid 1 virtual-ip 192.168.1.254
• The master monitors the status of the uplink interface to implement [R2-GigabitEthernet0/0/0] vrrp vrid 1 priority 110
automatic VRRP active/standby switchover.
29 Huawei Confidential
Verifying Basic VRRP Configurations
[R1]display vrrp [R2]display vrrp
GigabitEthernet0/0/0 | Virtual Router 1 # Set the VRID to 1. GigabitEthernet0/0/0 | Virtual Router 1
State : Master The device is in Master state in the VRRP State : Backup # The device is in Backup state in the VRRP
group. group.
Virtual IP : 192.168.1.254 Virtual IP : 192.168.1.254
Master IP : 192.168.1.253 Master IP : 192.168.1.253
PriorityRun : 120 #Set the priority of the interface in the VRRP PriorityRun : 110 #The priority of the interface in the VRRP
group to 120. group is 110.
PriorityConfig : 120 PriorityConfig : 110
MasterPriority : 120 MasterPriority : 120
Preempt : YES Delay Time : 10 s # Enable the preemption mode Preempt : YES Delay Time : 0 s # Enable the preemption mode
and set the preemption delay to 10s. and set the preemption delay to 0.
TimerRun : 1 s TimerRun : 1 s
TimerConfig : 1 s TimerConfig : 1 s
Auth type : NONE Auth type : NONE
Virtual MAC : 0000-5e00-0101 Virtual MAC : 0000-5e00-0101
Check TTL : YES Check TTL : YES
Config type : normal-vrrp Config type : normal-vrrp
Track IF : GigabitEthernet0/0/1 Priority reduced : 30
IF state : UP
30 Huawei Confidential
Quiz
31 Huawei Confidential
1. AD
Quiz
B. If the preemption delay is set to 4s, the backup becomes the new master if it does not
receive a VRRP Advertisement packet from the master within 4 seconds.
C. Set the preemption delay to 4s and the interval for sending VRRP Advertisement
packets to 2s. If the backup does not receive a VRRP Advertisement packet from the
master within 6s, the backup becomes the new master.
D. On a busy network, set the preemption delay to a large value to prevent VRRP flapping.
32 Huawei Confidential
2. AD
Summary
33 Huawei Confidential
Thank you. 把数字世界带入每个人、每个家庭、
每个组织,构建万物互联的智能世界。
Bring digital to every person, home, and
organization for a fully connected,
intelligent world.