GTAC-Sophia Publish time 2023-5-15 10:36:07

How to configure BFD on Ruijie Switch?

Introduction of BFD

The Bidirectional Forwarding Detection (BFD) enables a network device to rapidly detect a failure occurring in the communication with a neighbor device and switch traffic to a backup link to accelerate network convergence, thereby ensuring service continuity, reducing impact of device failures or linkfailures on services, and improving network availability. BFD packets are classified into control packets and echo packets.
Applied scenarios

The BFD protocol itself does not play a particularly meaningful role. It needs to be used in conjunction with other protocols in order to be of greater use, such as linkage with static routing, OSPF routing, VRRP protocols, policy routing, etc., using the link detection function of the BFD to sense the failure of a link of interest or an intermediate node device in the network, causing the BFD Neighbour to go down and thus notify the corresponding linkage function, such as static routing, OSPF routing, VRRP protocol, policy routing, etc. for routing policy, or switchover of primary and secondary relationships, relying on the BFD messaging mechanism to achieve ms-level switching in case of failure.
Static routing and BFD linkage example
Case of Configuration
a) Requirement

SW1, as a financial network aggregation switch, accesses two MSTP links, using floating static routes, with ISP-B as the primary link and switching to the ISP-A link in case ISP-B is not available. There is no detection mechanism for the Ethernet link, as long as the interface is UP, the line is considered available. So it is necessary to use the BFD protocol, as a link detection protocol.
b) Network Topology

data/attachment/forum/202305/15/103338n86j6zffxjeafohe.pngc) Configuration

Configuration on SW1:
1) Configure IP addresses and floating static routes

SW1>enSW1#conf terminalSW1(config)#interface gigabitEthernet 0/1SW1(config-GigabitEthernet 0/1)#no switchportSW1(config-GigabitEthernet 0/1)#ip address 1.1.1.2255.255.255.0SW1(config)#interface gigabitEthernet 0/2SW1(config-GigabitEthernet 0/2)#no switchportSW1(config-GigabitEthernet 0/2)#ip address 2.2.2.2255.255.255.0SW1(config)#ip route 0.0.0.0 0.0.0.0g0/1 1.1.1.1          ------>Configure the defaultroute, to link with the BFD, the route must be configured with the outgoinginterface and the next hop, the next hop and the source address specified bythe BFD on the other side must be the sameSW1(config)#ip route 0.0.0.0 0.0.0.02.2.2.1 200 ------>Floating route

2) Configure BFD to link with static router


SW1(config)#interface gigabitEthernet 0/1
SW1(config-GigabitEthernet 0/1)#bfd interval 500min_rx 500 multiplier 3 ------>Configure the BFD time parameter, this command also enablesthe BFD function of the interface, so it must be configured; 500/500/3 is therecommended configuration here, a probe message is sent at 500ms interval,three consecutive responses are not received to declare the link failure.

SW1(config-GigabitEthernet 0/1)#no bfd echo     ------>The default is bfd echo mode, atsome times (such as when connecting to FW or docking devices of other brands)the echo messages may be filtered resulting in BFD not being establishedsuccessfully, it is recommended to turn it off. When docking with other brands'devices, some devices do not support echo mode by default. If it is turned onour end, session down may occur.   
SW1(config)#ip route static bfd GigabitEthernet 0/11.1.1.1 source 1.1.1.2       ------> BFD and static route linkage

Configurationon SW2:
1) Configure IP addresses and floating static routes

SW2>enSW2#conf terminalSW2(config)#interface gigabitEthernet 0/1SW2(config-GigabitEthernet 0/1)#ip address 1.1.1.1255.255.255.0SW2(config)#interface gigabitEthernet 0/2SW2(config-GigabitEthernet 0/2)#ip address 2.2.2.1255.255.255.0SW2(config)#ip route 192.168.1.0 255.255.255.01.1.1.2SW2(config)#ip route 192.168.1.0 255.255.255.02.2.2.2 200

2) Configure BFD to link with static routes

SW2(config)#interface gigabitEthernet 0/1SW2(config-GigabitEthernet 0/1)#bfd interval 500min_rx 500 multiplier 3   SW2(config-GigabitEthernet 0/1)#no bfd echoSW2(config)#ip route static bfd GigabitEthernet 0/11.1.1.2 source 1.1.1.1

Verification
1) Run the "show bfd neighbors" toconfirm the status of BFD neighbor
R1#sh bfd nei
OurAddr         NeighAddr         LD/RDRH/RS    Holdown(mult)State Int               
1.1.1.2                  1.1.1.1                      2/1Up            0(5   )Up    GigabitEthernet 0/1
2) View the routing table by "show iproute"
3) With the correct configuration and link, tracertthe intranet address of the aggregation end on the SW1 to confirm that the pathgoes to ISP-A
4) SHUTDOWN the G0/1 interface on SW2 to simulate anoperator ISP-A failure; then tracert the intranet address of the aggregationend on SW1 to confirm the path switch to SW2.
OSPFrouting and BFD linkage example
Caseof Configuration
a) Requirement

The Layer 3 switches SWA and SWB are interconnected via the Layer 2 switch, running the OSPF protocol on the devices to establish routes and allowing OSPF to associate BFD applications on both interfaces. In the event of a link failure between the SWB and the Layer 2 switch, the BFD can quickly detect and inform the OSPF protocol, triggering rapid convergence of the protocol.
b) Network Topology

data/attachment/forum/202305/15/103431wv9hg1llcdep1lzb.png

c) Configuration

Configuration on SWA:
1) Configure IP address and OSPF route

SWA>enSWA#config terSWA(config)#interface gigabitEthernet 2/1SWA(config-GigabitEthernet 2/1)#ip address192.168.3.1 255.255.255.0SWA(config)#interface gigabitEthernet 1/1SWA(config-GigabitEthernet 1/1)#ip address192.168.1.1 255.255.255.0SWA(config-router)#router ospf 123SWA(config-router)#network 192.168.3.0 0.0.0.255area 0SWA(config-router)#network 192.168.1.0 0.0.0.255area 0   

2) Configure OSPF and BFD linkage
SWA(config)#interface gigabitEthernet 2/1
SWA(config-GigabitEthernet 2/1)#bfd interval 500min_rx 500 multiplier 3 ------>Configure the BFD time parameter. This command also enablesthe BFD function of the interface, so it must be configured; 500/500/3 is therecommended configuration here, sending a probe message at 500ms interval, anddeclaring the link failure if no response is received 3 consecutive times. Itis recommended to configure the same parameters at both ends of the BFD sessionto ensure that the associated BFD application protocols take effect at the sametime and to avoid a single-pass forwarding path due to the differentsuppression times configured at both ends.
SWA(config-GigabitEthernet 2/1)#no bfd echo   ------>The default is bfd echo mode,at some times (such as there is a FW in the middle or docking devices of otherbrands) may filter the echo messages resulting in the BFD not being establishedsuccessfully, it is recommended to disable it. When docking with devices ofother brands, some of the devices do not support echo mode by default. If it isturned on at our end, session down may occur.
SWA(config-router)#router ospf 123      
SWA(config-router)#bfd all-interfaces       ------>Enable ospf and BFD linkage
Configurationon SWB:
1) Configure IP address and OSPF route

SWB(config)#interface gigabitEthernet 2/1SWB(config-GigabitEthernet 2/1)#ip address192.168.3.2 255.255.255.0SWB(config)#interface gigabitEthernet 1/1SWB(config-GigabitEthernet 1/1)#ip address192.168.2.1 255.255.255.0SWB(config-router)# router ospf 123SWB(config-router)#network 192.168.3.0 0.0.0.255area 0SWB(config-router)#network 192.168.2.0 0.0.0.255area 0   

2) Configure OSPF and BFD linkage

SWB(config)#interface gigabitEthernet 2/1SWB(config-GigabitEthernet 2/1)#bfd interval 500min_rx 500 multiplier 3   SWB(config-GigabitEthernet 2/1)#no bfd echo      SWB(config-router)#router ospf 123   SWB(config-router)#bfd all-interfaces   

Note:
1) The BFD function does not support one-way detection; if the BFD function isto be configured, both ends of the device must support the BFD function at thesame time.
2) When configuring the BFD function, it isrecommended that the BFD echo function be disabled.

Verification:
1) Run the "show bfd neighbor" to confirmthe status of BFD neighbor
Ruijie#show bfd neighbors
OurAddr   NeighAddr    LD/RDRH/RS Holdown(mult)StateInt
192.168.3.1192.168.3.2   1/2    Up   532 (3 )       Up    G2/1
2) View the details about BFD
Ruijie# show bfd neighbors details
OurAddr               NeighAddr   LD/RD             RH/RS Holdown(mult)         State   Int
192.168.3.1         192.168.3.2    1/2                  Up                  532 (3 )      UpGe2/1
Local Diag: 0, Demand mode: 0, Poll bit: 0
MinTxInt: 200000, MinRxInt: 200000, Multiplier: 5
Received MinRxInt: 50000, Received Multiplier: 3
Holdown (hits): 600(22), Hello (hits): 200(84453)
Rx Count: 49824, Rx Interval (ms) min/max/avg:208/440/332
Tx Count: 84488, Tx Interval (ms) min/max/avg:152/248/196
Registered protocols: OSPF
Uptime: 02:18:49
Last packet: Version: 1      - Diagnostic: 0
I Hear You bit: 1                           - Demand bit: 0
Poll bit: 0                                       - Finalbit: 0
Multiplier: 3                                 - Length: 24
My Discr.: 2                                              - Your Discr.: 1
Min tx interval: 50000                  - Min rx interval: 50000

Policy-based Routing and BFD linkage example
Case of Configuration
a) Requirement

The Layer 3 switches SWA and SWB are interconnected via the Layer 2 switch. Policy routes are configured on the devices to establish forwarding paths, while allowing policy routes to be associated with BFD applications on the interfaces of both sides. In the event of a link failure between SWB and the Layer 2 switch, BFD can quickly detect and notify the policy route, triggering the system to delete the policy route, thus avoiding routing errors.
b) Network Topology

data/attachment/forum/202305/15/103517ac9peszdy0sppgcm.png

c) Configuration

Configurationon SWA:
1)Configureip and BFD session parameters on the interface g2/1

SWA>enSWA# configure terminalSWA(config)# interface GigabitEthernet2/1SWA(config-if)# no switchportSWA(config-if)# ip address 192.168.3.1255.255.255.0

SWA(config-if)# bfd interval 500 min_rx 500multiplier 5 ------>Configure the BFD time parameter, this command alsoenables the BFD function of the interface, so it must be configured; 500/500/3is the recommended configuration here, sending a probe message at 500msinterval, and declaring the link failure if no response is received for 3consecutive times.
SWA(config-if)# no bfd echo   ------>The default is bfd echo mode,at some times (such as there is a FW in the middle or docking devices of otherbrands) may filter the echo messages resulting in the BFD not being establishedsuccessfully, it is recommended to disable it.
2) Configure ip on the interface ge1/1

SWA(config-if)# exitSWA(config)# interface GigabitEthernet1/1SWA(config-if)# no switchportSWA(config)# ip address 192.168.1.1 255.255.255.0

3) Configure policy-based route and associate BFDto detect the neighbor 192.168.3.2

SWA(config)# ip access-list extended 100SWA(config-ext-nacl)# permit ip any 192.168.2.00.0.0.255SWA(config-ext-nacl)# deny ip any anySWA(config-ext-nacl)# exitSWA(config)# route-map Example1 permit 10SWA(config-route-map)# match ip address 100SWA(config-route-map)# set ip precedence prioritySWA(config-route-map)#set ip next-hopverify-availability 192.168.3.2 bfd GigabitEthernet 0/1 192.168.3.2SWA(config)# endSWA#wr

Configurationon SWB:
1) Configure ip and BFD session parameters on theinterface g2/1

SWB>enSWB#configure terminalSWB(config)# interface GigabitEthernet 2/1SWB(config-if)# no switchportSWB(config-if)# ip address 192.168.3.2255.255.255.0SWB(config-if)# bfd interval 500 min_rx 500multiplier 5 SWB(config-if)# no bfd echo

2) Configure ip on the interface ge1/1

SWB(config-if)# exitSWB(config)# interface GigabitEthernet1/1SWB(config-if)# no switchportSWB(config)# ip address 192.168.2.1 255.255.255.0

3) Configure policy-based route and associate BFDto detect the neighbor 192.168.3.1

SWB(config)# ip access-list extended 100SWB(config-ext-nacl)# permit ip any 192.168.1.00.0.0.255SWB(config-ext-nacl)# deny ip any anySWB(config-ext-nacl)# exitSWB(config)# route-map Example1 permit 10SWB(config-route-map)# match ip address 100SWB(config-route-map)# set ip precedence prioritySWB(config-route-map)#set ip next-hopverify-availability 192.168.3.1 bfd GigabitEthernet 2/1 192.168.3.1SWB(config)# endSWB#wr

Note:
1) The BFD function does not support one-way detection; if the BFD function isto be configured, both ends of the device must support the BFD function at the same time.
2) When configuring the BFD function, it is recommended that the BFD echo function be disabled.
Verification: The same command on both switches
Ruijie# show bfd neighbors details
OurAddr               NeighAddr   LD/RD            RH/RS Holdown(mult)         State   Int
192.168.3.1         192.168.3.2    1/2                  Up                  532 (3 )      UpGe2/1
Local Diag: 0, Demand mode: 0, Poll bit: 0
MinTxInt: 200000, MinRxInt: 200000, Multiplier: 5
Received MinRxInt: 50000, Received Multiplier: 3
Holdown (hits): 600(22), Hello (hits): 200(84453)
Rx Count: 49824, Rx Interval (ms) min/max/avg:208/440/332
Tx Count: 84488, Tx Interval (ms) min/max/avg:152/248/196
Registeredprotocols: PBR   
Uptime: 02:18:49
Last packet: Version: 1   - Diagnostic: 0
I Hear You bit: 1                           - Demand bit: 0
Poll bit: 0                                    - Finalbit: 0
Multiplier: 3                                  - Length: 24
My Discr.: 2                                              - Your Discr.: 1
Min tx interval: 50000                  - Min rx interval: 50000
Min Echo interval: 0
Pages: [1]
View full version: How to configure BFD on Ruijie Switch?