Configuring BFD for the VRRP master to monitor the uplink

Network requirements

As shown in Figure 37:

Configure VRRP-Track-BFD collaboration to monitor the uplink on the master and meet the following requirements:

Figure 37: Network diagram

Configuration procedure

  1. Configure Router A:

    # Specify 10.10.10.10 as the source address of BFD echo packets.

    <RouterA> system-view
    [RouterA] bfd echo-source-ip 10.10.10.10
    

    # Create track entry 1 for the BFD session on Router A to verify the reachability of the uplink device (1.1.1.2).

    [RouterA] track 1 bfd echo interface gigabitethernet 1/0/1 remote ip 1.1.1.2 local ip 1.1.1.1
    [RouterA-track-1] quit
    

    # Create VRRP group 1, and specify 192.168.0.10 as the virtual IP address of the group.

    [RouterA] interface gigabitethernet 1/0/2
    [RouterA-GigabitEthernet1/0/2] vrrp vrid 1 virtual-ip 192.168.0.10
    

    # Set the priority of Router A to 110 in VRRP group 1.

    [RouterA-GigabitEthernet1/0/2] vrrp vrid 1 priority 110
    

    # Associate VRRP group 1 with track entry 1 and decrease the router priority by 20 when the state of track entry 1 changes to negative.

    [RouterA-GigabitEthernet1/0/2] vrrp vrid 1 track 1 priority reduced 20
    [RouterA-GigabitEthernet1/0/2] return
    
  2. On Router B, create VRRP group 1, and specify 192.168.0.10 as the virtual IP address of the group.

    <RouterB> system-view
    [RouterB] interface gigabitethernet 1/0/2
    [RouterB-GigabitEthernet1/0/2] vrrp vrid 1 virtual-ip 192.168.0.10
    [RouterB-GigabitEthernet1/0/2] return
    

Verifying the configuration

# Display detailed information about the VRRP group on Router A.

<RouterA> display vrrp verbose
IPv4 Virtual Router Information:
 Running Mode       : Standard
 Total number of virtual routers : 1
   Interface GigabitEthernet1/0/2
     VRID           : 1               Adver Timer  : 100
     Admin Status   : Up              State        : Master
     Config Pri     : 110             Running Pri  : 110
     Preempt Mode   : Yes             Delay Time   : 0
     Auth Type      : None
     Virtual IP     : 192.168.0.10
     Virtual MAC    : 0000-5e00-0101
     Master IP      : 192.168.0.101
   VRRP Track Information:
     Track Object   : 1              State : Positive          Pri Reduced : 20

# Display information about track entry 1 on Router A.

<RouterA> display track 1
Track ID: 1
  State: Positive
  Duration: 0 days 0 hours 0 minutes 32 seconds
  Tracked object type: BFD
  Notification delay: Positive 0, Negative 0 (in seconds)
  Tracked object:
    BFD session mode: Echo
    Outgoing interface: GigabitEthernet1/0/1
    VPN instance name: --
    Remote IP: 1.1.1.2
    Local IP: 1.1.1.1

# Display detailed information about the VRRP group on Router B.

<RouterB> display vrrp verbose
IPv4 Virtual Router Information:
 Running Mode      : Standard
 Total number of virtual routers : 1
   Interface GigabitEthernet1/0/2
     VRID           : 1               Adver Timer  : 100
     Admin Status   : Up              State        : Backup
     Config Pri     : 100             Running Pri  : 100
     Preempt Mode   : Yes             Delay Time   : 0
     Become Master  : 2200ms left
     Auth Type      : None
     Virtual IP     : 192.168.0.10
     Master IP      : 192.168.0.101

The output shows that when the status of track entry 1 becomes Positive, Router A is the master and Router B the backup.

# Display information about track entry 1 when the uplink of Router A goes down.

<RouterA> display track 1
Track ID: 1
  State: Negative
  Duration: 0 days 0 hours 0 minutes 32 seconds
  Tracked object type: BFD
  Notification delay: Positive 0, Negative 0 (in seconds)
  Tracked object:
    BFD session mode: Echo
    Outgoing interface: GigabitEthernet1/0/1
    VPN instance name: --
    Remote IP: 1.1.1.2
    Local IP: 1.1.1.1

# Display detailed information about the VRRP group on Router A.

<RouterA> display vrrp verbose
IPv4 Virtual Router Information:
 Running Mode      : Standard
 Total number of virtual routers : 1
   Interface GigabitEthernet1/0/2
     VRID           : 1               Adver Timer  : 100
     Admin Status   : Up              State        : Backup
     Config Pri     : 110             Running Pri  : 90
     Preempt Mode   : Yes             Delay Time   : 0
     Become Master  : 2200ms left
     Auth Type      : None
     Virtual IP     : 192.168.0.10
     Master IP      : 192.168.0.102
   VRRP Track Information:
     Track Object   : 1              State : Negative          Pri Reduced : 20

# Display detailed information about VRRP group 1 on Router B.

<RouterB> display vrrp verbose
IPv4 Virtual Router Information:
 Running Mode      : Standard
 Total number of virtual routers : 1
   Interface GigabitEthernet1/0/2
     VRID           : 1               Adver Timer  : 100
     Admin Status   : Up              State        : Master
     Config Pri     : 100             Running Pri  : 100
     Preempt Mode   : Yes             Delay Time   : 0
     Auth Type      : None
     Virtual IP     : 192.168.0.10
     Virtual MAC    : 0000-5e00-0101
     Master IP      : 192.168.0.102

The output shows that when Router A detects that the uplink fails through BFD, it decreases its priority by 20. Router B then preempts as the master.