BFD (Bidirectional Forwarding Detection):
Bidirectional Forwarding Detection (BFD) is a lightweight network protocol designed to detect link failures rapidly between two forwarding engines (e.g., routers or switches). BFD operates independently of media, routing protocols, and data plane, enabling sub-second failure detection. In this document, we explore BFD configuration and validation on SONiC switches integrated with BGP.
Tested model & firmware version:
Switch model name:
Accton-AS5712-54X
Community sonic version:
202211.2
TOPOLOGY:
Configuration commands (sonic configurations)
Note: Commands are to be executed in sudo and vtysh mode.
Step1: Configure the IP address and Loopback address as per topology. Refer to ip interface configuration.
Step2: Configure the EBGP and add the BFD in EBGP neighbor.
R1:
root@sonic:/home/admin# vtysh
sonic.PALCNETWORKS.COM# configure terminal
sonic.PALCNETWORKS.COM(config)# router bgp 100
sonic.PALCNETWORKS.COM(config-router)# neighbor 20.1.1.2 remote-as 200
sonic.PALCNETWORKS.COM(config-router)# neighbor 20.1.1.2 bfd
sonic.PALCNETWORKS.COM(config-router)# network 1.1.1.1/32
sonic.PALCNETWORKS.COM(config-router)# network 20.1.1.0/24
R2:
root@sonic:/home/admin# vtysh
sonic.PALCNETWORKS.COM# configure terminal
sonic.PALCNETWORKS.COM(config)# router bgp 200
sonic.PALCNETWORKS.COM(config-router)# neighbor 20.1.1.1 remote-as 100
sonic.PALCNETWORKS.COM(config-router)# neighbor 20.1.1.1 bfd
sonic.PALCNETWORKS.COM(config-router)# network 2.2.2.2/32
sonic.PALCNETWORKS.COM(config-router)# network 20.1.1.0/24
Step3: Configure the time interval for BFD in all interfaces.
R1:
sonic.PALCNETWORKS.COM(config)# bfd
sonic.PALCNETWORKS.COM(config-bfd)# peer 20.1.1.2
sonic.PALCNETWORKS.COM(config-bfd-peer)# detect-multiplier 3
sonic.PALCNETWORKS.COM(config-bfd-peer)# receive-interval 100
sonic.PALCNETWORKS.COM(config-bfd-peer)# transmit-interval 100
R2:
sonic.PALCNETWORKS.COM(config)# bfd
sonic.PALCNETWORKS.COM(config-bfd)# peer 20.1.1.1
sonic.PALCNETWORKS.COM(config-bfd-peer)# detect-multiplier 3
sonic.PALCNETWORKS.COM(config-bfd-peer)# receive-interval 100
sonic.PALCNETWORKS.COM(config-bfd-peer)# transmit-interval 100
Step4: Check the BFD Configuration on R1 and R2.
R1:
Sonic.PALCNETWORKS.COM# show bfd peer 20.1.1.2
BFD Peer:
peer 20.1.1.2 local-address 20.1.1.1 vrf default interface Ethernet49
ID: 1545681435
Remote ID: 2494635853
Active mode
Status: up
Uptime: 2 minute(s), 50 second(s)
Diagnostics: ok
Remote diagnostics: ok
Peer Type: configured
Local timers:
Detect-multiplier: 3
Receive interval: 200ms
Transmission interval: 200ms
Echo receive interval: 50ms
Echo transmission interval: disabled
Remote timers:
Detect-multiplier: 3
Receive interval: 100ms
Transmission interval: 100ms
Echo receive interval: 50ms
sonic.PALCNETWORKS.COM# show ip bgp summary
IPv4 Unicast Summary (VRF default):
BGP router identifier 1.1.1.1, local AS number 100 vrf-id 0
BGP table version 17
RIB entries 13, using 2392 bytes of memory
Peers 1, using 723 KiB of memory
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd PfxSnt Desc
20.1.1.2 4 200 48 59 0 0 0 00:00:02 3 7 N/A
R2:
Sonic.PALCNETWORKS.COM# show bfd peer 20.1.1.1
BFD Peer:
peer 20.1.1.1 local-address 20.1.1.2 vrf default interface Ethernet49
ID: 1545681435
Remote ID: 2494635853
Active mode
Status: up
Uptime: 1 minute(s), 15 second(s)
Diagnostics: ok
Remote diagnostics: ok
Peer Type: configured
Local timers:
Detect-multiplier: 3
Receive interval: 200ms
Transmission interval: 200ms
Echo receive interval: 50ms
Echo transmission interval: disabled
Remote timers:
Detect-multiplier: 3
Receive interval: 100ms
Transmission interval: 100ms
Echo receive interval: 50ms
sonic.PALCNETWORKS.COM# show ip bgp summary
IPv4 Unicast Summary (VRF default):
BGP router identifier 2.2.2.2, local AS number 200 vrf-id 0
BGP table version 113
RIB entries 17, using 3128 bytes of memory
Peers 1, using 723 KiB of memory
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd PfxSnt Desc
20.1.1.1 4 100 214 179 0 0 0 00:02:43 7 9 N/A
Step5: Shutdown the Ethernet49 port from R1 and check the bfd status:
R1:
sonic.PALCNETWORKS.COM# show bfd peer 20.1.1.2
BFD Peer:
peer 20.1.1.2 local-address 20.1.1.1 vrf default interface Ethernet49
ID: 1545681435
Remote ID: 2494635853
Active mode
Status: down
Uptime: 10 second(s)
Diagnostics: ok
Remote diagnostics: ok
Peer Type: configured
Local timers:
Detect-multiplier: 3
Receive interval: 200ms
Transmission interval: 200ms
Echo receive interval: 50ms
Echo transmission interval: disabled
Remote timers:
Detect-multiplier: 3
Receive interval: 100ms
Transmission interval: 100ms
Echo receive interval: 50ms
sonic.PALCNETWORKS.COM# show ip bgp summary
IPv4 Unicast Summary (VRF default):
BGP router identifier 1.1.1.1, local AS number 100 vrf-id 0
BGP table version 15
RIB entries 9, using 1656 bytes of memory
Peers 1, using 723 KiB of memory
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd PfxSnt Desc
20.1.1.2 4 200 40 46 0 0 0 00:00:15 Active 0 N/A
Total number of neighbors 1
R2:
Sonic.PALCNETWORKS.COM# show bfd peer 20.1.1.1
BFD Peer:
peer 20.1.1.1 local-address 20.1.1.2 vrf default interface Ethernet49
ID: 1545681435
Remote ID: 2494635853
Active mode
Status: down
Uptime: 20 second(s)
Diagnostics: ok
Remote diagnostics: ok
Peer Type: configured
Local timers:
Detect-multiplier: 3
Receive interval: 200ms
Transmission interval: 200ms
Echo receive interval: 50ms
Echo transmission interval: disabled
Remote timers:
Detect-multiplier: 3
Receive interval: 100ms
Transmission interval: 100ms
Echo receive interval: 50ms
sonic.PALCNETWORKS.COM# show ip bgp summary
IPv4 Unicast Summary (VRF default):
BGP router identifier 2.2.2.2, local AS number 200 vrf-id 0
BGP table version 32
RIB entries 3, using 552 bytes of memory
Peers 1, using 723 KiB of memory
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd PfxSnt Desc
20.1.1.1 4 100 56 48 0 0 0 00:01:20 Active 0 N/A
Total number of neighbors 1