BFD Overview

Bidirectional Forwarding Detection is a network protocol that permits low overhead and rapid detection of changes in paths reachability between two network devices.

There was a need to have a replaceholder for other keepalive and hello mechanisms provided by other routing protocols. Actually, BFD detects faster failures, than those mentioned mechanisms, and as such it becomes a mandatory requirement in today deployments.

BFD principle consists in exchanging specific packets with remote peer. As such, it is needed to configure both endpoints with BFD. The rate of emission and failover criterium are embedded in the packets. Based on the non reception of packets, the BFD endpoint will accordingly detect a failover with remote endpoint.

The protocol has improved along the years, and became a standard, from 2011. Initially, protocol was supporting only connected links, with single-hop. Now, BFD is able to monitor non directly connected links, with the multi-hop. BFD can also work in echo-mode. Both IPv4 or IPv6 links can be monitored.

BFD notifies the user about the reachability of such paths, and can also interact with other routing protocols. This is the case with BGP, where neighbors can be monitored by using BFD. This is also the case with OSPF and OSPF v3. As such, BFD notifies daemons of the rapid change on path reachability, and as consequence, routing protocols update routing tables quicker.

BFD Packets

BFD operates over UDP protocol. Destination port 3784 is used by BFD single-hop, while 4784 port is used by BFD multi-hop. echo-mode uses 3785 port. Moreover, the source port range is limited by the standard, as it can operate over the range from 49152 to 65535.

The BFD control packets payload contains some fields that determine how the BFD operates. For instance, if echo-mode is used, a field indicates that echo mode is used. It contains a discriminator ID, that is locally generated and determines the BFD session itself. the remote discriminator of remote endpoint is also mentioned in the BFD packet.

As mentioned before, BFD operates on time constraints. Those time constraints are chosen, after exchanging between both endpoints. The timer constraints are encoded in the BFD control packet. For instance, the local endpoint indicates the desired received interval that the remote endpoint can use to send BFD control packets. Reversely, the desired transmitted interval is also encoded in the packet.

BFD Operation

The main operation of BFD is to detect the quickest possible the loss of a remote peer. The detection time is calculated independently in each direction by the receiving system based on the negotiated transmit interval and the detection multiplier. For instance, if the agreed transmit interval is set to 100 ms, and the detection multiplier is set to three, the timeout calculation will be around 300 ms.

RFC

The BFD is handled by FRR. Following features are provided:

RFC 5880:

Bidirectional Forwarding Detection (BFD)

RFC 5881:

Bidirectional Forwarding Detection (BFD) for IPv4 and IPv6 (Single Hop)

RFC 5882:

Generic Application of Bidirectional Forwarding Detection (BFD)

RFC 5883:

Bidirectional Forwarding Detection (BFD) for Multihop Pathq

See also

The command reference for details.