BFD Support on LAG Interface
Overview
The Bidirectional Forwarding Detection (BFD) protocol detects faults in the bidirectional path between two forwarding routers, including interfaces, data links, and beyond. It provides the fastest detection of communication failures on any data links, and the protocol runs over any media and at any protocol layer.
Establish a BFD session using  the Link Aggregation Group (LAG) members to identify faults in the bidirectional pathway between two forwarding engines, including interfaces. A single micro-BFD session operates on each member link of the LAG for every enabled address family; that is, each session established  for every LAG member link under LAG. The micro-BFD sessions on the member links are individual BFD sessions and operate independently. They use their own distinct local discriminator values, maintain separate sets of state variables, and operate with independent state machines. If a micro-BFD session goes down, the corresponding member link MUST be removed from the LAG load-balancing table.
Single Hop BFD Option Over LAG
To interop with old/legacy routers, where micro-bfd support is not available, and to run regular Single HOP BFD sessions over LAG, a new CLI “bfd session software” is being introduced. This software is operated by the control plane, which means the BFD packet TX/RX and the state machine run in the control plane. This session uses a unique discriminator for the whole LAG (not per member interface). BFD Single HOP packets are sent on each member links of LAG on a round-robin basis.
Note:	 
•	When setting up the session with LAG using the "bfd session software" command, the session type will be single-hop. 
•	When setting up the session with LAG without using the command  "bfd session software" command, the session type will Micro- BFD. 
Feature Characteristics
BFD is used to control the load-balancing, this protocol minimizes the need for additional MAC addresses, thereby decreasing the resources needed on the Ethernet hardware of the receiving member link. Standard L3 protocols such as OSPF lack visibility into the LAG and perceive it as a single larger interface.
Benefits
BFD offers an efficient way to detect failures in the forwarding path between adjacent routers with low overhead. This encompasses identifying failures in interfaces, data links, and forwarding planes. Enable BFD at the routing protocol level. The BFD protocol identifies faults in the bidirectional path between two forwarding interfaces, encompassing interfaces and data link(s).
Prerequisites
LAG configurations must consist of a minimum of two ports:
•	All ports within the LAG must inherit the port characteristics from the primary port.
•	For ports within an LAG to ensure a specific port speed, auto-negotiation must be disabled or set to a limited mode.
Additionally, ports in a LAG must be configured for entire duplex operation.
Configuration
 The following configuration enables the BFD support on LAG interfaces.
Note:	The following configurations are applicable to protocols such as OSPF, BGP, and IS-IS, ensuring immediate notification in the event of session failure. 
Topology
The following topology illustrates BFD support on the LAG interface configured between R1, R2, and R3.
BFD support on LAG interface 
Perform the following steps to configure the BFD on the LAG interface.
1.	Configure the R1 interface with the IP address and with BFD interface.
R1#configure terminal
R1(config)#int po1
R1(config-if)#ip address 10.1.1.2/24
R1(config)#commit
R1(config)#interface eth1
R1(config-if)#channel-group 1 mode active
R1(config)#commit
R1#configure terminal
R1(config-if)#bfd session 10.1.1.2 10.1.1.1
      R1(config-if)#bfd session ?
A.B.C.D   Source IPv4 address
X:X::X:X  Source IPv6 address
hardware  BFD Session offloaded to Forwarding Plane
software  BFD Session running at Control Plane (Host CPU)
R1(config-if)#bfd session software
      R1(config)#commit
2.	Configure the R2 interface with the IP address and with BFD interface.
R2#configure terminal
R2(config)#int po1
R2(config-if)#ip address 10.1.1.1/24
R2(config)#commit
R2(config)#interface eth1
R2(config-if)#channel-group 1 mode active
R2(config)#commit
R2#configure terminal
      R2(config-if)#bfd session 10.1.1.1 10.1.1.2
      R2(config-if)#bfd session ?
A.B.C.D   Source IPv4 address
X:X::X:X  Source IPv6 address
hardware  BFD Session offloaded to Forwarding Plane
software  BFD Session running at Control Plane (Host CPU)
      R2(config-if)#bfd session software
      R2(config)#commit
Validation
R1
The following show output displays the BFD support on LAG interface.
OcNOS#show bfd session
 
BFD process for VRF: (DEFAULT VRF)
============================================================================== 
Sess-Idx   Remote-Disc  Lower-Layer  Sess-Type   Sess-State  UP-Time   Interface      Down-Reason  Remote-Addr
257        1002         IPv4         Single-Hop  Up          00:05:49  po1            NA           10.1.1.2/32             
 
Number of Sessions:    1 
OcNOS#show bfd session detail
 
BFD process for VRF: (DEFAULT VRF)
============================================================================== 
 
Session Interface Index : 100001         Interface name :po1
Session Index : 257
Lower Layer : IPv4                       Version : 1
Session Type : Single Hop                Session State : Up
Local Discriminator : 1002               Local Address : 10.1.1.1/32
Remote Discriminator : 1002              Remote Address : 10.1.1.2/32
Local Port : 49156                       Remote Port : 3784
Options :
 
Diagnostics : None
 
Timers in Milliseconds :
Min Tx: 250               Min Rx: 250               Multiplier: 3
Neg Tx: 250               Neg Rx: 250               Neg detect mult: 3
Min echo Tx: 1000         Min echo Rx: 1000         Neg echo intrvl: 0
Storage type : 2
Sess down time : 00:00:00
Sess Down Reason : NA
Bfd GTSM Disabled
Bfd Authentication Disabled
 
Counters values:
Pkt In : 00000000000000001255              Pkt Out : 00000000000000001291
Echo Out : 00000000000000000000            IPv6 Echo Out : 00000000000000000000
IPv6 Pkt In : 00000000000000000000         IPv6 Pkt Out : 00000000000000000000
UP Count : 2                               UPTIME : 00:04:39
 
Protocol Client Info:
BFD-> Client ID: 28      Flags: 4
----------------------------------------------------------
 
Number of Sessions:    1
R2
The following show output displays the BFD support on LAG interface.
 OcNOS#show bfd session
 
BFD process for VRF: (DEFAULT VRF)
============================================================================== 
Sess-Idx   Remote-Disc  Lower-Layer  Sess-Type   Sess-State  UP-Time   Interface      Down-Reason  Remote-Addr
8196       1002         IPv4         Single-Hop  Up          00:09:50  po1            NA           10.1.1.1/32   
 
Number of Sessions:    1
OcNOS#show bfd session detail
 
BFD process for VRF: (DEFAULT VRF)
============================================================================== 
Session Interface Index : 100001         Interface name :po1
Session Index : 8196
Lower Layer : IPv4                       Version : 1
Session Type : Single Hop                Session State : Up
Local Discriminator : 1002               Local Address : 10.1.1.2/32
Remote Discriminator : 1002              Remote Address : 10.1.1.1/32
Local Port : 49155                       Remote Port : 3784
Options :
 
Diagnostics : None
 
Timers in Milliseconds :
Min Tx: 250               Min Rx: 250               Multiplier: 3
Neg Tx: 250               Neg Rx: 250               Neg detect mult: 3
Min echo Tx: 1000         Min echo Rx: 1000         Neg echo intrvl: 0
Storage type : 2
Sess down time : 00:00:00
Sess Down Reason : NA
Bfd GTSM Disabled
Bfd Authentication Disabled
 
Counters values:
Pkt In : n/a                               Pkt Out : n/a
Echo Out : 00000000000000000000            IPv6 Echo Out : 00000000000000000000
IPv6 Pkt In : 00000000000000000000         IPv6 Pkt Out : 00000000000000000000
UP Count : 2                               UPTIME : 00:10:11
 
Protocol Client Info:
BFD-> Client ID: 28      Flags: 4
----------------------------------------------------------
 
Number of Sessions:    1
New CLI Commands
bfd session software
Use this command to create a BFD session operated by control plane (This implies that the BFD TX or RX will be operated in the control plane).
Note:	The scaling number of BFD sessions depends on the CPU performance of the target device since a Single Hop BFD session over LAG is handled in the control plane. Therefore, it is recommended to limit the number of sessions to a maximum of 8, with a minimum BFD interval of 100ms (Default BFD interval is 250ms). The lowest configurable interval for a software-based BFD session is 50ms.
Command Syntax
bfd session software
Parameters
Not applicable
Command Mode
Interface mode
Applicability
This command was introduced before OcNOS version 6.5.1.
Example
#configure terminal
(config)#interface eth1
(config-if)#bfd session software
(config-if)#
Glossary
| Key Terms/Acronym  | Description | 
| BFD | Bidirectional Forwarding Detection | 
| LAG | Link Aggregation Group | 
| OSPF | Open Shortest Path First | 
| MAC | Media Access Control Address. |