Configuring BFD for a VRRP backup to monitor the master
Network requirements
As shown in Figure 36:
Router A and Router B belong to VRRP group 1. The virtual IP address of VRRP group 1 is 192.168.0.10.
The default gateway of the hosts in the LAN is 192.168.0.10.
Configure VRRP-Track-BFD collaboration to monitor the master on the backup and meet the following requirements:
When Router A operates correctly, the hosts in the LAN access the Internet through Router A.
When Router A fails, the backup (Router B) can detect the state change of the master through BFD and become the new master. The hosts in the LAN access the Internet through Router B.
Figure 36: Network diagram
Configuration procedure
Configure Router A:
# Create VRRP group 1, and configure virtual IP address 192.168.0.10 for the group.
<RouterA> system-view [RouterA] interface gigabitethernet 1/0/1 [RouterA-GigabitEthernet1/0/1] vrrp vrid 1 virtual-ip 192.168.0.10
# Set the priority of Router A to 110 in VRRP group 1.
[RouterA-GigabitEthernet1/0/1] vrrp vrid 1 priority 110 [RouterA-GigabitEthernet1/0/1] return
Configure Router B:
# Specify 10.10.10.10 as the source address of BFD echo packets.
<RouterB> system-view [RouterB] bfd echo-source-ip 10.10.10.10
# Create track entry 1, and associate it with the BFD session to verify the reachability of Router A.
[RouterB] track 1 bfd echo interface gigabitethernet 1/0/1 remote ip 192.168.0.101 local ip 192.168.0.102 [RouterB-track-1] quit
# Create VRRP group 1, and configure virtual IP address 192.168.0.10 for the group.
[RouterB] interface gigabitethernet 1/0/1 [RouterB-GigabitEthernet1/0/1] vrrp vrid 1 virtual-ip 192.168.0.10
# Configure VRRP group 1 to monitor the status of track entry 1.
[RouterB-GigabitEthernet1/0/1] vrrp vrid 1 track 1 switchover [RouterB-GigabitEthernet1/0/1] return
Verifying the configuration
# Display detailed information about VRRP group 1 on Router A.
<RouterA> 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 : 0 Auth Type : None Virtual IP : 192.168.0.10 Virtual MAC : 0000-5e00-0101 Master IP : 192.168.0.101
# 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/1 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 VRRP Track Information: Track Object : 1 State : Positive Switchover
# Display information about track entry 1 on Router B.
<RouterB> 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: 192.168.0.101 Local IP: 192.168.0.102
The output shows that when the status of the track entry becomes Positive, Router A is the master, and Router B the backup.
# Enable VRRP state debugging and BFD event notification debugging on Router B.
<RouterB> terminal debugging <RouterB> terminal monitor <RouterB> debugging vrrp fsm <RouterB> debugging bfd ntfy
# When Router A fails, the following output is displayed on Router B.
*Dec 17 14:44:34:142 2008 RouterB BFD/7/DEBUG: Notify application:TRACK State:DOWN *Dec 17 14:44:34:144 2008 RouterB VRRP4/7/FSM IPv4 GigabitEthernet1/0/1 | Virtual Router 1 : Backup --> Master reason: The status of the tracked object changed
# 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/1 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 VRRP Track Information: Track Object : 1 State : Negative Switchover
The output shows that when BFD detects that Router A fails, the Track module notifies VRRP to change the status of Router B to master. The backup can quickly preempt as the master without waiting for a period three times the advertisement interval plus the Skew_Time.