BFD is a mecanism which give you access to a fast switchover for IGP, EBGP, … It is a RFC protocol : RFC5880.
BFD is a UDP protocol.
- BFD control : UDP / 3784
- BFD echo : UDP / 3785
BFD is in use on a segment, when a protocol needs it (such as : OSPF). It is configured by interface and called in protocol configuration.
When BFD detect a failure it informs upper protocols and helps to make a better / quick convergence.
You can configure BFD like :
Then you enable it on IGP configuration :
router ospf 1 network 0.0.0.0 255.255.255.255 area 0 bfd all-interfaces
BFD initialization works with a 4-state’s automate. These states are :
ADMIN-DOWN : as it says the system want to hold the session DOWN by an administrative point of view : “I want to keep this session DOWN, so calm down and shut up as long as I say!”
DOWN : says that the session has just been created, administratively or operationnaly it maintains the state to DOWN until we receive a BFD DOWN control datagram from the other side : “We are agree that the session is DOWN, we can go on and try to initialize it!”
INIT : We come from DOWN state. Both systems are communicating. Until we receive an INIT or UP, we keep in INIT and send BFD INIT datagram.
UP : Ok both sides are agreed on INIT/UP we finalize the session and go together to UP states. We are UP until we detect it fails or ADMIN DOWN state is said to me ! So at TX interval we send Control packet with UP state until we detect a problem or been administratively set to DOWN.
BFD is aware of different authentication methods such as simple passowrd, MD5, SHA1.
Timers negotiation :
Timers are continually negotiated during the session by means of sending BFD Control datagram where :
- Interval : Max rate (minimum interval), we are able to send
- Min_RX : Minimum interval we are able to compute
- Min Echo RX : Minimum interval we are able to compute for the Echo function
- Multiplier : is a normal value which is used to calculate the Dead-Timer (HoldOn, …) : number of BFD datagrams lost in a row before we say that the session is DOWN. Dead Timer is : mult x max(desired TX interval , Required RX received interval)
So each side can adjust their timers and this at any time of the session life.
To identify between multiple sessions between two systems, a discriminator (A unique ID). When we receive a BFD datagram with my discriminator, I know it is for __this session and I can compute it correctly.
Echo function :
This function is a way to detect and transmit packets/test forwarding plane : We send BFD echo packet with :
- IP SRC = Me
- IP DST = Me !
- UDP / 3785
- BFD information to demultiplex the session involved.
We can use Echo function only when BFD Control session is UP. After this, we can slow down sending BFD Control packet and only base failure detection by means of Echo function. We detect failure by using number of failure on a row as BFD Control Packets.
We can use BFD without this function only with BFD Control.
R1 (conf-if)# no bfd echo
Lab test :
You can find a cloudshark pcap trace here : https://www.cloudshark.org/captures/94617b9dc969
It consists of an BFD session initialization (you can find in the pcap by adding the filter : ‘bfd’). Then an outage has been produced by removing vlan on SW1 on the trunk (frame 249 : “Diag : Echo function failed”). And then allow it again on the trunk to reform the BFD session).
R1#show bfd neighbors details IPv4 Sessions NeighAddr LD/RD RH/RS State Int 184.108.40.206 1/1 Up Up Et0/1.13 Session state is UP and using echo function with 500 ms interval. Session Host: Software OurAddr: 220.127.116.11 Handle: 1 Local Diag: 0, Demand mode: 0, Poll bit: 0 MinTxInt: 1000000, MinRxInt: 1000000, Multiplier: 3 Received MinRxInt: 1000000, Received Multiplier: 3 Holddown (hits): 0(0), Hello (hits): 1000(30) Rx Count: 31, Rx Interval (ms) min/max/avg: 1/1000/857 last: 681 ms ago Tx Count: 32, Tx Interval (ms) min/max/avg: 1/999/840 last: 363 ms ago Elapsed time watermarks: 0 0 (last: 0) Registered protocols: OSPF Uptime: 00:00:26 Last packet: Version: 1 - Diagnostic: 0 State bit: Up - Demand bit: 0 Poll bit: 0 - Final bit: 0 C bit: 0 Multiplier: 3 - Length: 24 My Discr.: 1 - Your Discr.: 1 Min tx interval: 1000000 - Min rx interval: 1000000 Min Echo interval: 500000 R1#
Or on ASR9K or CRS plateform :
show bfd session
Hope this help,
1 comment on “BFD : Bidirectional Forwarding Detection (RFC5880)”