Bidirectional Forwarding Detection

A link fails and OSPF takes 40 seconds to move traffic, so the hand goes to the hello timer. Pushed as far as it goes, a routing protocol's timers detect a failure in one to two seconds; BFD detects it in under one. A hello answers two questions, liveness and topology, and BFD takes the first. A session needs bfd interval on both ends, then each protocol registers.

In Daveth Pro (Network)5 min video · lab: Between domains

By , founder of Daveth · Updated

Opening frame of the video walkthrough of Bidirectional Forwarding Detection

Watch this lesson

5 min · Video walkthrough

In Daveth Pro (Network)

The full 5 min walkthrough is in Daveth Pro (Network). See what the plan opens

Upcoming practical lab

Lab C4: Between domains

What the lab covers

What this page answers

Why use BFD instead of lowering routing protocol timers?

Lowered EIGRP, IS-IS and OSPF timers bottom out at a detection time of one to two seconds, while BFD can detect failures in under one second. A hello does two jobs, liveness and topology; BFD takes liveness alone. Read it in “How much does that actually buy you?”

How is the BFD detection time calculated?

From the interval and the multiplier: bfd interval 150 min_rx 150 multiplier 3 gives 450 ms, sub-second. BFD must be configured on both peers to form a session. Read it in “Two commands, and both are needed”

How do routing protocols use BFD?

Each registers with BFD for every neighbour, with its own command: ip ospf bfd for OSPF, bfd interface for EIGRP, isis bfd for IS-IS, and neighbor address fall-over bfd for BGP. BFD detects, the protocol reacts, and several protocols can share one session. Read it in “Nobody owns it”

The timer you were about to lower

Traffic moves too late. A link fails and it takes 40 s before OSPF moves traffic to the backup path: long enough for voice to drop, and for somebody to say so.

So your hand goes to the hello timer. Lower it, the protocol notices sooner, problem solved. What noticed this failure, and after how long?

This course's reading: what noticed the failure, and after how long

protocol  neighbor   noticed by            after
OSPF      R2         its own timer         40 s
eBGP      R2         its own timer         180 s
eBGP      PARTNER    its own timer         180 s

Look at the middle column. Nothing on this device is watching that link. What noticed is a protocol that stopped hearing hellos, which is a side effect of a mechanism built for something else. The OSPF and eBGP timer values on this page are this course's illustration.

How much does that actually buy you?

Commit to an answer before reading on.

Although reducing the EIGRP, IS-IS, and OSPF timers can result in minimum detection timer of one to two seconds, BFD can provide failure detection in less than one second.

One to two seconds is the floor, not the target: the best a routing protocol's timers give after being pushed as far as they go.

This course's reading: the protocol timers, after lowering the OSPF hello

protocol  neighbor   hello    dead/hold  at the floor?
OSPF      R2         250 ms   1 s        yes
eBGP      R2         60 s     180 s      no
eBGP      PARTNER    60 s     180 s      no

the floor the guide states: 1 s to 2 s

And notice what the instinct is asking for. It asks a protocol to shout more often in case somebody stopped listening. There is a better answer, and it is not a smaller number.

The protocol was doing two jobs

A routing protocol's hello answers two different questions: is this neighbor still alive, and what does the topology look like? Liveness wants small, frequent messages; topology exchange does not want to run every few milliseconds. One timer serving both cannot get fast at the first without costing the second.

BFD is a detection protocol that is designed to provide fast forwarding path failure detection times for all media types, encapsulations, topologies, and routing protocols. BFD provides a low-overhead, short-duration method of detecting failures in the forwarding path between two adjacent devices.

One job, done by something built for it. And the guide gives a reason it is cheaper than a shouting protocol:

Because some parts of BFD can be distributed to the data plane, it can be less CPU-intensive than the reduced EIGRP, IS-IS, and OSPF timers, which exist wholly at the control plane.

How much cheaper? The guide says can be less CPU-intensive and prints no figure, so neither does this page.

Two commands, and both are needed

First, the interface command, at both ends. The guide's syntax:

The syntax, as the guide gives it

bfd interval milliseconds min_rx milliseconds multiplier interval-multiplier
Therefore, in order to create a BFD session, you must configure BFD on both systems (or BFD peers).

R1, on the interface to R2: this course's own values. R2 gets the same line on its end of the link.

R1# configure terminal
R1(config)# interface GigabitEthernet1/0/1
R1(config-if)# bfd interval 150 min_rx 150 multiplier 3
R1(config-if)# end

What does the multiplier count? The guide's template procedure says it

specifies the number of consecutive BFD control packets that must be missed before BFD declares that a peer is unavailable.

So 150 ms and a multiplier of 3 gives 450 ms, which is this course's arithmetic for the detection time, and sub-second.

And what should the values be on a real link? The guide does not recommend any. Its procedures use examples (bfd interval 100 min_rx 100 multiplier 3 in one, 500, 500 and 5 in another) and prints no guidance. It does give one constraint: If hardware-offloaded BFD sessions are configured with Tx and Rx intervals that are not multiples of 50 ms, the hardware intervals are changed. The 150 ms here is a multiple of 50.

Is the session up?

R1# show bfd neighbors
OurAddr       NeighAddr
     LD/RD  RH/RS   Holdown(mult)  State     Int
10.0.12.1     10.0.12.2
    1/6    Up        0    (3 )   Up        Gi1/0/1
! Proves a BFD session with that neighbor is up, on that interface. Does not prove which protocols registered: the details form prints that, as the guide's sample shows. The discriminators are this page's own values.

Up, on Gi1/0/1. The layout is the IOS XE 17.x IP Routing guide's echo-mode sample; the Catalyst 9300 17.9 guide prints no sample for this command. Echo mode is on by default, which is why that is the layout drawn.

Now fail the link again. What notices it this time?

This course's reading: what noticed the failure, and after how long

protocol  neighbor   noticed by            after
OSPF      R2         its own timer         1 s
eBGP      R2         its own timer         180 s
eBGP      PARTNER    its own timer         180 s

Nothing changed. The session is there, and no protocol registered with it. Every command typed so far is present and correct, and traffic moves as late as it did.

BFD is a forwarding path failure detection protocol. BFD detects a failure, but the routing protocol must act to bypass a failed peer.

Nobody owns it

Because BFD is not tied to any particular routing protocol, it can be used as a generic and consistent failure detection mechanism for EIGRP, IS-IS, and OSPF. A routing protocol must register with BFD for every neighbor it acquires.

BFD detects, the protocol reacts. The second command registers a protocol, and it is different for every protocol:

This course's reading: which protocols registered, and with which command

protocol  registered  the command that does it
OSPF      yes         ip ospf bfd
EIGRP     -           bfd interface type number
IS-IS     -           isis bfd
eBGP      no          neighbor ip-address fall-over bfd

a dash means that protocol does not run here

Read the eBGP one aloud. neighbor ip-address fall-over bfd: when BFD says this is down, fall the session over. The client relationship is in the command name.

With OSPF registered, what notices a failure of this link?

This course's reading: what would notice a failure of the link now, and after how long

protocol  neighbor   noticed by            after
OSPF      R2         BFD                   450 ms
eBGP      R2         its own timer         180 s
eBGP      PARTNER    its own timer         180 s

OSPF would hear in 450 ms, and nothing about its own timers changed. They did not need to: it is not the thing detecting any more.

On broadcast interfaces, OSPF establishes a BFD session only with the designated router (DR) and backup designated router (BDR).

With two OSPF routers on the link, one is the DR and the other the BDR unless a priority of 0 keeps one out, so the session forms. On a segment with more routers, two DROTHERs do not get one with each other.

One session, several subscribers

There is an eBGP peering to R2 across the same link. Register it too, and there is still one session.

Devices use one BFD session for multiple client protocols in the implementation.

This course's reading: which protocols registered, and with which command

protocol  registered  the command that does it
OSPF      yes         ip ospf bfd
EIGRP     -           bfd interface type number
IS-IS     -           isis bfd
eBGP      yes         neighbor ip-address fall-over bfd

a dash means that protocol does not run here

One detector, two subscribers. Both protocols hear about the same failure at the same moment, from the session that belongs to neither.

Starting with Cisco IOS XE Denali 16.3.1, the number of BFD sessions that can be created has been increased to 100.