Bidirectional forwarding detection (BFD)

Configuring BFD in SONiC

BFD with OSPF configuration

BFD with BGP configuration

BFD profiles

Configuring BFD in SONiC

Example model & SONiC version:

  • Aurora 830, Aurora 721, Aurora 621, Aurora 221
  • Netberg SONiC: sonic-broadcom-202411.n0

Bidirectional Forwarding Detection (BFD) is a network protocol that is used to detect faults between two routers or switches connected by a link. BFD replaces link-state detection mechanisms in existing routing protocols. It also provides a failure detection solution for links with no routing protocols.

The protocol defines a method of rapid detection of the failure of a forwarding path by checking that the next hop router is alive. The protocol will be able to detect the forwarding path failure in milliseconds, depending on the actual configuration. Currently, a Routing Protocol takes a few seconds (from 3 seconds to 180 seconds or even more) to detect that the neighbouring router, the next hop router, is not operational, causing packet loss due to incorrect routing information. BFD is designed to provide a rapid forwarding path failure detection service to a Routing Protocol in a few milliseconds.

BFD capabilities supported:

  • BGP, OSPFv2, and PIM forwarding path failure monitoring; default and user VRFs are also supported.
  • BFD single hop sessions.
  • BFD multi hop sessions.
  • Asynchronous mode of operation.
  • Echo mode of operation.
  • IPv4 address family.
  • IPv6 address family.
  • LAG interface.
  • ECMP paths for multi hop session.
  • FRR container warm reboot.
  • 64 BFD sessions.
  • Minimum timeout interval of 300 milliseconds.

Limitations:

  • BFD is not supported for VRRP and OSPFv3.
  • Does not support Demand mode or authentication.

BFD with OSPF configuration

You can configure BFD to monitor and notify of the reachability status between OSPF neighbors. BFD sessions are established between all neighboring interfaces participating in OSPF full state. BFD notifies the OSPF protocol that a link state change has occurred in case of an interface failure.

Configuration commands in FRR:

To enabled BFD globally:

sonic (config)# bfd
OSPF with BFD

Figure 1. Network topology

Pre-configuration:

1. Configure OSPF with BFD:

Aurora nba621-1

admin@nba621-1:~$ vtysh
Hello, this is FRRouting (version 10.0.1).
Copyright 1996-2005 Kunihiro Ishiguro, et al.
nba621-1# co
nba621-1(config)# router ospf
nba621-1(config-router)# network 10.0.1.0/31 area 0
nba621-1(config-router)# ospf router-id 10.10.10.1
nba621-1(config-router)# exit
nba621-1(config)# bfd
nba621-1(config-bfd)# peer 10.0.1.1
nba621-1(config-bfd-peer)# exit
nba621-1(config-bfd)# exit
nba621-1(config)# interface Ethernet68
nba621-1(config-if)# ip ospf bfd
nba621-1(config-if)# end

Aurora nba621-2

admin@nba621-2:~$ vtysh
Hello, this is FRRouting (version 10.0.1).
Copyright 1996-2005 Kunihiro Ishiguro, et al.
nba621-2# co
nba621-2(config)# router ospf
nba621-2(config-router)# network 10.0.1.0/31 area 0
nba621-2(config-router)# ospf router-id 10.10.10.10
nba621-2(config-router)# exit
nba621-2(config)# bfd
nba621-2(config-bfd)# peer 10.0.1.0
nba621-2(config-bfd-peer)# exit
nba621-2(config-bfd)# exit
nba621-2(config)# interface Ethernet68
nba621-2(config-if)# ip ospf bfd
nba621-2(config-if)# end

Different timer values can be configured to achieve the desired failure detection time. Below configurations can be used to configure BFD timers.

nba621-1(config)# bfd
nba621-1(config-bfd)# peer 10.0.1.1
nba621-1(config-bfd-peer)# detect-multiplier 3
nba621-1(config-bfd-peer)# receive-interval 200
nba621-1(config-bfd-peer)# transmit-interval 200

2. Check BFD peer status.

nba621-1# show bfd peer
BFD Peers:
        peer 10.0.1.1 vrf default
                ID: 2581757616
                Remote ID: 2883933796
                Active mode
                Status: up
                Uptime: 28 second(s)
                Diagnostics: ok
                Remote diagnostics: ok
                Peer Type: configured
                RTT min/avg/max: 0/0/0 usec
                Local timers:
                        Detect-multiplier: 3
                        Receive interval: 200ms
                        Transmission interval: 200ms
                        Echo receive interval: 50ms
                        Echo transmission interval: disabled
                Remote timers:
                        Detect-multiplier: 3
                        Receive interval: 300ms
                        Transmission interval: 300ms
                        Echo receive interval: 50ms
nba621-2# show bfd peer
BFD Peers:
        peer 10.0.1.0 vrf default
                ID: 2883933796
                Remote ID: 2581757616
                Active mode
                Status: up
                Uptime: 28 second(s)
                Diagnostics: ok
                Remote diagnostics: ok
                Peer Type: configured
                RTT min/avg/max: 0/0/0 usec
                Local timers:
                        Detect-multiplier: 3
                        Receive interval: 300ms
                        Transmission interval: 300ms
                        Echo receive interval: 50ms
                        Echo transmission interval: disabled
                Remote timers:
                        Detect-multiplier: 3
                        Receive interval: 200ms
                        Transmission interval: 200ms
                        Echo receive interval: 50ms

The output below shows the BFD counter for a particular BFD session:

nba621-1# show bfd peer 10.0.1.1 counters
        peer 10.0.1.1 vrf default
                Control packet input: 1008 packets
                Control packet output: 1335 packets
                Echo packet input: 0 packets
                Echo packet output: 0 packets
                Session up events: 1
                Session down events: 0
                Zebra notifications: 2
nba621-2# show bfd peer 10.0.1.0 counters
        peer 10.0.1.0 vrf default
                Control packet input: 1058 packets
                Control packet output: 1254 packets
                Echo packet input: 0 packets
                Echo packet output: 0 packets
                Session up events: 1
                Session down events: 0
                Zebra notifications: 2

BFD with BGP configuration

Configuration commands in FRR:

To enabled BFD globally:

sonic(config)# bfd
BGP with BFD in SONiC

Figure 2. Network topology

Pre-configuration:

1. Configure BGP with BFD:

Aurora nba621-1

nba621-1# co
nba621-1(config)# router bgp 65100
nba621-1(config-router)# neighbor 10.0.1.1 remote-as 65100
nba621-1(config-router)# neighbor 10.0.1.1 description NBA621-2
nba621-1(config-router)# neighbor 10.0.1.1 bfd
nba621-1(config-router)# end

Aurora nba621-2

nba621-2# co
nba621-2(config)# router bgp 65100
nba621-2(config-router)# neighbor 10.0.1.0 remote-as 65100
nba621-2(config-router)# neighbor 10.0.1.0 description NBA621-1
nba621-2(config-router)# neighbor 10.0.1.0 bfd
nba621-2(config-router)# end

2. Check BFD peer status and counters.

nba621-1# show bfd peer
BFD Peers:
        peer 10.0.1.1 local-address 10.0.1.0 vrf default interface Ethernet68
                ID: 1810322368
                Remote ID: 3836557488
                Active mode
                Status: up
                Uptime: 3 second(s)
                Diagnostics: ok
                Remote diagnostics: ok
                Peer Type: dynamic
                RTT min/avg/max: 0/0/0 usec
                Local timers:
                        Detect-multiplier: 3
                        Receive interval: 300ms
                        Transmission interval: 300ms
                        Echo receive interval: 50ms
                        Echo transmission interval: disabled
                Remote timers:
                        Detect-multiplier: 3
                        Receive interval: 300ms
                        Transmission interval: 300ms
                        Echo receive interval: 50ms
nba621-1# show bfd peer 10.0.1.1 counters
        peer 10.0.1.1 local-address 10.0.1.0 vrf default interface Ethernet68
                Control packet input: 1716 packets
                Control packet output: 1711 packets
                Echo packet input: 0 packets
                Echo packet output: 0 packets
                Session up events: 1
                Session down events: 0
                Zebra notifications: 2
nba621-2# show bfd peer
BFD Peers:
        peer 10.0.1.0 local-address 10.0.1.1 vrf default interface Ethernet68
                ID: 3836557488
                Remote ID: 1810322368
                Active mode
                Status: up
                Uptime: 10 second(s)
                Diagnostics: ok
                Remote diagnostics: ok
                Peer Type: dynamic
                RTT min/avg/max: 0/0/0 usec
                Local timers:
                        Detect-multiplier: 3
                        Receive interval: 300ms
                        Transmission interval: 300ms
                        Echo receive interval: 50ms
                        Echo transmission interval: disabled
                Remote timers:
                        Detect-multiplier: 3
                        Receive interval: 300ms
                        Transmission interval: 300ms
                        Echo receive interval: 50ms
nba621-2# show bfd peer 10.0.1.0 counters
        peer 10.0.1.0 local-address 10.0.1.1 vrf default interface Ethernet68
                Control packet input: 1802 packets
                Control packet output: 1821 packets
                Echo packet input: 0 packets
                Echo packet output: 0 packets
                Session up events: 1
                Session down events: 0
                Zebra notifications: 2

BFD profiles

BFD profiles are templates of BFD configuration applicable to multiple BFD peers without manual configuration. A BFD profile contains all the necessary BFD parameters. All pre-configured parameters are applied when you apply the BFD profile to a static peer, BGP, or OSPF configuration.

Configuration considerations:

  1. You can apply a BFD profile without first creating it. In that case, the default BFD settings will be used.
  2. A static BFD peer has some parameters configured. If a BFD profile is applied, the pre-configured parameters precede the BFD profile.
  3. BGP and OSPF share a BFD session, but the BFD profiles differ. The latest configured profile takes effect.
  4. BFD profile configuration is changed dynamically. All new values take effect immediately, and timers are renegotiated.
  5. A BFD profile associated with BGP, OSPF, or static peer is deleted. The associated BFD session falls back to default values.

Configure BFD profile

From the FRR configuration terminal:

sonic# configure
sonic(config)# bfd
sonic(config-bfd)# profile <profile-name>
sonic(config-bfd-profile)#

Parameter description:

detect-multiplier (2-128): The remote transmission interval multiplied by this value is the connection loss detection timer. The default value is 3.

Example: The detect-multiplier is 3, and the remote system has a transmission interval of 300. The local system will detect failures after 900 milliseconds without receiving packets.

echo-interval (10-60000): The minimum transmission interval to send BFD echo packets (less jitter). The default value is 300.
echo-mode: Configure echo mode.
minimum-ttl (1-254): Expect packets with at least this TTL. The packet gets discarded if the TTL of the received BFD packet is less than the configured TTL. The default value is 254.
passive-mode: Don't attempt to start sessions and wait for BFD control packets from peer. Disabled by default.
receive-interval: Configures the minimum interval that this system is capable of receiving control packets. The default value is 300.
shutdown: Disable BFD peer.
transmit-interval (10-60000): Configure peer transmit interval. The default value is 300.

Example:

sonic(config-bfd)# profile bfd-1
sonic(config-bfd-profile)# detect-multiplier 5
sonic(config-bfd-profile)# echo-interval 200
sonic(config-bfd-profile)# echo-mode
sonic(config-bfd-profile)# receive-interval 200
sonic(config-bfd-profile)# transmit-interval 200

Check configuration:

sonic# sh running-config bfdd
Building configuration...
Current configuration:
!
frr version 10.0.1
frr defaults traditional
hostname sonic
no service integrated-vtysh-config
!
bfd
 profile bfd-1
  detect-multiplier 5
  transmit-interval 200
  receive-interval 200
  echo-mode
  echo transmit-interval 200
  echo receive-interval 200
 exit
 !
exit
!
end

BFD profile and a BGP neighbor

sonic(config)# router bgp <ASN>
sonic(config-router)# neighbor <ip-address> bfd profile <profile-name>

Example:

sonic(config)# router bgp 65100
sonic(config-router)# neighbor 10.0.1.1 bfd profile bfd-1

Check the results:

nba621-1# sh bfd peer
BFD Peers:
       peer 10.0.1.1 local-address 10.0.1.0 vrf default interface Ethernet68
               ID: 3971341121
               Remote ID: 1664806485
               Active mode
               Status: up
               Uptime: 2 second(s)
               Diagnostics: ok
               Remote diagnostics: ok
               Peer Type: dynamic
               RTT min/avg/max: 0/0/0 usec
               Local timers:
                       Detect-multiplier: 5
                       Receive interval: 200ms
                       Transmission interval: 200ms
                       Echo receive interval: 200ms
                       Echo transmission interval: disabled
               Remote timers:
                       Detect-multiplier: 5
                       Receive interval: 200ms
                       Transmission interval: 200ms
                       Echo receive interval: 200ms
nba621-2# sh bfd peer
BFD Peers:
       peer 10.0.1.0 local-address 10.0.1.1 vrf default interface Ethernet68
               ID: 1664806485
               Remote ID: 3971341121
               Active mode
               Status: up
               Uptime: 10 second(s)
               Diagnostics: ok
               Remote diagnostics: ok
               Peer Type: dynamic
               RTT min/avg/max: 0/0/0 usec
               Local timers:
                       Detect-multiplier: 5
                       Receive interval: 200ms
                       Transmission interval: 200ms
                       Echo receive interval: 200ms
                       Echo transmission interval: disabled
               Remote timers:
                       Detect-multiplier: 5
                       Receive interval: 200ms
                       Transmission interval: 200ms
                       Echo receive interval: 200ms

BFD profile and an OSPF-enabled interface

sonic(config)# interface <interface-name>
sonic(config-if)# ip ospf bfd
sonic(config-if)# ip ospf bfd profile <profile-name>

Example:

sonic(config)# interface Ethernet68
sonic(config-if)# ip ospf bfd
sonic(config-if)# ip ospf bfd profile bfd-1

Check the results:

nba621-1# sh bfd peer
BFD Peers:
       peer 10.0.1.1 vrf default
               ID: 1315201472
               Remote ID: 50071634
               Active mode
               Status: up
               Uptime: 30 second(s)
               Diagnostics: ok
               Remote diagnostics: ok
               Peer Type: configured
               RTT min/avg/max: 0/0/0 usec
               Local timers:
                       Detect-multiplier: 5
                       Receive interval: 200ms
                       Transmission interval: 200ms
                       Echo receive interval: 200ms
                       Echo transmission interval: disabled
               Remote timers:
                       Detect-multiplier: 5
                       Receive interval: 200ms
                       Transmission interval: 200ms
                       Echo receive interval: 200ms
nba621-2# sh bfd peer
BFD Peers:
       peer 10.0.1.0 vrf default
               ID: 50071634
               Remote ID: 1315201472
               Active mode
               Status: up
               Uptime: 37 second(s)
               Diagnostics: ok
               Remote diagnostics: ok
               Peer Type: configured
               RTT min/avg/max: 0/0/0 usec
               Local timers:
                       Detect-multiplier: 5
                       Receive interval: 200ms
                       Transmission interval: 200ms
                       Echo receive interval: 200ms
                       Echo transmission interval: disabled
               Remote timers:
                       Detect-multiplier: 5
                       Receive interval: 200ms
                       Transmission interval: 200ms
                       Echo receive interval: 200ms
NEWS

Latest news