Bidirectional Forwarding Detection - BFD

BFD provides low overhead and rapid detection of failures in the paths between two network devices. It provides a unified mechanism for link detection over all media and protocol layers. Use BFD to detect failures for IPv4 and IPv6 single or multihop paths between any two network devices, including unidirectional path failure detection.

Cumulus Linux supports BFD with BGP, OSPF, PIM, and static routes and on interfaces, subinterfaces, and bonds.

Every BFD interface requires an IP address. The neighbor IP address for a single hop BFD session must exist in the ARP table before BFD can start sending control packets.

Cumulus Linux does not support:

  • BFD demand mode
  • Dynamic BFD timer negotiation on an existing session. Any change to the timer values takes effect only when the session goes down and comes back up.

Enable BFD

To enable BFD:

Run the nv set router bfd state enabled command:

cumulus@switch:~$ nv set router bfd state enabled
cumulus@switch:~$ nv config apply

To disable BFD, run the nv set router bfd state disabled command.

Enable and start the BFD service:

cumulus@switch:~$ sudo systemctl enable bfdd.service
cumulus@switch:~$ sudo systemctl start bfdd.service 

Configure BFD

You can configure BFD with NVUE or vtysh commands.

To configure BFD, you configure a BFD profile, then attach the profile to the client, such as a BGP neighbor or peer group, OSPF interface, PIM session, or static route. The BFD profile includes configuration parameters such detect multiplier, transmit interval, receive interval, and minimum expected TTL.

Configure a BFD Profile

To configure BFD, you must create a BFD profile that includes the following options:

  • The detection time multiplier to determine packet loss. The remote transmission interval is multiplied by this value to determine the connection loss detection timer. You can set a value between 1 and 255. The default value is 3.
  • The minimum interval for transmitting BFD control packets. You can set a value between 10 and 4294967 milliseconds. The default value is 300.
  • The minimum interval between the received BFD control packets. You can set a value between 10 and 4294967 milliseconds. The default value is 300.
  • Shutdown, which enables or disables the peer. When the peer is disabled the switch sends an administrative down message to the remote peer. The default value is disabled.
  • Passive mode, which marks the session as passive. A passive session does not attempt to start the connection and waits for control packets from the peer before it begins replying. Passive mode is useful when you have a router that acts as the central node of a star network and you want to avoid sending BFD control packets you don’t need to. You can set passive mode to enable or disabled. The default is disabled.
  • The minimum expected TTL for an incoming BFD control packet (for multi hop sessions only). This feature tightens the packet validation requirements to avoid receiving BFD control packets from other sessions. You can set a value between 1 and 254. The default value is 254 (only expect one hop between this system and the peer).

The following example configures a BFD profile called BFD1. The profile sets the detection time multiplier to 10, the minimum interval for transmitting BFD control packets and minimum interval between the received BFD control packets to 100, and the minimum expected TTL for an incoming BFD control packet to 1. The profile also enables shutdown and passive mode.

cumulus@switch:~$ nv set router bfd profile BFD1 detect-multiplier 10
cumulus@switch:~$ nv set router bfd profile BFD1 min-tx-interval 100
cumulus@switch:~$ nv set router bfd profile BFD1 min-rx-interval 100
cumulus@switch:~$ nv set router bfd profile BFD1 minimum-ttl 1
cumulus@switch:~$ nv set router bfd profile BFD1 shutdown enabled
cumulus@switch:~$ nv set router bfd profile BFD1 passive-mode enabled
cumulus@switch:~$ nv config apply
cumulus@switch:~$ sudo vtysh
...
switch# configure terminal
switch(config)# bfd
switch(config-bfd)# profile BFD1
switch(config-bfd)# detect-multiplier 10 transmit-interval 100 receive-interval 100 shutdown passive-mode minimum-ttl 1
switch(config-bfd)# end
switch# write memory
switch# exit

BFD with BGP

BFD with BGP enables you to decrease BGP convergence time. When you configure BFD with BGP, the switch registers and de-registers neighbors dynamically.

You can configure BFD for a peer group or for an individual neighbor by attaching a BFD profile.

The following example configures BFD for the neighbor swp51 using the BFD profile BFD1.

cumulus@switch:~$ nv set vrf default router bgp neighbor swp51 bfd profile BFD1
cumulus@switch:~$ nv config apply

The following example configures BFD for the peer group fabric using the BFD profile BFD1:

cumulus@switch:~$ nv set vrf default router bgp peer-group fabric bfd profile BFD1
cumulus@switch:~$ nv config apply

The following example configures BFD for the neighbor swp51 using the BFD profile BFD1.

cumulus@switch:~$ sudo vtysh
...
switch# configure terminal
switch(config)# router bgp 65000
switch(config-router)# neighbor swp1 bfd profile BFD1
switch(config-router)# end
switch# write memory
switch# exit

The following example configures BFD for the peer group fabric using the BFD profile BFD1:

cumulus@switch:~$ sudo vtysh
...
switch# configure terminal
switch(config)# router bgp 65000
switch(config-router)# neighbor fabric bfd profile BFD1
switch(config-router)# end
switch# write memory
switch# exit

The vtysh commands save the configuration in the /etc/frr/frr.conf file. For example:

...
router bgp 65101 vrf default
bgp router-id 10.10.10.1
! Neighbors
neighbor fabric peer-group
neighbor fabric remote-as external
neighbor fabric bfd profile BFD1
...

BFD with OSPF

When you enable BFD on an OSPF interface, a neighbor registers with BFD when two-way adjacency starts and de-registers when adjacency goes down. The BFD configuration is per interface and any IPv4 and IPv6 neighbors discovered on that interface inherit the configuration.

The following example configures BFD in OSPF for interface swp1 using the BFD profile BFD1.

cumulus@switch:~$ nv set interface swp1 router ospf bfd profile BFD1
cumulus@switch:~$ nv config apply
cumulus@switch:~$ sudo vtysh
...
switch# configure terminal
switch(config)# interface swp1
switch(config-if)# ip ospf bfd profile BFD1
switch(config-if)# end
switch# write memory
switch# exit

The vtysh commands save the configuration in the /etc/frr/frr.conf file. For example:

...
interface swp1
  ip ospf bfd 
  ip ospf bfd profile BFD1 
  ...

BFD with PIM

To configure BFD with PIM, you attach a BFD profile to a PIM session.

cumulus@switch:~$ nv set interface vlan10 router pim bfd profile BFD1
cumulus@switch:~$ nv config apply
cumulus@switch:~$ sudo vtysh
...
switch# configure terminal
switch(config)# interface vlan10
switch(config-if)# ip pim bfd profile BFD1
switch(config-if)# end
switch# write memory
switch# exit

The vtysh commands save the configuration in the /etc/frr/frr.conf file. For example:

...
interface vlan10
  ip pim 
  ip pim bfd 
  ip pim bfd profile BFD1 
  ...

BFD with Static Routes

You can associate static routes with BFD to monitor static route reachability. Depending on status of the BFD session, the switch either adds or removes static routes from the Routing Information Base (RIB).

cumulus@switch:~$ nv set vrf default router static 10.10.10.101/32 via 10.0.1.0 bfd profile BFD1 
cumulus@switch:~$ nv set vrf default router static 10.10.10.101/32 via 10.0.1.0 bfd multi-hop
cumulus@switch:~$ nv set vrf default router static 10.10.10.101/32 via 10.0.1.0 bfd source 10.10.10.3
cumulus@switch:~$ nv config apply
cumulus@switch:~$ nv set vrf default router static 10.10.10.101/32 distance 2 via 10.0.1.0 bfd profile BFD2
cumulus@switch:~$ nv set vrf default router static 10.10.10.101/32 distance 2 via 10.0.1.0 bfd multi-hop
cumulus@switch:~$ nv set vrf default router static 10.10.10.101/32 distance 2 via 10.0.1.0 bfd source 10.10.10.3
cumulus@switch:~$ nv config apply

Show BFD Information

You can show BFD configuration and operational data with NVUE or vtysh show commands.

To show BFD profile configuration details, run the nv show router bfd profile <profile-name> command:

cumulus@switch:~$ nv show router bfd profile BFD1
                   applied 
-----------------  -------- 
detect-multiplier  10 
min-rx-interval    100 
min-tx-interval    100 
shutdown           enabled 
passive-mode       enabled 
minimum-ttl        1 

To show information about BFD connected devices, run the following commands:

  • nv show vrf <vrf-id> router bfd peers shows
  • nv show vrf <vrf-id> router bfd peers --view brief shows
  • nv show vrf <vrf-id> router bfd peers --view standard shows
  • nv show vrf <vrf-id> router bfd peers --view detail shows
  • nv show vrf <vrf-id> router bfd peers --view counters shows
  • nv show vrf <vrf-id> router bfd peers <session-id> shows
cumulus@switch:~$ nv show vrf default router bfd peers --view brief
MHop - Multihop, Local - Local, Peer - Peer, Interface - Interface, State - 
State, Passive - Passive Mode, Time - Up/Down Time, Type - Config Type 
LocalId     MHop   Local       Peer        Interface  State  Passive  Time        Type 
----------  -----  ----------  ----------  ---------  -----  -------  ----------  ------- 
20162981    True   6.0.0.24    6.0.0.26               up     False    1:00:08:20  dynamic 
1002134429  True   6000::24    6000::26               up     False    1:00:08:20  dynamic 
1987835266  False  fe80::a288  fe80::9e05  p0_if.100  up     False    1:00:08:20  dynamic 
2124581159  False  fe80::a288  fe80::9e05  p0_if.101  up     False    1:00:08:20  dynamic 
2323511220  True   6000::24    6000::23               up     False    1:00:08:20  dynamic 
4089962224  True   6.0.0.24    6.0.0.23               up     False    0:19:07:20  dynamic 
cumulus@switch:~$ nv show vrf default router bfd peers --view counters
Local - Local, Peer - Peer, Interface - Interface, State - State, CtrlIn - 
Control Packet Input, CtrlOut - Control Packet Output, EchoIn - Echo Packet 
Input, EchoOut - Echo Packet Output, Up - Session Up, Down - Session Down, Zebra 
- Zebra Notification 
LocalId    Local      Peer       Interface State CtrlIn CtrlOut EchoIn EchoOut Up Down Zebra 
---------- ---------- ---------- --------- ----- ------ ------- ------ ------- -- ---- ----- 
20162981   6.0.0.24   6.0.0.26             up    248913 248920  0      0       1  0    5 
1002134429 6000::24   6000::26             up    248882 248829  0      0       1  0    5 
1987835266 fe80::a288 fe80::9e05 p0_if.100 up    473059 497655  0      0       1  0    9 
2124581159 fe80::a288 fe80::9e05 p0_if.101 up    472823 497637  0      0       1  0    5 
2323511220 6000::24   6000::23             up    320763 331701  0      0       1  0    5 
4089962224 6.0.0.24   6.0.0.23             up    254206 262960  0      0       1  0    14 

Show BFD with BGP

To show the BFD profile associated with a BGP neighbor or peer group, run the NVUE nv show vrf <vrf-id> router bgp neighbor <neighbor-id> bfd command or the nv show vrf <vrf-id> router bgp peer-group <peer-group-id> bfd command.

cumulus@switch:~$ nv show vrf default router bgp neighbor swp51 bfd
         operational  applied
-------  -----------  -------

profile               BFD1

To see neighbor information in BGP, including BFD status, run the vtysh show ip bgp neighbor <interface-id> command:

cumulus@switch:~$ sudo vtysh 
switch# show ip bgp neighbor swp51
...
BFD: Type: single hop
  Detect Mul: 4, Min Rx interval: 400, Min Tx interval: 400
  Status: Down, Last update: 0:00:00:08
...

Show BFD with OSPF

To show the BFD profile associated with an OSPF interface, run the NVUE nv show interface <interface-id> router ospf bfd command:

cumulus@switch:~$ nv show interface swp1 router ospf bfd
         operational  applied
-------  -----------  -------

profile               BFD1

You can run vtysh commands to show neighbor information in OSPF, including BFD status.

  • To show IPv6 OSPF interface information, run the vtysh show ip ospf6 interface <interface-id> command.

  • To show IPv4 OSPF interface information, run the vtysh show ip ospf interface <interface-id> command.

    The following example shows IPv6 OSPF interface information.

    cumulus@switch:~$ sudo vtysh
    switch# show ip ospf6 interface swp2s0
      swp2s0 is up, type BROADCAST
    Interface ID: 4
    Internet Address:
      inet : 11.0.0.21/30
      inet6: fe80::4638:39ff:fe00:6c8e/64
    Instance ID 0, Interface MTU 1500 (autodetect: 1500)
    MTU mismatch detection: enabled
    Area ID 0.0.0.0, Cost 10
    State PointToPoint, Transmit Delay 1 sec, Priority 1
    Timer intervals configured:
      Hello 10, Dead 40, Retransmit 5
    DR: 0.0.0.0 BDR: 0.0.0.0
    Number of I/F scoped LSAs is 2
      0 Pending LSAs for LSUpdate in Time 00:00:00 [thread off]
      0 Pending LSAs for LSAck in Time 00:00:00 [thread off]
    BFD: Detect Mul: 3, Min Rx interval: 300, Min Tx interval: 300
    
  • To show IPv6 OSPF neighbor details, run the vtysh show ip ospf6 neighbor detail command.

  • To show IPv4 OSPF interface information, run the vtysh show ip ospf neighbor detail command.

    The following example shows IPv6 OSPF neighbor details.

    cumulus@switch:~$ sudo vtysh
    switch# show ip ospf6 neighbor detail
      Neighbor 0.0.0.4%swp2s0
        Area 0.0.0.0 via interface swp2s0 (ifindex 4)
        His IfIndex: 3 Link-local address: fe80::202:ff:fe00:a
        State Full for a duration of 02:32:33
        His choice of DR/BDR 0.0.0.0/0.0.0.0, Priority 1
        DbDesc status: Slave SeqNum: 0x76000000
        Summary-List: 0 LSAs
        Request-List: 0 LSAs
        Retrans-List: 0 LSAs
        0 Pending LSAs for DbDesc in Time 00:00:00 [thread off]
        0 Pending LSAs for LSReq in Time 00:00:00 [thread off]
        0 Pending LSAs for LSUpdate in Time 00:00:00 [thread off]
        0 Pending LSAs for LSAck in Time 00:00:00 [thread off]
        BFD: Type: single hop
          Detect Mul: 3, Min Rx interval: 300, Min Tx interval: 300
          Status: Up, Last update: 0:00:00:20
    

Show BFD with PIM

To show the BFD profile associated with a PIM session, run the NVUE nv show interface <interface-id> router pim bfd command:

cumulus@switch:~$ nv show interface vlan10 router pim bfd
         operational  applied
-------  -----------  -------

profile               BFD1

Show BFD with Static Routes

To show the BFD profile associated with static routes, run the NVUE nv show vrf <vrf-id> router static <ipv4-prefix> via <ipv4> bfd command or the nv show vrf <vrf-id> router static <ipv4-prefix> distance <integer> via <ipv4> bfd command:

cumulus@switch:~$ nv show vrf default router static 10.10.10.101/32 via 10.0.1.0 bfd
         operational  applied
-------  -----------  -------

profile               BFD1

Troubleshooting

To troubleshoot BFD, run the Linux ptmctl -b command.

cumulus@switch:~$ ptmctl -b

----------------------------------------------------------------------------------------
port  peer                 state  local  type       diag  det   tx_timeout  rx_timeout
                                                          mult
----------------------------------------------------------------------------------------
swp1  fe80::202:ff:fe00:1  Up     N/A    singlehop  N/A   3     300         900
swp1  3101:abc:bcad::2     Up     N/A    singlehop  N/A   3     300         900

#continuation of output
---------------------------------------------------------------------
echo        echo        max      rx_ctrl  tx_ctrl  rx_echo  tx_echo
tx_timeout  rx_timeout  hop_cnt
---------------------------------------------------------------------
0           0           N/A      187172   185986   0        0
0           0           N/A      501      533      0        0