Example for Configuring BFD for OSPF
Networking Requirements
As shown in Figure 5-37, the networking requirements are as follows:
SwitchA, SwitchB, and SwitchC run OSPF.
BFD for OSPF is enabled on SwitchA, SwitchB, and SwitchC.
Service traffic is transmitted over the primary link SwitchA→SwitchB. The link SwitchA→SwitchC→SwitchB is a backup link.
BFD is configured on interfaces connecting SwitchA and SwitchB. When a fault occurs on the link between the switches, BFD can quickly detect the fault and notify OSPF of the fault. Then, the service traffic is transmitted over the backup link.
Configuration Roadmap
The configuration roadmap is as follows:
Configure basic OSPF functions on each switch.
Enable global BFD.
Enable BFD for OSPF on SwitchA and SwitchB.
Procedure
- Create VLANs and add corresponding interfaces to the VLANs.
<HUAWEI> system-view [~HUAWEI] sysname SwitchA [*HUAWEI] commit [~SwitchA] vlan 10 [*SwitchA-vlan10] quit [*SwitchA] vlan 20 [*SwitchA-vlan20] quit [*SwitchA] interface 10ge 1/0/1 [*SwitchA-10GE1/0/1] port link-type trunk [*SwitchA-10GE1/0/1] port trunk allow-pass vlan 10 [*SwitchA-10GE1/0/1] quit [*SwitchA] interface 10ge 1/0/2 [*SwitchA-10GE1/0/2] port link-type trunk [*SwitchA-10GE1/0/2] port trunk allow-pass vlan 20 [*SwitchA-10GE1/0/2] quit [*SwitchA] commit
The configurations of SwitchB and SwitchC are similar to the configuration of SwitchA, and are not provided here.
- Assign an IP address to each VLANIF interface.
[~SwitchA] interface vlanif 10 [*SwitchA-Vlanif10] ip address 10.1.1.1 24 [*SwitchA-Vlanif10] quit [*SwitchA] interface vlanif 20 [*SwitchA-Vlanif20] ip address 10.3.3.1 24 [*SwitchA-Vlanif20] quit [*SwitchA] commit
The configurations of SwitchB and SwitchC are similar to the configuration of SwitchA, and are not provided here.
- Configure basic OSPF functions. For details, see Example for Configuring Basic OSPF Functions.
- Configure BFD for OSPF.
# Enable global BFD on SwitchA.
[~SwitchA] bfd [*SwitchA-bfd] quit [*SwitchA] ospf [*SwitchA-ospf-1] bfd all-interfaces enable [*SwitchA-ospf-1] quit [*SwitchA] commit
# Enable global BFD on SwitchB.
[~SwitchB] bfd [*SwitchB-bfd] quit [*SwitchB] ospf [*SwitchB-ospf-1] bfd all-interfaces enable [*SwitchB-ospf-1] quit [*SwitchB] commit
# Enable global BFD on Switch C.
[~SwitchC] bfd [*SwitchC-bfd] quit [*SwitchC] ospf [*SwitchC-ospf-1] bfd all-interfaces enable [*SwitchC-ospf-1] quit [*SwitchC] commit
# Run the display ospf bfd session all command on SwitchA and SwitchB to verify that the BFD state is Up on both devices.
The following provides the configuration on SwitchA:
[~SwitchA] display ospf bfd session all OSPF Process 1 with Router ID 10.10.10.1 Area 0.0.0.0 interface 10.3.3.1(Vlanif20)'s BFD Sessions NeighborId:10.10.10.2 AreaId:0.0.0.0 Interface:Vlanif20 BFDState:Up rx :1000 tx :1000 Multiplier:3 BFD Local Dis:16385 LocalIpAdd:10.3.3.1 RemoteIpAdd:10.3.3.2 Diagnostic Info:No diagnostic information Area 0.0.0.0 interface 10.1.1.1(Vlanif10)'s BFD Sessions NeighborId:10.10.10.3 AreaId:0.0.0.0 Interface:Vlanif10 BFDState:Up rx :1000 tx :1000 Multiplier:3 BFD Local Dis:16385 LocalIpAdd:10.1.1.1 RemoteIpAdd:10.1.1.2 Diagnostic Info:No diagnostic information Total UP/DOWN/UNKNOWN BFD Session Number : 2 / 0 / 0
- Configure BFD on interfaces.
# Configure BFD on VLANIF 20 of SwitchA, set the minimum intervals for sending and receiving packets to 200 ms, and set the local detection time multiplier to 5.
[~SwitchA] interface vlanif 20 [*SwitchA-Vlanif20] ospf bfd enable [*SwitchA-Vlanif20] ospf bfd min-tx-interval 300 min-rx-interval 300 detect-multiplier 5 [*SwitchA-Vlanif20] quit [*SwitchA] commit
# Configure BFD on VLANIF 20 of SwitchB, set the minimum intervals for sending and receiving packets to 300 ms, and set the local detection time multiplier to 5.
[*SwitchB] interface vlanif 20 [*SwitchB-Vlanif20] ospf bfd enable [*SwitchB-Vlanif20] ospf bfd min-tx-interval 300 min-rx-interval 300 detect-multiplier 5 [*SwitchB-Vlanif20] quit [*SwitchB] commit
# Run the display ospf bfd session all command on SwitchA and SwitchB to verify that, on both devices, the minimum intervals for sending and receiving packets are 300 ms and that the local detection multiplier is 5.
The following provides the configuration on SwitchB:
[~SwitchB] display ospf bfd session all OSPF Process 1 with Router ID 10.10.10.2 Area 0.0.0.0 interface 10.3.3.2(Vlanif20)'s BFD Sessions NeighborId:10.10.10.1 AreaId:0.0.0.0 Interface:Vlanif20 BFDState:Up rx :300 tx :300 Multiplier:5 BFD Local Dis:16385 LocalIpAdd:10.3.3.2 RemoteIpAdd:10.3.3.1 Diagnostic Info:No diagnostic information Area 0.0.0.0 interface 10.2.2.2(Vlanif30)'s BFD Sessions NeighborId:10.10.10.3 AreaId:0.0.0.0 Interface:Vlanif30 BFDState:Up rx :300 tx :300 Multiplier:5 BFD Local Dis:16385 LocalIpAdd:10.2.2.2 RemoteIpAdd:10.2.2.1 Diagnostic Info:No diagnostic information Total UP/DOWN/UNKNOWN BFD Session Number : 2 / 0 / 0
- Verify the configuration.
# Run the shutdown command on VLANIF 20 of SwitchB to simulate a fault on the primary link.
[~SwitchB] interface vlanif 20 [~SwitchB-Vlanif20] shutdown [*SwitchB-Vlanif20] commit
# Display the routing table on SwitchA.
[~SwitchA] display ospf routing OSPF Process 1 with Router ID 10.10.10.1 Routing for Network Destination Cost Type NextHop AdvRouter Area 172.16.1.0/24 3 Stub 10.1.1.2 10.10.10.2 0.0.0.0 10.3.3.0/24 1 Stub 10.3.3.1 10.10.10.1 0.0.0.0 10.2.2.0/24 2 Transit 10.1.1.2 10.10.10.3 0.0.0.0 10.1.1.0/24 1 Transit 10.1.1.1 10.10.10.1 0.0.0.0 Total Nets: 4 Intra Area: 4 Inter Area: 0 ASE: 0 NSSA: 0
As shown in the OSPF routing table, the backup link SwitchA→SwitchC→SwitchB takes effect after the primary link fails. The next hop address of the route to 172.16.1.0/24 becomes 10.1.1.2.
Configuration Files
Configuration file of SwitchA
# sysname SwitchA # vlan batch 10 20 # router id 10.10.10.1 # bfd # interface Vlanif10 ip address 10.1.1.1 255.255.255.0 # interface Vlanif20 ip address 10.3.3.1 255.255.255.0 ospf bfd enable ospf bfd min-tx-interval 300 min-rx-interval 300 detect-multiplier 5 # interface 10GE1/0/1 port link-type trunk port trunk allow-pass vlan 10 # interface 10GE1/0/2 port link-type trunk port trunk allow-pass vlan 20 # ospf 1 bfd all-interface enable area 0.0.0.0 network 10.3.3.0 0.0.0.255 network 10.1.1.0 0.0.0.255 # return
Configuration file of SwitchB
# sysname SwitchB # vlan batch 20 30 40 # router id 10.10.10.2 # bfd # interface Vlanif20 ip address 10.3.3.2 255.255.255.0 ospf bfd enable ospf bfd min-tx-interval 300 min-rx-interval 300 detect-multiplier 5 # interface Vlanif30 ip address 10.2.2.2 255.255.255.0 # interface Vlanif40 ip address 172.16.1.1 255.255.255.0 # interface 10GE1/0/1 port link-type trunk port trunk allow-pass vlan 30 # interface 10GE1/0/2 port link-type trunk port trunk allow-pass vlan 20 # interface 10GE1/0/3 port link-type trunk port trunk allow-pass vlan 40 # ospf 1 bfd all-interface enable area 0.0.0.0 network 10.3.3.0 0.0.0.255 network 10.2.2.0 0.0.0.255 network 172.16.1.0 0.0.0.255 # return
Configuration file of Switch C
# sysname SwitchC # vlan batch 10 30 # router id 10.10.10.3 # bfd # interface Vlanif10 ip address 10.1.1.2 255.255.255.0 # interface Vlanif30 ip address 10.2.2.1 255.255.255.0 # interface 10GE1/0/1 port link-type trunk port trunk allow-pass vlan 10 # interface 10GE1/0/2 port link-type trunk port trunk allow-pass vlan 30 # ospf 1 bfd all-interface enable area 0.0.0.0 network 10.1.1.0 0.0.0.255 network 10.2.2.0 0.0.0.255 # return