VRRP load balancing configuration example
Network requirements
Switch A, Switch B, and Switch C form a load-balanced VRRP group and use the virtual IP address 10.1.1.1/24 to provide gateway service for subnet 10.1.1.0/24, as shown in Figure 29.
Configure VFs on Switch A, Switch B, and Switch C to monitor their respective VLAN-interface 3. When the interface on any one of them fails, the weights of the VFs on the problematic switch decrease so another AVF can take over.
Figure 28: Network diagram
Configuration procedure
Configure Switch A:
# Configure VLAN 2.
<SwitchA> system-view [SwitchA] vlan 2 [SwitchA-vlan2] port gigabitethernet 1/0/5 [SwitchA-vlan2] quit
# Configure VRRP to operate in load balancing mode.
[SwitchA] vrrp mode load-balance
# Create VRRP group 1, and set its virtual IP address to 10.1.1.1.
[SwitchA] interface vlan-interface 2 [SwitchA-Vlan-interface2] ip address 10.1.1.2 24 [SwitchA-Vlan-interface2] vrrp vrid 1 virtual-ip 10.1.1.1
# Assign Switch A the highest priority in VRRP group 1, so Switch A can become the master.
[SwitchA-Vlan-interface2] vrrp vrid 1 priority 120
# Configure Switch A to operate in preemptive mode, so it can become the master whenever it operates correctly. Set the preemption delay to 500 centiseconds to avoid frequent status switchover.
[SwitchA-Vlan-interface2] vrrp vrid 1 preempt-mode delay 500 [SwitchA-Vlan-interface2] quit
# Create track entry 1 to monitor the upstream link status of VLAN-interface 3. When the upstream link fails, the track entry transits to Negative.
[SwitchA] track 1 interface vlan-interface 3
# Configure the VFs in VRRP group 1 to monitor track entry 1, and decrease their weights by 250 when the track entry transits to Negative.
[SwitchA] interface vlan-interface 2 [SwitchA-Vlan-interface2] vrrp vrid 1 track 1 weight reduced 250
Configure Switch B:
# Configure VLAN 2.
<SwitchB> system-view [SwitchB] vlan 2 [SwitchB-vlan2] port gigabitethernet 1/0/5 [SwitchB-vlan2] quit
# Configure VRRP to operate in load balancing mode.
[SwitchB] vrrp mode load-balance
# Create VRRP group 1, and set its virtual IP address to 10.1.1.1.
[SwitchB] interface vlan-interface 2 [SwitchB-Vlan-interface2] ip address 10.1.1.3 24 [SwitchB-Vlan-interface2] vrrp vrid 1 virtual-ip 10.1.1.1
# Assign Switch B a higher priority than Switch C in VRRP group 1, so Switch B can become the master when Switch A fails.
[SwitchB-Vlan-interface2] vrrp vrid 1 priority 110
# Configure Switch B to operate in preemptive mode, and set the preemption delay to 500 centiseconds.
[SwitchB-Vlan-interface2] vrrp vrid 1 preempt-mode delay 500 [SwitchB-Vlan-interface2] quit
# Create track entry 1 to monitor the upstream link status of VLAN-interface 3. When the upstream link fails, the track entry transits to Negative.
[SwitchB] track 1 interface vlan-interface 3
# Configure the VFs in VRRP group 1 to monitor track entry 1, and decrease their weights by 250 when the track entry transits to Negative.
[SwitchB] interface vlan-interface 2 [SwitchB-Vlan-interface2] vrrp vrid 1 track 1 weight reduced 250
Configure Switch C:
# Configure VLAN 2.
<SwitchC> system-view [SwitchC] vlan 2 [SwitchC-vlan2] port gigabitethernet 1/0/5 [SwitchC-vlan2] quit
# Configure VRRP to operate in load balancing mode.
[SwitchC] vrrp mode load-balance
# Create VRRP group 1, and set its virtual IP address to 10.1.1.1.
[SwitchC] interface vlan-interface 2 [SwitchC-Vlan-interface2] ip address 10.1.1.4 24 [SwitchC-Vlan-interface2] vrrp vrid 1 virtual-ip 10.1.1.1
# Configure Switch C to operate in preemptive mode, and set the preemption delay to 500 centiseconds.
[SwitchC-Vlan-interface2] vrrp vrid 1 preempt-mode delay 500 [SwitchC-Vlan-interface2] quit
# Create track entry 1 to monitor the upstream link status of VLAN-interface 3. When the upstream link fails, the traffic entry transits to Negative.
[SwitchC] track 1 interface vlan-interface 3
# Configure the VFs in VRRP group 1 to monitor track entry 1, and decrease their weights by 250 when the track entry transits to Negative.
[SwitchC] interface vlan-interface 2 [SwitchC-Vlan-interface2] vrrp vrid 1 track 1 weight reduced 250
Verifying the configuration
# Verify that Host A can ping the external network. (Details not shown.)
# Display detailed information about VRRP group 1 on Switch A.
[SwitchA-Vlan-interface2] display vrrp verbose IPv4 Virtual Router Information: Running Mode : Load Balance Total number of virtual routers : 1 Interface Vlan-interface2 VRID : 1 Adver Timer : 100 Admin Status : Up State : Master Config Pri : 120 Running Pri : 120 Preempt Mode : Yes Delay Time : 500 Auth Type : None Virtual IP : 10.1.1.1 Member IP List : 10.1.1.2 (Local, Master) 10.1.1.3 (Backup) 10.1.1.4 (Backup) Forwarder Information: 3 Forwarders 1 Active Config Weight : 255 Running Weight : 255 Forwarder 01 State : Active Virtual MAC : 000f-e2ff-0011 (Owner) Owner ID : 0000-5e01-1101 Priority : 255 Active : local Forwarder 02 State : Listening Virtual MAC : 000f-e2ff-0012 (Learnt) Owner ID : 0000-5e01-1103 Priority : 127 Active : 10.1.1.3 Forwarder 03 State : Listening Virtual MAC : 000f-e2ff-0013 (Learnt) Owner ID : 0000-5e01-1105 Priority : 127 Active : 10.1.1.4 Forwarder Weight Track Information: Track Object : 1 State : Positive Weight Reduced : 250
# Display detailed information about VRRP group 1 on Switch B.
[SwitchB-Vlan-interface2] display vrrp verbose IPv4 Virtual Router Information: Running Mode : Load Balance Total number of virtual routers : 1 Interface Vlan-interface2 VRID : 1 Adver Timer : 100 Admin Status : Up State : Backup Config Pri : 110 Running Pri : 110 Preempt Mode : Yes Delay Time : 500 Become Master : 410ms left Auth Type : None Virtual IP : 10.1.1.1 Member IP List : 10.1.1.3 (Local, Backup) 10.1.1.2 (Master) 10.1.1.4 (Backup) Forwarder Information: 3 Forwarders 1 Active Config Weight : 255 Running Weight : 255 Forwarder 01 State : Listening Virtual MAC : 000f-e2ff-0011 (Learnt) Owner ID : 0000-5e01-1101 Priority : 127 Active : 10.1.1.2 Forwarder 02 State : Active Virtual MAC : 000f-e2ff-0012 (Owner) Owner ID : 0000-5e01-1103 Priority : 255 Active : local Forwarder 03 State : Listening Virtual MAC : 000f-e2ff-0013 (Learnt) Owner ID : 0000-5e01-1105 Priority : 127 Active : 10.1.1.4 Forwarder Weight Track Information: Track Object : 1 State : Positive Weight Reduced : 250
# Display detailed information about VRRP group 1 on Switch C.
[SwitchC-Vlan-interface2] display vrrp verbose IPv4 Virtual Router Information: Running Mode : Load Balance Total number of virtual routers : 1 Interface Vlan-interface2 VRID : 1 Adver Timer : 100 Admin Status : Up State : Backup Config Pri : 100 Running Pri : 100 Preempt Mode : Yes Delay Time : 500 Become Master : 401ms left Auth Type : None Virtual IP : 10.1.1.1 Member IP List : 10.1.1.4 (Local, Backup) 10.1.1.2 (Master) 10.1.1.3 (Backup) Forwarder Information: 3 Forwarders 1 Active Config Weight : 255 Running Weight : 255 Forwarder 01 State : Listening Virtual MAC : 000f-e2ff-0011 (Learnt) Owner ID : 0000-5e01-1101 Priority : 127 Active : 10.1.1.2 Forwarder 02 State : Listening Virtual MAC : 000f-e2ff-0012 (Learnt) Owner ID : 0000-5e01-1103 Priority : 127 Active : 10.1.1.3 Forwarder 03 State : Active Virtual MAC : 000f-e2ff-0013 (Owner) Owner ID : 0000-5e01-1105 Priority : 255 Active : local Forwarder Weight Track Information: Track Object : 1 State : Positive Weight Reduced : 250
The output shows that Switch A is the master in VRRP group 1, and each of the three switches has one AVF and two LVFs.
# Disconnect the link of VLAN-interface 3 on Switch A, and display detailed information about VRRP group 1 on Switch A.
[SwitchA-Vlan-interface2] display vrrp verbose IPv4 Virtual Router Information: Running Mode : Load Balance Total number of virtual routers : 1 Interface Vlan-interface2 VRID : 1 Adver Timer : 100 Admin Status : Up State : Master Config Pri : 120 Running Pri : 120 Preempt Mode : Yes Delay Time : 500 Auth Type : None Virtual IP : 10.1.1.1 Member IP List : 10.1.1.2 (Local, Master) 10.1.1.3 (Backup) 10.1.1.4 (Backup) Forwarder Information: 3 Forwarders 0 Active Config Weight : 255 Running Weight : 5 Forwarder 01 State : Initialize Virtual MAC : 000f-e2ff-0011 (Owner) Owner ID : 0000-5e01-1101 Priority : 0 Active : 10.1.1.4 Forwarder 02 State : Initialize Virtual MAC : 000f-e2ff-0012 (Learnt) Owner ID : 0000-5e01-1103 Priority : 0 Active : 10.1.1.3 Forwarder 03 State : Initialize Virtual MAC : 000f-e2ff-0013 (Learnt) Owner ID : 0000-5e01-1105 Priority : 0 Active : 10.1.1.4 Forwarder Weight Track Information: Track Object : 1 State : Negative Weight Reduced : 250
# Display detailed information about VRRP group 1 on Switch C.
[SwitchC-Vlan-interface2] display vrrp verbose IPv4 Virtual Router Information: Running Mode : Load Balance Total number of virtual routers : 1 Interface Vlan-interface2 VRID : 1 Adver Timer : 100 Admin Status : Up State : Backup Config Pri : 100 Running Pri : 100 Preempt Mode : Yes Delay Time : 500 Become Master : 401ms left Auth Type : None Virtual IP : 10.1.1.1 Member IP List : 10.1.1.4 (Local, Backup) 10.1.1.2 (Master) 10.1.1.3 (Backup) Forwarder Information: 3 Forwarders 2 Active Config Weight : 255 Running Weight : 255 Forwarder 01 State : Active Virtual MAC : 000f-e2ff-0011 (Take Over) Owner ID : 0000-5e01-1101 Priority : 85 Active : local Forwarder 02 State : Listening Virtual MAC : 000f-e2ff-0012 (Learnt) Owner ID : 0000-5e01-1103 Priority : 85 Active : 10.1.1.3 Forwarder 03 State : Active Virtual MAC : 000f-e2ff-0013 (Owner) Owner ID : 0000-5e01-1105 Priority : 255 Active : local Forwarder Weight Track Information: Track Object : 1 State : Positive Weight Reduced : 250
The output shows that when VLAN-interface 3 on Switch A fails, the weights of the VFs on Switch A drop below the lower limit of failure. All VFs on Switch A transit to the Initialized state and cannot forward traffic. The VF for MAC address 000f-e2ff-0011 on Switch C becomes the AVF to forward traffic.
# When the timeout timer (about 1800 seconds) expires, display detailed information about VRRP group 1 on Switch C.
[SwitchC-Vlan-interface2] display vrrp verbose IPv4 Virtual Router Information: Running Mode : Load Balance Total number of virtual routers : 1 Interface Vlan-interface2 VRID : 1 Adver Timer : 100 Admin Status : Up State : Backup Config Pri : 100 Running Pri : 100 Preempt Mode : Yes Delay Time : 500 Become Master : 402ms left Auth Type : None Virtual IP : 10.1.1.1 Member IP List : 10.1.1.4 (Local, Backup) 10.1.1.2 (Master) 10.1.1.3 (Backup) Forwarder Information: 2 Forwarders 1 Active Config Weight : 255 Running Weight : 255 Forwarder 02 State : Listening Virtual MAC : 000f-e2ff-0012 (Learnt) Owner ID : 0000-5e01-1103 Priority : 127 Active : 10.1.1.3 Forwarder 03 State : Active Virtual MAC : 000f-e2ff-0013 (Owner) Owner ID : 0000-5e01-1105 Priority : 255 Active : local Forwarder Weight Track Information: Track Object : 1 State : Positive Weight Reduced : 250
The output shows that when the timeout timer expires, the VF for virtual MAC address 000f-e2ff-0011 is removed, and no longer forwards the packets destined for the MAC address.
# When Switch A fails, display detailed information about VRRP group 1 on Switch B.
[SwitchB-Vlan-interface2] display vrrp verbose IPv4 Virtual Router Information: Running Mode : Load Balance Total number of virtual routers : 1 Interface Vlan-interface2 VRID : 1 Adver Timer : 100 Admin Status : Up State : Master Config Pri : 110 Running Pri : 110 Preempt Mode : Yes Delay Time : 500 Auth Type : None Virtual IP : 10.1.1.1 Member IP List : 10.1.1.3 (Local, Master) 10.1.1.4 (Backup) Forwarder Information: 2 Forwarders 1 Active Config Weight : 255 Running Weight : 255 Forwarder 02 State : Active Virtual MAC : 000f-e2ff-0012 (Owner) Owner ID : 0000-5e01-1103 Priority : 255 Active : local Forwarder 03 State : Listening Virtual MAC : 000f-e2ff-0013 (Learnt) Owner ID : 0000-5e01-1105 Priority : 127 Active : 10.1.1.4 Forwarder Weight Track Information: Track Object : 1 State : Positive Weight Reduced : 250
The output shows the following information:
When Switch A fails, Switch B becomes the master because it has a higher priority than Switch C.
The VF for virtual MAC address 000f-e2ff-0011 is removed.