BFD is a protocol that is used in the networks to quickly detect link failures and hence enhance the speed of convergence of the routing protocols. Different routing protocols have different mechanisms to detect link failures for e.g. OSPF uses hello packets and dead interval while the EIGRP uses hello packets and hold down timers.
Though the time of convergence for OSPF and EIGRP and other protocols is fast but still some real time applications such as VOIP may face issues and require a much faster speed of convergence of the networks. We can fine tune the hello and dead/hold timers to increase convergence speed but that isn’t recommended in the networks though.
BFD can run independent of any other protocol however the other protocols i.e. OSPF,EIGRP,BGP,HSRP etc. can use BFD for link failure detection instead of using their own mechanism. Whenever a link failure occurs BFD will notify the routing protocol that link loss has occurred and the protocol using it will tear town the neighbor relation immediately and start the process to re-converge.
The BFD operates in two modes Asynchronous mode and Demand mode.
In Asynchronous mode BFD will keep sending the hello packets and if some hello packets are not received the session is torn down.The Demand mode is different, once BFD has found a neighbour it won’t continuously send control packets but only uses a polling mechanism. Another method has to be used to check reachability, for example it could check receive and transmit statistics of the interface. Right now Cisco (or any other vendor I know of) doesn’t support BFD demand mode.
Let us have a look at an example where we use OSPF between two routers with and without BFD.
OSPF will run between the two routers.
We will then shut the port Fa0/0 on R1 and see R1 immediately breaks OSPF neighborship as it detects the directly connected link down.
R2 however takes time to break the OSPF neighborship till the dead timer expires.
We see below R1 and R2 are OSPF neighbors
Neighbor ID Pri State Dead Time Address Interface
126.96.36.199 1 FULL/DR 00:00:36 188.8.131.52 FastEthernet0/0
Now let’s shut down the port Fa0/0 on R1 and notice how much time R2 takes to break neighborship.
As seen below R1 immediately breaks OSPF adjacency
*May 15 15:02:39.299: %OSPF-5-ADJCHG: Process 1, Nbr 184.108.40.206 on FastEthernet0/0 from FULL to DOWN, Neighbor Down: Interface down or detached
*May 15 15:02:41.271: %LINK-5-CHANGED: Interface FastEthernet0/0, changed state to administratively down
*May 15 15:02:42.271: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to down
*May 15 15:02:55.327: %OSPF-5-ADJCHG: Process 1, Nbr 220.127.116.11 on FastEthernet0/0 from FULL to DOWN, Neighbor Down: Dead timer expired
R2 took approx. 15 seconds to break the OSPF neighborship:
We enable BFD.
We use BFD with OSPF and then again shut Fa0/0 on R1 to break the OSPF nieghborship and check on R2 how much time it takes to break OSPF neighborship.
Enabling BFD on R1 and R2:
R1(config-if)#bfd interval 50 min_rx 50 multiplier 3
R2(config-if)#bfd interval 50 min_rx 50 multiplier 3
- BFD interval is the time in milliseconds after which BFD packet is sent.
- The second value to configure is the minimum receive interval. This is how often we expect to receive a BFD packet from our neighbor.
- The last value to configure is for the hold-down.
Now BFD is configured lets configure OSPF to use the same.
R2(config)#router ospf 1
Now when we shut the Fa0/0 port on R1 we see both R1 and R2 break OSPF adjacency immediately
*May 15 15:20:41.271: %LINK-5-CHANGED: Interface FastEthernet0/0, changed state to administratively down
*May 15 15:20:42.271: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to down
*May 15 15:20:43.055: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.12.1 on FastEthernet0/0 from FULL to DOWN, Neighbor Down: BFD node down