Single VRRP group configuration example
Network requirements
As shown in Figure 23, Router A and Router B form a VRRP group. They use the virtual IP address 10.1.1.111/24 to provide gateway service for the subnet where Host A resides.
Router A operates as the master to forward packets from Host A to Host B. When Router A fails, Router B takes over to forward packets for Host A.
Configure Router A to operate in preempt mode so Router A can forward traffic as long as Router A operates correctly. Set the preemption delay to 5000 centiseconds to avoid frequent status change.
Figure 23: Network diagram
Configuration procedure
Configure Router A:
# Specify an IP address for Router A.
<RouterA> system-view [RouterA] interface gigabitethernet 1/0/1 [RouterA-GigabitEthernet1/0/1] ip address 10.1.1.1 255.255.255.0
# Create VRRP group 1 on GigabitEthernet 1/0/1 and set its virtual IP address to 10.1.1.111.
[RouterA-GigabitEthernet1/0/1] vrrp vrid 1 virtual-ip 10.1.1.111
# Assign Router A a higher priority than Router B in VRRP group 1, so Router A can become the master.
[RouterA-GigabitEthernet1/0/1] vrrp vrid 1 priority 110
# Configure Router A to operate in preemptive mode, so it can become the master whenever it operates correctly. Set the preemption delay to 5000 centiseconds to avoid frequent status switchover.
[RouterA-GigabitEthernet1/0/1] vrrp vrid 1 preempt-mode delay 5000
Configure Router B:
# Specify an IP address for Router A.
<RouterB> system-view [RouterB] interface gigabitethernet 1/0/1 [RouterB-GigabitEthernet1/0/1] ip address 10.1.1.2 255.255.255.0
# Create VRRP group 1 on GigabitEthernet 1/0/1 and set its virtual IP address to 10.1.1.111.
[RouterB-GigabitEthernet1/0/1] vrrp vrid 1 virtual-ip 10.1.1.111
# Set the priority of Router B to 100 in VRRP group 1.
[RouterB-GigabitEthernet1/0/1] vrrp vrid 1 priority 100
# Configure Router B to operate in preemptive mode, and set the preemption delay to 5000 centiseconds.
[RouterB-GigabitEthernet1/0/1] vrrp vrid 1 preempt-mode delay 5000
Verifying the configuration
# Ping Host B from Host A. (Details not shown.)
# Display detailed information about VRRP group 1 on Router A.
[RouterA-GigabitEthernet1/0/1] display vrrp verbose IPv4 Virtual Router Information: Running Mode : Standard Total number of virtual routers : 1 Interface GigabitEthernet1/0/1 VRID : 1 Adver Timer : 100 Admin Status : Up State : Master Config Pri : 110 Running Pri : 110 Preempt Mode : Yes Delay Time : 5000 Auth Type : None Virtual IP : 10.1.1.111 Virtual MAC : 0000-5e00-0101 Master IP : 10.1.1.1
# Display detailed information about VRRP group 1 on Router B.
[RouterB-GigabitEthernet1/0/1] display vrrp verbose IPv4 Virtual Router Information: Running Mode : Standard Total number of virtual routers : 1 Interface GigabitEthernet1/0/1 VRID : 1 Adver Timer : 100 Admin Status : Up State : Backup Config Pri : 100 Running Pri : 100 Preempt Mode : Yes Delay Time : 5000 Become Master : 412ms left Auth Type : None Virtual IP : 10.1.1.111 Master IP : 10.1.1.1
The output shows that Router A is operating as the master in VRRP group 1 to forward packets from Host A to Host B.
# Disconnect the link between Host A and Router A, and verify that Host A can still ping Host B. (Details not shown.)
# Display detailed information about VRRP group 1 on Router B.
[RouterB-GigabitEthernet1/0/1] display vrrp verbose IPv4 Virtual Router Information: Running Mode : Standard Total number of virtual routers : 1 Interface GigabitEthernet1/0/1 VRID : 1 Adver Timer : 100 Admin Status : Up State : Master Config Pri : 100 Running Pri : 100 Preempt Mode : Yes Delay Time : 5000 Auth Type : None Virtual IP : 10.1.1.111 Virtual MAC : 0000-5e00-0101 Master IP : 10.1.1.2
The output shows that when Router A fails, Router B takes over to forward packets from Host A to Host B.
# Recover the link between Host A and Router A, and display detailed information about VRRP group 1 on Router A.
[RouterA-GigabitEthernet1/0/1] display vrrp verbose IPv4 Virtual Router Information: Running Mode : Standard Total number of virtual routers : 1 Interface GigabitEthernet1/0/1 VRID : 1 Adver Timer : 100 Admin Status : Up State : Master Config Pri : 110 Running Pri : 110 Preempt Mode : Yes Delay Time : 5000 Auth Type : None Virtual IP : 10.1.1.111 Virtual MAC : 0000-5e00-0101 Master IP : 10.1.1.1
The output shows that after Router A resumes normal operation, it becomes the master to forward packets from Host A to Host B.