VRRP load balancing mode configuration example
Network requirements
Switch A, Switch B, and Switch C belong to VRRP group 1 with the virtual IP address of 10.1.1.1/24.
Hosts on network segment 10.1.1.0/24 use 10.1.1.1/24 as their default gateway. Use the VRRP group to make sure that when a gateway (Switch A, Switch B, or Switch C) fails, the hosts on the LAN can access external networks through another gateway.
VRRP group 1 is operating in load balancing mode to make good use of network resources.
Configure a track entry on Switch A, Switch B, and Switch C to monitor their own VLAN-interface 3. When the interface on Switch A, Switch B, or Switch C fails, the weight of the corresponding switch decreases so that another switch with a higher weight can take over.
Configure track entries on Switch C to monitor Switch A and Switch B. When Switch A or Switch B fails, Switch C immediately takes over the AVF on Switch A or Switch B.
Figure 42: 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 configure its virtual IP address as 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
# Set the priority of Switch A in VRRP group 1 to 120, which is higher than that of Switch B (110) and that of Switch C (100), so that Switch A can become the master.
[SwitchA-Vlan-interface2] vrrp vrid 1 priority 120
# Configure Switch A to operate in preemptive mode, so that it can become the master whenever it operates properly; configure the preemption delay as five seconds to avoid frequent status switchover.
[SwitchA-Vlan-interface2] vrrp vrid 1 preempt-mode timer delay 5 [SwitchA-Vlan-interface2] quit
# Create track entry 1 to associate with the physical status of VLAN-interface 3 on Switch A. When the track entry becomes negative, it means that the interface fails.
[SwitchA] track 1 interface vlan-interface 3
# Configure VF tracking to monitor track entry 1 and specify the value by which the weight decreases, making the weight of Switch A decrease by more than 245 (250 in this example) when track entry 1 turns to negative. In such a case, another router with a higher weight can take over.
[SwitchA] interface vlan-interface 2 [SwitchA-Vlan-interface2] vrrp vrid 1 weight track 1 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 configure its virtual IP address as 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
# Set the priority of Switch B in VRRP group 1 to 110, which is higher than that of Switch C (100), so that Switch B can become the master when Switch A fails.
[SwitchB-Vlan-interface2] vrrp vrid 1 priority 110
# Set Switch B to operate in preemptive mode. The preemption delay is five seconds.
[SwitchB-Vlan-interface2] vrrp vrid 1 preempt-mode timer delay 5 [SwitchB-Vlan-interface2] quit
# Create track entry 1 to associate with the physical status of VLAN-interface 3 on Switch B. When the track entry becomes negative, it means that the interface fails.
[SwitchB] track 1 interface vlan-interface 3
# Configure VF tracking to monitor track entry 1 and specify the value by which the weight decreases, making the weight of Switch B decrease by more than 245 (250 in this example) when track entry 1 turns to negative. In such a case, another router with a higher weight can take over.
[SwitchB] interface vlan-interface 2 [SwitchB-Vlan-interface2] vrrp vrid 1 weight track 1 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 configure its virtual IP address as 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
# Set Switch C to operate in preemptive mode. The preemption delay is five seconds.
[SwitchC-Vlan-interface2] vrrp vrid 1 preempt-mode timer delay 5 [SwitchC-Vlan-interface2] quit
# Create track entry 1 to associate with the physical status of VLAN-interface 3 on Switch C. When the track entry becomes negative, it means that the interface fails.
[SwitchC] track 1 interface vlan-interface 3
# Configure VF tracking to monitor track entry 1 and specify the value by which the weight decreases, making the weight of Switch C decrease by more than 245 (250 in this example) when track entry 1 turns to negative. In such a case, another router with a higher weight can take over.
[SwitchC] interface vlan-interface 2 [SwitchC-Vlan-interface2] vrrp vrid 1 weight track 1 reduced 250 [SwitchC-Vlan-interface2] quit
# Create track entries 2 and 3 to monitor Switch A and Switch B, respectively. If a track entry becomes negative, it indicates that the corresponding switch fails.
[SwitchC] bfd echo-source-ip 1.2.3.4 [SwitchC] track 2 bfd echo interface vlan-interface 2 remote ip 10.1.1.2 local ip 10.1.1.4 [SwitchC] track 3 bfd echo interface vlan-interface 2 remote ip 10.1.1.3 local ip 10.1.1.4
# Configure VF tracking to monitor track entry 2. When track entry 2 becomes negative, the LVF on Switch C whose corresponding AVF is on the switch with the IP address of 10.1.1.2 immediately becomes active. Switch C takes over the AVF on Switch A.
[SwitchC] interface vlan-interface 2 [SwitchC-Vlan-interface2] vrrp vrid 1 track 2 forwarder-switchover member-ip 10.1.1.2
# Configure VF tracking to monitor track entry 3. When track entry 2 becomes negative, the LVF on Switch C whose corresponding AVF is on the switch with the IP address of 10.1.1.3 immediately becomes active. Switch C takes over the AVF on Switch B.
[SwitchC-Vlan-interface2] vrrp vrid 1 track 3 forwarder-switchover member-ip 10.1.1.3
Verify the configuration:
After the configuration, Host A can ping the external network. To verify your configuration, use the display vrrp verbose command.
# Display the detailed information about VRRP group 1 on Switch A.
[SwitchA-Vlan-interface2] display vrrp verbose IPv4 Standby Information: Run Mode : Load Balance Run Method : Virtual MAC Total number of virtual routers : 1 Interface Vlan-interface2 VRID : 1 Adver Timer : 1 Admin Status : Up State : Master Config Pri : 120 Running Pri : 120 Preempt Mode : Yes Delay Time : 5 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 the detailed information about VRRP group 1 on Switch B.
[SwitchB-Vlan-interface2] display vrrp verbose IPv4 Standby Information: Run Mode : Load Balance Run Method : Virtual MAC Total number of virtual routers : 1 Interface Vlan-interface2 VRID : 1 Adver Timer : 1 Admin Status : Up State : Backup Config Pri : 110 Running Pri : 110 Preempt Mode : Yes Delay Time : 5 Become Master : 4200ms 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 the detailed information about VRRP group 1 on Switch C.
[SwitchC-Vlan-interface2] display vrrp verbose IPv4 Standby Information: Run Mode : Load Balance Run Method : Virtual MAC Total number of virtual routers : 1 Interface Vlan-interface2 VRID : 1 Adver Timer : 1 Admin Status : Up State : Backup Config Pri : 100 Running Pri : 100 Preempt Mode : Yes Delay Time : 5 Become Master : 4200ms 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 Forwarder Switchover Track Information: Track Object : 2 State : Positive Member IP : 10.1.1.2 Track Object : 3 State : Positive Member IP : 10.1.1.3
The output shows that in VRRP group 1, Switch A is the master and Switch B and Switch C are the backups. Each switch has one AVF and two LVFs that act as the backups.
# When VLAN-interface 3 on Switch A fails, use the display vrrp verbose command to display the detailed information about VRRP group 1 on Switch A.
[SwitchA-Vlan-interface2] display vrrp verbose IPv4 Standby Information: Run Mode : Load Balance Run Method : Virtual MAC Total number of virtual routers : 1 Interface Vlan-interface2 VRID : 1 Adver Timer : 1 Admin Status : Up State : Master Config Pri : 120 Running Pri : 120 Preempt Mode : Yes Delay Time : 5 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
# Use the display vrrp verbose command to display the detailed information about VRRP group 1 on Switch C.
[SwitchC-Vlan-interface2] display vrrp verbose IPv4 Standby Information: Run Mode : Load Balance Run Method : Virtual MAC Total number of virtual routers : 1 Interface Vlan-interface2 VRID : 1 Adver Timer : 1 Admin Status : Up State : Backup Config Pri : 100 Running Pri : 100 Preempt Mode : Yes Delay Time : 5 Become Master : 4200ms 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 Redirect Time : 93 secs Time-out Time : 1293 secs 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 Forwarder Switchover Track Information: Track Object : 2 State : Positive Member IP : 10.1.1.2 Track Object : 3 State : Positive Member IP : 10.1.1.3
The output shows that when VLAN interface 3 on Switch A fails, the weight of the AVF on Switch A decreases to 5, which is lower than the lower limit of failure. All VFs on Switch A turn to initialized state and cannot be used for packet forwarding. The VF corresponding to MAC address 000f-e2ff-0011 on Switch C becomes the AVF, and Switch C takes over Switch A for packet forwarding.
# When the timeout timer (about 1800 seconds) expires, display the detailed information about VRRP group 1 on Switch C.
[SwitchC-Vlan-interface2] display vrrp verbose IPv4 Standby Information: Run Mode : Load Balance Run Method : Virtual MAC Total number of virtual routers : 1 Interface Vlan-interface2 VRID : 1 Adver Timer : 1 Admin Status : Up State : Backup Config Pri : 100 Running Pri : 100 Preempt Mode : Yes Delay Time : 5 Become Master : 4200ms 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 Forwarder Switchover Track Information: Track Object : 2 State : Positive Member IP : 10.1.1.2 Track Object : 3 State : Positive Member IP : 10.1.1.3
The output shows that when the timeout timer expires, the VF corresponding to virtual MAC address 000f-e2ff-0011 is removed, and does not forward the packets destined for the MAC address any more.
# When Switch A fails, use the display vrrp verbose command to display the detailed information about VRRP group 1 on Switch B.
[SwitchB-Vlan-interface2] display vrrp verbose IPv4 Standby Information: Run Mode : Load Balance Run Method : Virtual MAC Total number of virtual routers : 1 Interface Vlan-interface2 VRID : 1 Adver Timer : 1 Admin Status : Up State : Master Config Pri : 110 Running Pri : 110 Preempt Mode : Yes Delay Time : 5 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 that when Switch A fails, Switch B becomes the master because its priority is higher than that of Switch C.
# When Switch B fails, use the display vrrp verbose command to display the detailed information about VRRP group 1 on Switch C.
[SwitchC-Vlan-interface2] display vrrp verbose IPv4 Standby Information: Run Mode : Load Balance Run Method : Virtual MAC Total number of virtual routers : 1 Interface GigabitEthernet1/0/1 VRID : 1 Adver Timer : 1 Admin Status : Up State : Master Config Pri : 100 Running Pri : 100 Preempt Mode : Yes Delay Time : 5 Auth Type : None Virtual IP : 10.1.1.1 Member IP List : 10.1.1.4 (Local, Master) Forwarder Information: 2 Forwarders 2 Active Config Weight : 255 Running Weight : 255 Forwarder 02 State : Active Virtual MAC : 000f-e2ff-0012 (Take Over) Owner ID : 0000-5e01-1103 Priority : 85 Active : local Redirect Time : 93 secs Time-out Time : 1293 secs 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 Forwarder Switchover Track Information: Track Object : 2 State : Negative Member IP : 10.1.1.2 Track Object : 3 State : Negative Member IP : 10.1.1.3
The output shows that when Switch B fails, Switch C becomes the master, and Forwarder 02 on Switch C immediately becomes active. Switch C takes over the AVF on Switch B.