Hello, today I want to share something about BFD with you.
1 Introduction
BFD: Bidirectional Forwarding Detection. Its purpose is to provide a unified network-wide detection mechanism for fast detection and monitoring the forwarding connectivity of links or IP routes in a network. At the same time, its function is to improve network performance, to detect communication failure quickly between adjacent systems, and to set up a standby channel to resume communication more quickly.
2 How BFD works
2.1 Set up a session
2.1.1 Static Session
BFD detection sessions are established on both sides, and BFD detection packages like "hello" packages are sent to each other. Different BFD sessions are distinguished by local identifiers and remote identifiers in the BFD control message.The specific steps are:
(1) --- Open BFD session
(2) --- Create BFD Session Name
(3) --- Specify the address of the detection source
(4) --- Specify local and remote BFD session identifiers
(5)--- Activate/Download BFD Sessions
2.1.2 Dynamic Sessions
Dynamic BFD linkage is triggered by a variety of routing protocols (such as RIP, OSPF). The local identifier and remote identifier are processed as follows when a BFD session is established.
(1) - Dynamic allocation of local identifiers;
(2) - Dynamic learning of remote identifiers.
1--- Open BFD session
2--- Open BFD linkage with application protocol (automatic creation of BFD sessions, source purpose of BFD sessions, dynamic downloading of local identifiers, dynamic learning of peer-to-peer identifiers)
2.2 Inspection Method
(1) Asynchronous mode: BFD control packages are sent periodically between systems. If no BFD control packages are received from the peers within a certain system detection time, the session down is judged and the linkage application is informed to perform the corresponding policy actions.
(2) Query mode: Each system has a separate method to confirm the system to which it is connected. Once a session is established, the system stops sending control messages. It will announce the session as down only if it needs to verify the connectivity visually, send a short series of control packages, and receive no returned messages within the detection time.
2.3 Session state: Down, Init; Up; AdminDown
2.3.1 Down:
Start a local BFD session with an initial state of Down; Send BFD message with Down status
2.3.2 Init:
Init to the neighbor after receiving a BFD message with the neighbor state of Down; Send BFD message with Init status
2.3.3 Up:
Up to neighbor after receiving BFD message with neighbor state of Init; The local-to-neighbor session is established.
2.3.4 AdminDown:
(1) When a fault is detected, the first perception is that a BFD message with AdminDown status will be sent from the fault end;
(2) When the peer receives this message, the BFD message will be downloaded, and the BFD session will be closed to inform the connected upper application of the execution action.
(3) When the source receives a BFD message with the state of Down on the other end, it closes the BFD session on the other end and informs the connected upper application of the execution action.

