Example for Configuring Association Between VRRP and BFD to Monitor the Uplink Status
Networking Requirements
As shown in Figure 7-15, hosts on a LAN are dual-homed to RouterA and RouterB through the switch. A VRRP group is established on RouterA and RouterB, and RouterA is the master. Generally, RouterA functions as the gateway and user traffic is along the path Switch -> RouterA -> RouterC -> RouterE.
When the link between RouterC and RouterE is faulty, the VRRP group can detect the fault within 1s and an active/standby switchover is performed rapidly. Then RouterB forwards services, so the impact of the link fault on service transmission is reduced.
Configuration Roadmap
The configuration roadmap is as follows:
- Assign an IP address to each interface and configure a routing protocol to ensure network connectivity.
- Configure a VRRP group on RouterA and RouterB, set the priority of RouterA to 120 and the preemption delay to 20s so that RouterA functions as the master, and configure RouterB to use the default priority so that RouterB functions as the backup.
- Configure a static BFD session on RouterA and RouterE to monitor the link between RouterA and RouterE.
- Configure association between VRRP and BFD on RouterA. When the link is faulty, an active/standby switchover can be performed rapidly.
Procedure
- Configure devices to ensure network connectivity.
# Assign an IP address to each interface. RouterA is used as an example. The configurations of RouterB, RouterC, RouterD, RouterE are similar to the configuration of routerA, and are not mentioned here.
<Huawei> system-view [Huawei] sysname RouterA [RouterA] interface gigabitethernet 1/0/0 [RouterA-GigabitEthernet1/0/0] ip address 10.1.1.1 24 [RouterA-GigabitEthernet1/0/0] quit [RouterA] interface gigabitethernet 2/0/0 [RouterA-GigabitEthernet2/0/0] ip address 192.168.1.1 24 [RouterA-GigabitEthernet2/0/0] quit
# Configure OSPF between Routers. RouterA is used as an example. The configurations of RouterB, RouterC, RouterD, RouterE are similar to the configuration of RouterA, and are not mentioned here.
[RouterA] ospf 1 [RouterA-ospf-1] area 0 [RouterA-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255 [RouterA-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255 [RouterA-ospf-1-area-0.0.0.0] quit [RouterA-ospf-1] quit
- Configure VRRP groups.
# Configure VRRP group 1 on RouterA, and set the priority of RouterA to 120 and the preemption delay to 20s.
[RouterA] interface gigabitethernet 1/0/0 [RouterA-GigabitEthernet1/0/0] vrrp vrid 1 virtual-ip 10.1.1.10 [RouterA-GigabitEthernet1/0/0] vrrp vrid 1 priority 120 [RouterA-GigabitEthernet1/0/0] vrrp vrid 1 preempt-mode timer delay 20 [RouterA-GigabitEthernet1/0/0] quit
# Configure VRRP group 1 on RouterB. RouterB uses default priority 100.
[RouterB] interface gigabitethernet 1/0/0 [RouterB-GigabitEthernet1/0/0] vrrp vrid 1 virtual-ip 10.1.1.10 [RouterB-GigabitEthernet1/0/0] quit
- Configure a static BFD session.
# Create a BFD session on RouterA.
[RouterA] bfd [RouterA-bfd] quit [RouterA] bfd atob bind peer-ip 172.16.1.2 [RouterA-bfd-session-atob] discriminator local 1 [RouterA-bfd-session-atob] discriminator remote 2 [RouterA-bfd-session-atob] min-rx-interval 50 [RouterA-bfd-session-atob] min-tx-interval 50 [RouterA-bfd-session-atob] commit [RouterA-bfd-session-atob] quit
# Create a BFD session on RouterE.
[RouterE] bfd [RouterE-bfd] quit [RouterE] bfd btoa bind peer-ip 192.168.1.1 [RouterE-bfd-session-btoa] discriminator local 2 [RouterE-bfd-session-btoa] discriminator remote 1 [RouterE-bfd-session-btoa] min-rx-interval 50 [RouterE-bfd-session-btoa] min-tx-interval 50 [RouterE-bfd-session-btoa] commit [RouterE-bfd-session-btoa] quit
- Configure association between VRRP and BFD.
# Configure association between VRRP and BFD on RouterA. When the BFD session becomes Down, the priority of RouterA decreases by 40.
[RouterA] interface gigabitethernet 1/0/0 [RouterA-GigabitEthernet1/0/0] vrrp vrid 1 track bfd-session 1 reduced 40 [RouterA-GigabitEthernet1/0/0] quit
- Verify the configuration.
# After the configuration is complete, run the display vrrp command on RouterA and RouterB. RouterA is the master, RouterB is the backup, and the associated BFD session is in Up state.
[RouterA] display vrrp GigabitEthernet1/0/0 | Virtual Router 1 State : Master Virtual IP : 10.1.1.10 Master IP : 10.1.1.1 PriorityRun : 120 PriorityConfig : 120 MasterPriority : 120 Preempt : YES Delay Time : 20 s TimerRun : 1 s TimerConfig : 1 s Auth Type : NONE Virtual Mac : 0000-5e00-0101 Check TTL : YES Config type : normal-vrrp Backup-forward : disabled Track BFD : 1 Priority reduced : 40 BFD-Session State: UP Create time : 2012-05-22 17:32:56 Last change time : 2012-05-22 17:33:00
[RouterB] display vrrp GigabitEthernet1/0/0 | Virtual Router 1 State : Backup Virtual IP : 10.1.1.10 Master IP : 10.1.1.1 PriorityRun : 100 PriorityConfig : 100 MasterPriority : 120 Preempt : YES Delay Time : 0 s TimerRun : 1 s TimerConfig : 1 s Auth Type : NONE Virtual Mac : 0000-5e00-0101 Check TTL : YES Config type : normal-vrrp Backup-forward : disabled Create time : 2012-05-22 17:33:00 Last change time : 2012-05-22 17:33:04
# Run the shutdown command on GE1/0/0 of RouterE to simulate a link fault.
[RouterE] interface gigabitethernet 1/0/0 [RouterE-GigabitEthernet1/0/0] shutdown [RouterE-GigabitEthernet1/0/0] quit
# Run the display vrrp command on RouterA and RouterB. You can see that RouterA is in Backup state, RouterB becomes the master, and the associated BFD session becomes Down.
[RouterA] display vrrp GigabitEthernet1/0/0 | Virtual Router 1 State : Backup Virtual IP : 10.1.1.10 Master IP : 10.1.1.2 PriorityRun : 80 PriorityConfig : 120 MasterPriority : 100 Preempt : YES Delay Time : 20 s TimerRun : 1 s TimerConfig : 1 s Auth Type : NONE Virtual Mac : 0000-5e00-0101 Check TTL : YES Config type : normal-vrrp Backup-forward : disabled Track BFD : 1 Priority reduced : 40 BFD-Session State: DOWN Create time : 2012-05-22 17:34:56 Last change time : 2012-05-22 17:35:00
[RouterB] display vrrp GigabitEthernet1/0/0 | Virtual Router 1 State : Master Virtual IP : 10.1.1.10 Master IP : 10.1.1.2 PriorityRun : 100 PriorityConfig : 100 MasterPriority : 100 Preempt : YES Delay Time : 0 s TimerRun : 1 s TimerConfig : 1 s Auth Type : NONE Virtual Mac : 0000-5e00-0101 Check TTL : YES Config type : normal-vrrp Backup-forward : disabled Create time : 2012-05-22 17:35:00 Last change time : 2012-05-22 17:35:04
# Run the undo shutdown command on GE1/0/0 of RouterE.
[RouterE] interface gigabitethernet 1/0/0 [RouterE-GigabitEthernet1/0/0] undo shutdown [RouterE-GigabitEthernet1/0/0] quit
# After 20s, run the display vrrp command on RouterA and RouterB. You can see that RouterA restores to be the master, RouterB restores to be the backup, and the associated BFD session is in Up state.
[RouterA] display vrrp GigabitEthernet1/0/0 | Virtual Router 1 State : Master Virtual IP : 10.1.1.10 Master IP : 10.1.1.1 PriorityRun : 120 PriorityConfig : 120 MasterPriority : 120 Preempt : YES Delay Time : 20 s TimerRun : 1 s TimerConfig : 1 s Auth Type : NONE Virtual Mac : 0000-5e00-0101 Check TTL : YES Config type : normal-vrrp Backup-forward : disabled Track BFD : 1 Priority reduced : 40 BFD-Session State: UP Create time : 2012-05-22 17:36:56 Last change time : 2012-05-22 17:37:00
[RouterB] display vrrp GigabitEthernet1/0/0 | Virtual Router 1 State : Backup Virtual IP : 10.1.1.10 Master IP : 10.1.1.1 PriorityRun : 100 PriorityConfig : 100 MasterPriority : 120 Preempt : YES Delay Time : 0 s TimerRun : 1 s TimerConfig : 1 s Auth Type : NONE Virtual Mac : 0000-5e00-0101 Check TTL : YES Config type : normal-vrrp Backup-forward : disabled Create time : 2012-05-22 17:37:00 Last change time : 2012-05-22 17:37:04
Configuration Files
RouterA configuration file
# sysname RouterA # bfd # interface GigabitEthernet1/0/0 ip address 10.1.1.1 255.255.255.0 vrrp vrid 1 virtual-ip 10.1.1.10 vrrp vrid 1 priority 120 vrrp vrid 1 preempt-mode timer delay 20 vrrp vrid 1 track bfd-session 1 reduced 40 # interface GigabitEthernet2/0/0 ip address 192.168.1.1 255.255.255.0 # bfd atob bind peer-ip 172.16.1.2 discriminator local 1 discriminator remote 2 min-tx-interval 50 min-rx-interval 50 commit # ospf 1 area 0.0.0.0 network 192.168.1.0 0.0.0.255 network 10.1.1.0 0.0.0.255 # return
RouterB configuration file
# sysname RouterB # bfd # interface GigabitEthernet1/0/0 ip address 10.1.1.2 255.255.255.0 vrrp vrid 1 virtual-ip 10.1.1.10 # interface GigabitEthernet2/0/0 ip address 192.168.2.1 255.255.255.0 # ospf 1 area 0.0.0.0 network 192.168.2.0 0.0.0.255 network 10.1.1.0 0.0.0.255 # return
RouterC configuration file
# sysname RouterC # interface GigabitEthernet1/0/0 ip address 192.168.1.2 255.255.255.0 # interface GigabitEthernet2/0/0 ip address 172.16.1.1 255.255.255.0 # ospf 1 area 0.0.0.0 network 172.16.1.0 0.0.0.255 network 192.168.1.0 0.0.0.255 # return
RouterD configuration file
# sysname RouterD # interface GigabitEthernet1/0/0 ip address 192.168.2.2 255.255.255.0 # interface GigabitEthernet2/0/0 ip address 172.16.2.1 255.255.255.0 # ospf 1 area 0.0.0.0 network 172.16.2.0 0.0.0.255 network 192.168.2.0 0.0.0.255 # return
RouterE configuration file
# sysname RouterE # bfd # interface GigabitEthernet1/0/0 ip address 172.16.1.2 255.255.255.0 # interface GigabitEthernet2/0/0 ip address 172.16.2.2 255.255.255.0 # bfd btoa bind peer-ip 192.168.1.1 discriminator local 2 discriminator remote 1 min-tx-interval 50 min-rx-interval 50 commit # ospf 1 area 0.0.0.0 network 172.16.1.0 0.0.0.255 network 172.16.2.0 0.0.0.255 # return