Skip to content
Ask AI

BFD Configuration

Bidirectional Forwarding Detection (BFD) is a unified network-wide detection mechanism used to quickly monitor the forwarding connectivity status of links or IP routes within a network. When certain links do not provide hardware detection, applications rely on the upper-layer protocol’s own Hello message mechanism for fault detection. However, the fault detection time of upper-layer protocols is usually above 1 second, which is unacceptable for some applications. The BFD protocol was developed in this context. BFD provides a standardized, media-independent, and protocol-independent fast fault detection mechanism, enabling rapid detection and monitoring of the forwarding connectivity status of links or IP routes in the network. This improves network performance. By quickly detecting communication failures between neighboring systems, users can establish backup channels more quickly to recover communication and ensure network reliability.

BFD (Bidirectional Forwarding Detection) is used to establish sessions between two network devices to detect bidirectional forwarding paths and provide services to upper-layer applications. BFD itself does not have a discovery mechanism; instead, it relies on upper-layer protocols to notify it of new neighbor relationships. When an upper-layer protocol establishes a new neighbor relationship, it informs BFD of the neighbor’s parameters, and BFD establishes a session based on the received parameters. Once the session is established, both parties periodically send BFD packets to each other quickly. If no BFD packets are received from the peer within the detection time, the bidirectional forwarding path is considered to have failed. The failure information is then communicated to the upper-layer application served by the session, which takes appropriate action.

Configure TasksInstructions
Create a BFD sessionRequired
Configure the detection multiplier for the BFD sessionOptional
Configure the minimum transmit interval for BFD packetsOptional
Configure the BFD mode as passiveOptional
Configure the receive interval for BFD packetsOptional
Configure the transmit interval for BFD packetsOptional
Terminate BFD session detectionOptional
Configure the BFD session as single-arm echo functionOptional
Configure BFD policy group and bind it to the peerOptional
Configure BFD session as data-plane modeOptional
OperationCommandDescription
Enter the system configuration viewconfigure terminal
Enter the BFD viewbfd
Create a BFD session and enter the BFD-peer viewpeer ip-address [{multihop|local-address ip-address|interface interface-type interface-name }]peer-address: IP address of the peer device
session-name: The name of the BFD session
local-address: The desired local IP address for sourcing BFD packets
interface-type: The type of the interface
interface-number: Interface number

Configuring the Detection Multiplier for the BFD Session

Section titled “Configuring the Detection Multiplier for the BFD Session”

The detection time of a BFD session is determined by the local detection multiplier configured for that session. Users can adjust the local detection multiplier based on the actual network conditions to increase or decrease the detection time of the BFD session. For example, for a relatively stable link where frequent detection of link status is not necessary, you can increase the local detection multiplier.

The formula to calculate the BFD detection time is:

BFD Detection Time = Local Detection Multiplier x Transmission Interval

OperationCommandDescription
Enter the BFD-peer viewpeer ip-address
Configure the detection multiplier for the BFD sessiondetect-multiplier valueThe range of value is: 2-255

Configuring the Minimum Transmit Interval for BFD Packets

Section titled “Configuring the Minimum Transmit Interval for BFD Packets”

BFD (Bidirectional Forwarding Detection) protocol relies on the Time To Live (TTL) field in its packets to play a crucial role in network operations. Used for swiftly detecting the availability of network paths, BFD monitors link status by sending probing packets. The TTL field specifies the maximum time or hop count that a packet can exist in the network.

Here’s how the TTL field functions:

Limiting packet propagation: The TTL field restricts the scope of BFD probing packets within the network. When a packet reaches its designated TTL, it is discarded, preventing it from indefinitely propagating across the network.

Rapid fault detection: TTL assists BFD in swiftly detecting link failures. If a probing packet fails to reach its destination within the specified TTL, BFD promptly concludes a link failure and notifies network devices to take appropriate actions, such as switching to alternate paths.

Conserving network resources: By setting an appropriate TTL value, unnecessary network traffic can be minimized. Setting a TTL too high might waste bandwidth and processing resources, while setting it too low could burden network devices with frequent BFD packet processing.

OperationCommandDescription
Enter the BFD-peer viewpeer ip-address
Configure the minimum transmit interval for BFD packetsminimum-ttl valueThe range of value is: 1-254

In passive mode, BFD (Bidirectional Forwarding Detection) operates by waiting for probe packets from the peer device and responding to them, rather than periodically sending its own probe packets.

Here’s how passive mode works:

Waiting for peer probe packets: In passive mode, the device continuously listens for BFD probe packets from the peer device. These probe packets are typically sent at regular intervals.

Responding to peer probe packets: Upon receiving BFD probe packets from the peer device, the device promptly responds. The response can be a simple acknowledgment or may include additional information such as packet sequence numbers.

Detecting link status: The device determines the link status by responding to the peer’s probe packets. If no probe packets are received from the peer for a period of time, the device assumes that a link failure may have occurred and triggers the appropriate fault handling mechanism.

The advantage of passive mode is that it conserves bandwidth and processing resources since the device does not need to periodically send probe packets. It is suitable for scenarios where the link is stable, bandwidth is limited, or sensitivity to network resource consumption is high. However, passive mode may not promptly detect link failures because it relies on probe packets from the peer device.

OperationCommandDescription
Enter the BFD-peer viewpeer ip-address
Configure the BFD mode as passivepassive-modeThe default value is active mode

Configuring the Receive Interval for BFD Packets

Section titled “Configuring the Receive Interval for BFD Packets”
OperationCommandDescription
Enter the BFD-peer viewpeer ip-address
Configure the receive interval for BFD packetsreceive-interval valueThe range value is 10-60000 Unit is: ms

Configuring the Transmit Interval for BFD Packets

Section titled “Configuring the Transmit Interval for BFD Packets”
OperationCommandDescription
Enter the BFD-peer viewpeer ip-address
Configure the transmit interval for BFD packetsreceive-interval valueThe range value is 10-60000 Unit is: ms
OperationCommandDescription
Enter the BFD-peer viewpeer ip-address
Terminate BFD session detectionshutdown

By configuring a unidirectional echo mode BFD session on the BFD-capable device, it can send BFD control packets to the non-BFD-capable device. When the non-BFD-capable device receives these packets, it simply loops them back at the IP layer. This loopback allows the BFD-capable device to detect link failures more quickly, as it can receive and process the echoed packets without waiting for a response from the non-BFD-capable device. This approach helps improve the efficiency of link failure detection in scenarios where only one device supports BFD.

OperationCommandDescription
Enter the BFD-peer viewpeer ip-address
Configure the BFD session as single-arm echo functionecho-mode
Configure the receive interval for BFD packetsecho-intervall valueThe range value is 10-60000 Unit is: ms

Configuring BFD sessions individually can be time-consuming and inefficient, especially when dealing with a large number of sessions. By creating BFD policy groups, you can define common parameters for multiple BFD sessions and then simply bind the policy group to each peer, reducing the configuration workload and ensuring consistency across multiple sessions. This approach streamlines the configuration process and makes it more manageable, particularly in environments with numerous BFD sessions.

OperationCommandDescription
Enter the BFD viewbfd
Create a BFD policy groupprofile profile-name
Enter the BFD peer viewpeer ip-address
Bind BFD policy to peerprofile profile-name

Configuring BFD session as data-plane mode

Section titled “Configuring BFD session as data-plane mode”

Software BFD refers to the process where packet transmission and reception during BFD detection, as well as the maintenance of BFD session state machines, rely entirely on the CPU for processing. Software BFD consumes a significant amount of CPU resources, so it can be used in conjunction with hardware BFD. Hardware BFD offloads tasks such as packet transmission, reception, and fault detection to dedicated hardware chips, thereby improving CPU utilization.

The device supports a maximum of eight data-plane BFD sessions.

OperationCommandDescription
Enter the BGP viewrouter bgp asn
Configure BFD session as date-plane modeneighbor neighbor_ip bfd data-plane
OperationCommand
Display the BFD session infoshow bfd peers brief
Display the BFD session statistics infoshow bfd peers counters

Network requirements

In the network, Device A and Device D establish EBGP neighbors on Device B and Device C respectively, Device A can receive the route announced by BGP on Device D in the form of ECMP, and the next hops are Device B and Device C respectively. cut off Device A’s Ethernet 49 port The BFD can detect the link break quickly and converge the route quickly.

Procedure

  1. Device A Configuration # Interface configuration IP address
sonic(config)# interface ethernet 49
sonic(config-if-49)# ip address 20.0.0.2/30
sonic(config-if-49)# exit
sonic(config)# interface ethernet 50
sonic(config-if-50)# ip address 30.0.0.2/30
sonic(config-if-50)# exit
sonic(config)# interface loopback 0
sonic(config-if-lo0)# ip address 10.1.15.10/32

# Configuring EBGP connections

sonic(config)# router bgp 65003
sonic(config-router)# bgp router-id 10.1.15.10
sonic(config-router)# no bgp ebgp-requires-policy
sonic(config-router)# neighbor 20.0.0.1 remote-as 65003
sonic(config-router)# neighbor 20.0.0.1 bfd
sonic(config-router)# neighbor 20.0.0.1 description DeviceB
sonic(config-router)# neighbor 30.0.0.1 remote-as 65003
sonic(config-router)# neighbor 30.0.0.1 bfd
sonic(config-router)# neighbor 30.0.0.1 description DeviceC
  1. Device B Configuration # Interface configuration IP address
sonic(config)# interface ethernet 50
sonic(config-if-50)# ip address 40.0.0.1/30
sonic(config-if-50)# exit
sonic(config)# interface loopback 0
sonic(config-if-lo0)# ip address 10.1.15.20/32

# Configuring EBGP connections

sonic(config)# router bgp 65003
sonic(config-router)# bgp router-id 10.1.15.20
sonic(config-router)# no bgp ebgp-requires-policy
sonic(config-router)# neighbor 20.0.0.2 remote-as 65001
sonic(config-router)# neighbor 20.0.0.2 bfd
sonic(config-router)# neighbor 20.0.0.2 description DeviceA
sonic(config-router)# neighbor 40.0.0.2 remote-as 65002
sonic(config-router)# neighbor 40.0.0.2 bfd
sonic(config-router)# neighbor 40.0.0.2 description DeviceD
  1. Device C, device D configuration is similar

Verify configuration

  1. View BGP, BFD session establishment. Device on line speed forwarding can hit the traffic declared route on Device D, cut the link, verify the convergence time verify that the convergence time meets the millisecond requirements.