Genie's Tech Blog

Where knowledge has no dimensions

BFD : Concept

Introduction

In both Enterprise and Service Provider networks, the convergence of business-critical applications onto a common IP infrastructure is becoming more common. Given the criticality of the data, these networks are typically constructed with a high degree of redundancy. While such redundancy is desirable, its effectiveness is dependent upon the ability of individual network devices to quickly detect failures and reroute traffic to an alternate path.

This detection is now typically accomplished via hardware detection mechanisms. However, the signals from these mechanisms are not always conveyed directly to the upper protocol layers. When the hardware mechanisms do not exist (eg: Ethernet) or when the signaling does not reach the upper protocol layers, the protocols must rely on their much slower strategies to detect failures. The detection times in existing protocols are typically equal to or greater than one second, and sometimes much longer.

BFD Overview

BFD is a simple Hello protocol which in many aspects is similar to teh detection components of well-known routing protocols. It is a UDP based layer-3 protocol that provides very fast routing protocol independent detection of Layer-3 next-hop failures. A pair of systems transmits BFD packets periodically over each path between the two systems and if a system stops receiving BFD packets for long enough, some component in that particular bidirectional path to the neighboring system is assumed to be failed. BFD runs on top of the data-link protocol that is in use between two adjacent systems. BFD has two version 0 and version 1.

 

BFD Version 0 Control Packet

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Vers  |     Diag   |H|D|P|F|RESD| Detect Mult    |  Length             |      |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

|                                  My Descriminator                                          |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

|                                 Your Descriminator                                        |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

|                              Desired Min TX Interval                                     |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

|                              Desired Min RX Interval                                     |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

|                           Reqd. Min Echo RX Interval                                   |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

  

BFD Version 1 Control Packet

 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Vers  |     Diag   | Sta|P|F|C|A|D|M |  Detect Mult    |  Length             |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

|                                  My Descriminator                                          |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

|                                 Your Descriminator                                        |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

|                              Desired Min TX Interval                                     |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

|                              Desired Min RX Interval                                     |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

|                           Reqd. Min Echo RX Interval                                   |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

 

BFD Modes

BFD has two operating modes that may be selected, as well as an additional function that can be used in combination with the two modes.

The primary mode is the Asynchronous mode. In this mode, the systems periodically send BFD control packets to one another, and if a number of those packets in a row are not received by the other systeam, the session is declared to be down.

The second one is known as the Demand mode. In this mode, it is assumed that a system has an independent way of verifying that it has connectivity to the other system. Once a BFD session is established, such a system may ask the other system to stop sending BFD Control packets, except when the system feels the need to verify connectivity explicitly, in which case a short sequence of BFD Control packets is exchanged and then the far system quiesces. Demand mode may operate independently in each direction or simultaneously.

The Echo Function

An adjunct to both modes is the Echo function. When the Echo function is active, a stream of BFD Echo packets is transmitted in such a way as to have the other system loop them back through its forwarding path. If a number of packets of the echoed data stream are not received, the session is declared to be down. The Echo function may be used with either Asynchronous or Demand mode.

BFD Async packets are transmitted over UDP with source port as 49152 and destination port as 3784. the source address of the IP packet is the local interface address and the destination is the remote interface address. Certain failures not related to forwarding path can cause the async mode to fail. For example, if the UDP stack of the remote system fails for long enough, BFD session will go down.

The Echo mode is designed to test only the forwarding path and not the host stack. BFD echo packets are transmitted over UDP with source and destination ports as 3785. The source address of the BFD Echo packet is the router Id and the destination address is the local interface address.

 The BFD session parameters are negotiated between the BFD peers in a three-way handshake. Each Peer communicates its session state in the State (Sta) field in the BFD Control packet, and that received state, in combination with the local session state, drives the state machine. When the local peer wants to bring the session up, it sends a control packet with Init state. When this peer receives a BFD Control packet from the remote system with an Init state, it will bring the session up. The BFD peers continuously negotiate their desired transmit and receive rates. The peer that reports the slower rate determines the transmission rate. 

In a BFD session, each system calculates its session down detection time independently. In each direction, this calculation is based on the value of Detect Mult received from the remote system and the negotiated transmit interval

Negotiated Transmit Interval = max (required minimum received interval, the last received desired minimum transmit interval)

Detection Time = Detect Mult x Negotiated Transmit Interval.

If the Detection Time is passed without receiving a control packet, the session is declared to be down.

Sample BFD Configuration

 

Router1(config)#interface Ethernet 0/0

Router1(config-if)#isis bfd
Router1(config-if)#bfd interval 50 min_rx 50 multiplier 3

Router1# show bfd neighbors detail



IPv4 Sessions
NeighAddr                              LD/RD         RH/RS     State     Int
10.20.30.2                              1/1              Up          Up      Et1/0
Session state is UP and using echo function with 50 ms interval.
Session Host: Software
OurAddr: 10.20.30.1     
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(183992)
Rx Count: 184026, Rx Interval (ms) min/max/avg: 1/1522/879 last: 860 ms ago
Tx Count: 184000, Tx Interval (ms) min/max/avg: 1/1292/882 last: 692 ms ago
Elapsed time watermarks: 0 0 (last: 0)
Registered protocols: ISIS CEF
Uptime: 1d20h
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: 50000

Comments (3) -

  • Vinit Jain

    6/1/2012 5:52:06 PM |

    Good One..
    Just a quick note.. IOX-XR supports as low as 15 ms as the Echo interval where as the minimum for IOS is 50 ms.

  • @realmandydee

    2/13/2014 3:32:55 PM |

    Would you permit me to post this on twitter?

  • Genie

    2/13/2014 5:06:46 PM |

    Hi
    You can post the link on twitter but not the blog post.

Comments are closed