VRRP load balancing configuration example

Network requirements

As shown in Figure 25, Router A, Router B, and Router C form a load-balanced VRRP group. They use the virtual IP address 10.1.1.1/24 to provide gateway service for subnet 10.1.1.0/24.

Configure VFs on Router A, Router B, and Router C to monitor their respective GigabitEthernet 1/0/2. When the interface on any one of them fails, the weights of the VFs on the problematic router decrease so another AVF can take over.

Figure 25: Network diagram

Configuration procedure

  1. Configure Router A:

    # Configure VRRP to operate in load balancing mode.

    <RouterA> system-view
    [RouterA] vrrp mode load-balance
    

    # Create VRRP group 1, and set its virtual IP address to 10.1.1.1.

    [RouterA] interface gigabitethernet 1/0/1
    [RouterA-GigabitEthernet1/0/1] ip address 10.1.1.2 24
    [RouterA-GigabitEthernet1/0/1] vrrp vrid 1 virtual-ip 10.1.1.1
    

    # Assign Router A the highest priority in VRRP group 1, so Router A can become the master.

    [RouterA-GigabitEthernet1/0/1] vrrp vrid 1 priority 120
    

    # 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
    [RouterA-GigabitEthernet1/0/1] quit
    

    # Create track entry 1 to monitor the upstream link status of GigabitEthernet 1/0/2. When the upstream link fails, the track entry transits to Negative.

    [RouterA] track 1 interface gigabitethernet 1/0/2
    

    # 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.

    [RouterA] interface gigabitethernet 1/0/1
    [RouterA-GigabitEthernet1/0/1] vrrp vrid 1 track 1 weight reduced 250
    
  2. Configure Router B:

    # Configure VRRP to operate in load balancing mode.

    <RouterB> system-view
    [RouterB] vrrp mode load-balance
    

    # Create VRRP group 1, and set its virtual IP address to 10.1.1.1.

    [RouterB] interface gigabitethernet 1/0/1
    [RouterB-GigabitEthernet1/0/1] ip address 10.1.1.3 24
    [RouterB-GigabitEthernet1/0/1] vrrp vrid 1 virtual-ip 10.1.1.1
    

    # Assign Router B a higher priority than Router C in VRRP group 1, so Router B can become the master when Router A fails.

    [RouterB-GigabitEthernet1/0/1] vrrp vrid 1 priority 110
    

    # 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
    [RouterB-GigabitEthernet1/0/1] quit
    

    # Create track entry 1 to monitor the upstream link status of GigabitEthernet 1/0/2. When the upstream link fails, the track entry transits to Negative.

    [RouterB] track 1 interface gigabitethernet 1/0/2
    

    # 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.

    [RouterB] interface gigabitethernet 1/0/1
    [RouterB-GigabitEthernet1/0/1] vrrp vrid 1 track 1 weight reduced 250
    
  3. Configure Router C:

    # Configure VRRP to operate in load balancing mode.

    <RouterC> system-view
    [RouterC] vrrp mode load-balance
    

    # Create VRRP group 1, and set its virtual IP address as 10.1.1.1.

    [RouterC] interface gigabitethernet 1/0/1
    [RouterC-GigabitEthernet1/0/1] ip address 10.1.1.4 24
    [RouterC-GigabitEthernet1/0/1] vrrp vrid 1 virtual-ip 10.1.1.1
    

    # Configure Router C to operate in preemptive mode, and set the preemption delay to 5000 centiseconds.

    [RouterC-GigabitEthernet1/0/1] vrrp vrid 1 preempt-mode delay 5000
    [RouterC-GigabitEthernet1/0/1] quit
    

    # Create track entry 1 to monitor the upstream link status of GigabitEthernet 1/0/2. When the upstream link fails, the track entry transits to Negative.

    [RouterC] track 1 interface gigabitethernet 1/0/2
    

    # 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.

    [RouterC] interface gigabitethernet 1/0/1
    [RouterC-GigabitEthernet1/0/1] 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 Router A.

[RouterA-GigabitEthernet1/0/1] display vrrp verbose
IPv4 Virtual Router Information:
 Running Mode      : Load Balance
 Total number of virtual routers : 1
   Interface GigabitEthernet1/0/1
     VRID           : 1                    Adver Timer  : 100
     Admin Status   : Up                   State        : Master
     Config Pri     : 120                  Running Pri  : 120
     Preempt Mode   : Yes                  Delay Time   : 5000
     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 Router B.

[RouterB-GigabitEthernet1/0/1] display vrrp verbose
IPv4 Virtual Router Information:
 Running Mode      : Load Balance
 Total number of virtual routers : 1
   Interface GigabitEthernet1/0/1
     VRID           : 1                    Adver Timer  : 100
     Admin Status   : Up                   State        : Backup
     Config Pri     : 110                  Running Pri  : 110
     Preempt Mode   : Yes                  Delay Time   : 5000
     Become Master  : 426ms 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 Router C.

[RouterC-GigabitEthernet1/0/1] display vrrp verbose
IPv4 Virtual Router Information:
 Running Mode      : Load Balance
 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  : 417ms 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 Router A is the master in VRRP group 1, and each of the three routers has one AVF and two LVFs.

# Disconnect the link of GigabitEthernet 1/0/2 on 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      : Load Balance
 Total number of virtual routers : 1
   Interface GigabitEthernet1/0/1
     VRID           : 1                    Adver Timer  : 100
     Admin Status   : Up                   State        : Master
     Config Pri     : 120                  Running Pri  : 120
     Preempt Mode   : Yes                  Delay Time   : 5000
     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 Router C.

[RouterC-GigabitEthernet1/0/1] display vrrp verbose
IPv4 Virtual Router Information:
 Running Mode      : Load Balance
 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.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 GigabitEthernet 1/0/2 on Router A fails, the weights of the VFs on Router A drop below the lower limit of failure. All VFs on Router A transit to the Initialized state and cannot forward traffic. The VF for MAC address 000f-e2ff-0011 on Router C becomes the AVF to forward traffic.

# When the timeout timer (about 1800 seconds) expires, display detailed information about VRRP group 1 on Router C.

[RouterC-GigabitEthernet1/0/1] display vrrp verbose
IPv4 Virtual Router Information:
 Running Mode      : Load Balance
 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
     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. The VF no longer forwards the packets destined for the MAC address.

# When Router A fails, display detailed information about VRRP group 1 on Router B.

[RouterB-GigabitEthernet1/0/1] display vrrp verbose
IPv4 Virtual Router Information:
 Running Mode      : Load Balance
 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.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: