BFD - Bidirectional Forwarding Detection
BFD - Bidirectional Forwarding Detection
Overview
BFD (Bidirectional Forwarding Detection) is a protocol designed for fast detection of failures in the forwarding paths between two routers or switches. BFD provides a unified failure detection mechanism for any network protocols and topologies.
Key characteristics
- RFC standards: RFC 5880 (core protocol), RFC 5881 (for IPv4/IPv6), RFC 5883 (multihop)
- Fast detection: sub-second failure detection (down to 50 ms)
- Protocol independence: works with BGP, OSPF, IS-IS, and static routes
- Low overhead: uses small UDP packets
- Scalability: can monitor thousands of sessions simultaneously
How it works
BFD establishes a session between two neighbors and periodically exchanges small control packets. If the neighboring device does not respond within a specified time (determined by the transmit interval and the multiplier), the session is declared down, and routing protocols can react quickly to the topology change.
Benefits of BFD
- Fast failure detection: significantly faster than the built-in mechanisms of routing protocols
- Reduced load: routing protocols no longer require frequent hello messages
- Universality: a single mechanism for all routing protocols
- Flexibility: configurable intervals and multipliers for different scenarios
- Support for various topologies: single-hop and multi-hop modes
BFD operating modes
Asynchronous Mode
The standard operating mode in which both nodes periodically send control packets. This is the primary mode used in most deployments.
Demand Mode
After the session is established, the nodes stop sending periodic packets. It is rarely used and is not supported in most implementations.
Echo Mode
A node sends BFD packets back to itself through the remote system. This makes it possible to detect forwarding path failures without loading the CPU of the remote system.
Basic configuration
Configuring a BFD peer
The basic BFD peer configuration includes defining the neighbor and the monitoring parameters:
# Basic BFD peer configuration
set protocols bfd peer 192.168.1.1
# Interval settings
set protocols bfd peer 192.168.1.1 interval transmit 300
set protocols bfd peer 192.168.1.1 interval receive 300
# Multiplier setting
set protocols bfd peer 192.168.1.1 multiplier 3
# Bind to an interface (for single-hop)
set protocols bfd peer 192.168.1.1 source interface eth0
# Save the configuration
commit
saveTimer parameters
Transmit Interval
The minimum interval between transmissions of BFD control packets.
# Range: 10-60000 ms
# Default: 300 ms
set protocols bfd peer 192.168.1.1 interval transmit 300Receive Interval
The minimum interval at which the local system is able to receive BFD control packets.
# Range: 10-60000 ms
# Default: 300 ms
set protocols bfd peer 192.168.1.1 interval receive 300Multiplier
The number of missed packets before the session is declared down.
# Range: 2-255
# Default: 3
set protocols bfd peer 192.168.1.1 multiplier 3Failure detection time = Receive Interval × Multiplier
Example: 300 ms × 3 = 900 ms (0.9 seconds)
Echo Mode
Echo mode lets a node send packets back to itself through the neighbor to verify the forwarding path:
# Enable echo mode
set protocols bfd peer 192.168.1.1 echo-mode
# Configure the echo interval
set protocols bfd peer 192.168.1.1 interval echo-interval 500
# Echo interval range: 10-60000 msMulti-hop BFD
Multi-hop BFD is used to monitor paths that span several hops (for example, for eBGP neighbors):
# Configure multi-hop BFD
set protocols bfd peer 10.0.0.1 multihop
# Specify the source address
set protocols bfd peer 10.0.0.1 source address 10.0.0.2
# Configure the minimum TTL (optional)
set protocols bfd peer 10.0.0.1 minimum-ttl 254
# Configure the intervals
set protocols bfd peer 10.0.0.1 interval transmit 1000
set protocols bfd peer 10.0.0.1 interval receive 1000
set protocols bfd peer 10.0.0.1 multiplier 3BFD profiles
Profiles let you create reusable BFD configuration templates:
# Create a profile
set protocols bfd profile FAST-FAILOVER interval transmit 100
set protocols bfd profile FAST-FAILOVER interval receive 100
set protocols bfd profile FAST-FAILOVER multiplier 3
# Create a conservative profile
set protocols bfd profile SLOW-LINK interval transmit 1000
set protocols bfd profile SLOW-LINK interval receive 1000
set protocols bfd profile SLOW-LINK multiplier 5
# Apply the profile to a peer
set protocols bfd peer 192.168.1.1 profile FAST-FAILOVERDisabling a BFD peer
# Administratively disable a peer
set protocols bfd peer 192.168.1.1 shutdown
# Remove a peer
delete protocols bfd peer 192.168.1.1Integration with routing protocols
BFD with BGP
BFD significantly speeds up the detection of BGP session failures, reducing convergence time from minutes to seconds or milliseconds.
Configuration for IPv4 BGP
# Configure the BFD peer
set protocols bfd peer 192.168.1.1 interval transmit 300
set protocols bfd peer 192.168.1.1 interval receive 300
set protocols bfd peer 192.168.1.1 multiplier 3
# Enable BFD for the BGP neighbor
set protocols bgp neighbor 192.168.1.1 bfd
# Optional: assign a BFD profile for BGP
set protocols bgp neighbor 192.168.1.1 bfd profile FAST-FAILOVER
# Complete BGP configuration with BFD
set protocols bgp system-as 65001
set protocols bgp neighbor 192.168.1.1 remote-as 65002
set protocols bgp neighbor 192.168.1.1 address-family ipv4-unicast
set protocols bgp neighbor 192.168.1.1 bfdConfiguration for IPv6 BGP
# Configure the BFD peer for IPv6
set protocols bfd peer 2001:db8::1 interval transmit 300
set protocols bfd peer 2001:db8::1 interval receive 300
set protocols bfd peer 2001:db8::1 multiplier 3
# Enable BFD for the IPv6 BGP neighbor
set protocols bgp neighbor 2001:db8::1 bfd
set protocols bgp neighbor 2001:db8::1 address-family ipv6-unicastMulti-hop BGP with BFD
# Configure multi-hop BFD for eBGP
set protocols bfd peer 10.0.0.1 multihop
set protocols bfd peer 10.0.0.1 source address 10.0.0.2
set protocols bfd peer 10.0.0.1 interval transmit 500
set protocols bfd peer 10.0.0.1 interval receive 500
set protocols bfd peer 10.0.0.1 multiplier 3
# Configure eBGP with multi-hop
set protocols bgp neighbor 10.0.0.1 ebgp-multihop 2
set protocols bgp neighbor 10.0.0.1 bfd
set protocols bgp neighbor 10.0.0.1 remote-as 65002BGP peer groups with BFD
# Create a peer group with BFD
set protocols bgp peer-group ISP bfd
set protocols bgp peer-group ISP remote-as 65000
set protocols bgp peer-group ISP address-family ipv4-unicast
# Apply the peer group to neighbors
set protocols bgp neighbor 192.168.1.1 peer-group ISP
set protocols bgp neighbor 192.168.1.2 peer-group ISP
# Configure BFD for each peer
set protocols bfd peer 192.168.1.1 interval transmit 300
set protocols bfd peer 192.168.1.1 interval receive 300
set protocols bfd peer 192.168.1.1 multiplier 3
set protocols bfd peer 192.168.1.2 interval transmit 300
set protocols bfd peer 192.168.1.2 interval receive 300
set protocols bfd peer 192.168.1.2 multiplier 3BFD with OSPF
BFD can speed up failure detection in OSPF networks, which is especially useful in time-critical applications.
OSPFv2 (IPv4)
# Enable BFD on the OSPF interface
set protocols ospf interface eth0 bfd
# Configure the BFD peer for the OSPF neighbor
set protocols bfd peer 192.168.1.1 source interface eth0
set protocols bfd peer 192.168.1.1 interval transmit 300
set protocols bfd peer 192.168.1.1 interval receive 300
set protocols bfd peer 192.168.1.1 multiplier 3
# Complete OSPF configuration with BFD
set protocols ospf area 0 network 192.168.1.0/24
set protocols ospf interface eth0 bfd
set protocols ospf parameters router-id 192.168.1.2OSPFv3 (IPv6)
# Enable BFD on the OSPFv3 interface
set protocols ospfv3 interface eth0 bfd
# Configure the BFD peer for IPv6
set protocols bfd peer fe80::1 source interface eth0
set protocols bfd peer fe80::1 interval transmit 300
set protocols bfd peer fe80::1 interval receive 300
set protocols bfd peer fe80::1 multiplier 3
# Complete OSPFv3 configuration with BFD
set protocols ospfv3 area 0.0.0.0 interface eth0
set protocols ospfv3 interface eth0 bfdBFD on all OSPF interfaces
# Enable BFD for multiple interfaces
set protocols ospf interface eth0 bfd
set protocols ospf interface eth1 bfd
set protocols ospf interface eth2 bfd
# Configure global OSPF parameters
set protocols ospf area 0 network 10.0.0.0/8
set protocols ospf passive-interface default
set protocols ospf passive-interface-exclude eth0
set protocols ospf passive-interface-exclude eth1
set protocols ospf passive-interface-exclude eth2BFD with IS-IS
IS-IS also supports integration with BFD for fast failure detection.
# Configure the IS-IS instance
set protocols isis CORE net 49.0001.1921.6800.1001.00
# Enable BFD on the IS-IS interface
set protocols isis CORE interface eth0 bfd
# Configure the BFD peer
set protocols bfd peer 192.168.1.1 source interface eth0
set protocols bfd peer 192.168.1.1 interval transmit 300
set protocols bfd peer 192.168.1.1 interval receive 300
set protocols bfd peer 192.168.1.1 multiplier 3
# Additional IS-IS configuration
set protocols isis CORE interface eth0 network point-to-point
set protocols isis CORE level 2BFD with static routes
BFD can monitor next-hop reachability for static routes, providing fast failover.
Basic configuration
# Create a static route with BFD monitoring
set protocols static route 10.0.0.0/8 next-hop 192.168.1.1 bfd
# Configure the BFD peer for the next-hop
set protocols bfd peer 192.168.1.1 source interface eth0
set protocols bfd peer 192.168.1.1 interval transmit 300
set protocols bfd peer 192.168.1.1 interval receive 300
set protocols bfd peer 192.168.1.1 multiplier 3Multi-hop static routes with BFD
# Create a multi-hop BFD session
set protocols bfd peer 10.0.0.1 multihop
set protocols bfd peer 10.0.0.1 source address 10.0.0.2
set protocols bfd peer 10.0.0.1 interval transmit 500
set protocols bfd peer 10.0.0.1 interval receive 500
set protocols bfd peer 10.0.0.1 multiplier 3
# Static route with multi-hop BFD
set protocols static route 172.16.0.0/12 next-hop 10.0.0.1 bfd multi-hopIPv6 static routes with BFD
# Configure BFD for the IPv6 next-hop
set protocols bfd peer 2001:db8::1 source interface eth0
set protocols bfd peer 2001:db8::1 interval transmit 300
set protocols bfd peer 2001:db8::1 interval receive 300
set protocols bfd peer 2001:db8::1 multiplier 3
# Create an IPv6 static route with BFD
set protocols static route6 2001:db8:100::/48 next-hop 2001:db8::1 bfdRedundancy with multiple next-hops
# Primary route with BFD
set protocols static route 0.0.0.0/0 next-hop 192.168.1.1 distance 10
set protocols static route 0.0.0.0/0 next-hop 192.168.1.1 bfd
set protocols bfd peer 192.168.1.1 source interface eth0
set protocols bfd peer 192.168.1.1 interval transmit 300
set protocols bfd peer 192.168.1.1 interval receive 300
set protocols bfd peer 192.168.1.1 multiplier 3
# Backup route with BFD
set protocols static route 0.0.0.0/0 next-hop 192.168.2.1 distance 20
set protocols static route 0.0.0.0/0 next-hop 192.168.2.1 bfd
set protocols bfd peer 192.168.2.1 source interface eth1
set protocols bfd peer 192.168.2.1 interval transmit 300
set protocols bfd peer 192.168.2.1 interval receive 300
set protocols bfd peer 192.168.2.1 multiplier 3Examples for cloud platforms
Example 1: BFD with BGP in Yandex Cloud for fast failover
Scenario: Two VyOS routers in different Yandex Cloud availability zones running BGP and BFD to provide high availability.
Topology
[VyOS-1 (ru-central1-a)]
|
| iBGP + BFD
|
[VyOS-2 (ru-central1-b)]Configuration of VyOS-1 (192.168.1.1)
# Configure the interfaces
set interfaces ethernet eth0 address 192.168.1.1/24
set interfaces ethernet eth0 description 'Internal Network'
# Configure BFD with aggressive timers for the cloud
set protocols bfd peer 192.168.1.2 interval transmit 200
set protocols bfd peer 192.168.1.2 interval receive 200
set protocols bfd peer 192.168.1.2 multiplier 3
set protocols bfd peer 192.168.1.2 source interface eth0
# Configure BGP
set protocols bgp system-as 65001
set protocols bgp parameters router-id 192.168.1.1
# Configure the BGP neighbor with BFD
set protocols bgp neighbor 192.168.1.2 remote-as 65001
set protocols bgp neighbor 192.168.1.2 update-source eth0
set protocols bgp neighbor 192.168.1.2 bfd
set protocols bgp neighbor 192.168.1.2 address-family ipv4-unicast
# Advertise networks
set protocols bgp address-family ipv4-unicast network 10.10.1.0/24
set protocols bgp address-family ipv4-unicast network 172.16.0.0/16
# Save the configuration
commit
saveConfiguration of VyOS-2 (192.168.1.2)
# Configure the interfaces
set interfaces ethernet eth0 address 192.168.1.2/24
set interfaces ethernet eth0 description 'Internal Network'
# Configure BFD (symmetric configuration)
set protocols bfd peer 192.168.1.1 interval transmit 200
set protocols bfd peer 192.168.1.1 interval receive 200
set protocols bfd peer 192.168.1.1 multiplier 3
set protocols bfd peer 192.168.1.1 source interface eth0
# Configure BGP
set protocols bgp system-as 65001
set protocols bgp parameters router-id 192.168.1.2
# Configure the BGP neighbor with BFD
set protocols bgp neighbor 192.168.1.1 remote-as 65001
set protocols bgp neighbor 192.168.1.1 update-source eth0
set protocols bgp neighbor 192.168.1.1 bfd
set protocols bgp neighbor 192.168.1.1 address-family ipv4-unicast
# Advertise networks
set protocols bgp address-family ipv4-unicast network 10.10.2.0/24
set protocols bgp address-family ipv4-unicast network 172.16.0.0/16
# Save the configuration
commit
saveVerification
# Check the BFD sessions
show bfd peers
# Expected output:
# peer 192.168.1.2
# ID: 1234567890
# Remote ID: 987654321
# Status: up
# Uptime: 1 day, 2 hours, 30 minutes
# Diagnostic: ok
# Remote Diagnostic: ok
# Peer Type: configured
# Local Timers:
# Detect Multiplier: 3
# Receive Interval: 200ms
# Transmit Interval: 200ms
# Remote Timers:
# Detect Multiplier: 3
# Receive Interval: 200ms
# Transmit Interval: 200ms
# Check the BGP neighbors
show bgp summary
# Check the BGP routes
show ip bgpExample 2: BFD with OSPF in VK Cloud for a data center
Scenario: Three VyOS routers in a private VK Cloud data center using OSPF with BFD for fast convergence.
Topology
[Core-1]
/ \
/ \
[Core-2]--[Core-3]Configuration of Core-1 (10.0.0.1)
# Configure the interfaces
set interfaces ethernet eth0 address 10.0.0.1/30
set interfaces ethernet eth0 description 'Link to Core-2'
set interfaces ethernet eth1 address 10.0.0.5/30
set interfaces ethernet eth1 description 'Link to Core-3'
set interfaces ethernet eth2 address 10.0.1.1/24
set interfaces ethernet eth2 description 'Access Network'
# Configure BFD for all neighbors
# BFD for Core-2 (10.0.0.2)
set protocols bfd peer 10.0.0.2 source interface eth0
set protocols bfd peer 10.0.0.2 interval transmit 300
set protocols bfd peer 10.0.0.2 interval receive 300
set protocols bfd peer 10.0.0.2 multiplier 3
# BFD for Core-3 (10.0.0.6)
set protocols bfd peer 10.0.0.6 source interface eth1
set protocols bfd peer 10.0.0.6 interval transmit 300
set protocols bfd peer 10.0.0.6 interval receive 300
set protocols bfd peer 10.0.0.6 multiplier 3
# Configure OSPF
set protocols ospf area 0 network 10.0.0.0/30
set protocols ospf area 0 network 10.0.0.4/30
set protocols ospf area 0 network 10.0.1.0/24
set protocols ospf parameters router-id 10.0.0.1
# Enable BFD on the OSPF interfaces
set protocols ospf interface eth0 bfd
set protocols ospf interface eth1 bfd
# Configure a passive interface for the access network
set protocols ospf passive-interface eth2
# Save the configuration
commit
saveConfiguration of Core-2 (10.0.0.2)
# Configure the interfaces
set interfaces ethernet eth0 address 10.0.0.2/30
set interfaces ethernet eth0 description 'Link to Core-1'
set interfaces ethernet eth1 address 10.0.0.9/30
set interfaces ethernet eth1 description 'Link to Core-3'
set interfaces ethernet eth2 address 10.0.2.1/24
set interfaces ethernet eth2 description 'Access Network'
# Configure BFD for all neighbors
# BFD for Core-1 (10.0.0.1)
set protocols bfd peer 10.0.0.1 source interface eth0
set protocols bfd peer 10.0.0.1 interval transmit 300
set protocols bfd peer 10.0.0.1 interval receive 300
set protocols bfd peer 10.0.0.1 multiplier 3
# BFD for Core-3 (10.0.0.10)
set protocols bfd peer 10.0.0.10 source interface eth1
set protocols bfd peer 10.0.0.10 interval transmit 300
set protocols bfd peer 10.0.0.10 interval receive 300
set protocols bfd peer 10.0.0.10 multiplier 3
# Configure OSPF
set protocols ospf area 0 network 10.0.0.0/30
set protocols ospf area 0 network 10.0.0.8/30
set protocols ospf area 0 network 10.0.2.0/24
set protocols ospf parameters router-id 10.0.0.2
# Enable BFD on the OSPF interfaces
set protocols ospf interface eth0 bfd
set protocols ospf interface eth1 bfd
# Configure a passive interface
set protocols ospf passive-interface eth2
# Save the configuration
commit
saveConfiguration of Core-3 (10.0.0.6/10.0.0.10)
# Configure the interfaces
set interfaces ethernet eth0 address 10.0.0.6/30
set interfaces ethernet eth0 description 'Link to Core-1'
set interfaces ethernet eth1 address 10.0.0.10/30
set interfaces ethernet eth1 description 'Link to Core-2'
set interfaces ethernet eth2 address 10.0.3.1/24
set interfaces ethernet eth2 description 'Access Network'
# Configure BFD for all neighbors
# BFD for Core-1 (10.0.0.5)
set protocols bfd peer 10.0.0.5 source interface eth0
set protocols bfd peer 10.0.0.5 interval transmit 300
set protocols bfd peer 10.0.0.5 interval receive 300
set protocols bfd peer 10.0.0.5 multiplier 3
# BFD for Core-2 (10.0.0.9)
set protocols bfd peer 10.0.0.9 source interface eth1
set protocols bfd peer 10.0.0.9 interval transmit 300
set protocols bfd peer 10.0.0.9 interval receive 300
set protocols bfd peer 10.0.0.9 multiplier 3
# Configure OSPF
set protocols ospf area 0 network 10.0.0.4/30
set protocols ospf area 0 network 10.0.0.8/30
set protocols ospf area 0 network 10.0.3.0/24
set protocols ospf parameters router-id 10.0.0.6
# Enable BFD on the OSPF interfaces
set protocols ospf interface eth0 bfd
set protocols ospf interface eth1 bfd
# Configure a passive interface
set protocols ospf passive-interface eth2
# Save the configuration
commit
saveVerifying the VK Cloud configuration
# Check the BFD sessions on any router
show bfd peers
# Check the OSPF neighbors
show ip ospf neighbor
# Expected output on Core-1:
# Neighbor ID Pri State Up Time Dead Time Address Interface
# 10.0.0.2 1 Full/- 1d02h30m 00:00:31 10.0.0.2 eth0:10.0.0.1
# 10.0.0.6 1 Full/- 1d02h25m 00:00:35 10.0.0.6 eth1:10.0.0.5
# Check the OSPF database
show ip ospf database
# Check the routes
show ip route ospfExample 3: Multi-hop BFD for eBGP over the Internet
Scenario: Connecting to a provider over eBGP with multi-hop BFD to monitor the reachability of the BGP neighbor.
# Local router configuration
# Public IP: 203.0.113.1
# BGP neighbor (ISP): 198.51.100.1
# Configure the WAN interface
set interfaces ethernet eth0 address 203.0.113.1/30
set interfaces ethernet eth0 description 'ISP Link'
# Configure multi-hop BFD
set protocols bfd peer 198.51.100.1 multihop
set protocols bfd peer 198.51.100.1 source address 203.0.113.1
set protocols bfd peer 198.51.100.1 interval transmit 500
set protocols bfd peer 198.51.100.1 interval receive 500
set protocols bfd peer 198.51.100.1 multiplier 5
set protocols bfd peer 198.51.100.1 minimum-ttl 250
# Configure eBGP with multi-hop
set protocols bgp system-as 65001
set protocols bgp parameters router-id 203.0.113.1
set protocols bgp neighbor 198.51.100.1 remote-as 65000
set protocols bgp neighbor 198.51.100.1 ebgp-multihop 2
set protocols bgp neighbor 198.51.100.1 bfd
set protocols bgp neighbor 198.51.100.1 address-family ipv4-unicast
# Advertise networks
set protocols bgp address-family ipv4-unicast network 203.0.113.0/24
# Configure the default route from the ISP
set protocols bgp neighbor 198.51.100.1 address-family ipv4-unicast default-originate
commit
saveMonitoring and diagnostic commands
Basic show commands
Viewing all BFD peers
show bfd peersExample output:
peer 192.168.1.1
ID: 1234567890
Remote ID: 987654321
Status: up
Uptime: 2 days, 5 hours, 15 minutes
Diagnostic: ok
Remote Diagnostic: ok
Peer Type: configured
Local Timers:
Detect Multiplier: 3
Receive Interval: 300ms
Transmit Interval: 300ms
Remote Timers:
Detect Multiplier: 3
Receive Interval: 300ms
Transmit Interval: 300ms
Echo Interval: disabled
Remote Echo Interval: disabled
peer 192.168.1.2
ID: 1234567891
Remote ID: 987654322
Status: down
Downtime: 5 minutes, 30 seconds
Diagnostic: Control Detection Time Expired
Remote Diagnostic: ok
Peer Type: configured
Local Timers:
Detect Multiplier: 3
Receive Interval: 300ms
Transmit Interval: 300msViewing a specific peer
show bfd peer 192.168.1.1Viewing BFD statistics
show bfd peer 192.168.1.1 countersExample output:
Control packet input: 245678 packets
Control packet output: 245680 packets
Echo packet input: 0 packets
Echo packet output: 0 packets
Session up events: 2
Session down events: 1
Zebra notifications: 3Viewing BFD with static routes
show protocols static bfdExample output:
Route Next Hop BFD Status Interface
10.0.0.0/8 192.168.1.1 Up eth0
172.16.0.0/12 192.168.2.1 Down eth1
0.0.0.0/0 192.168.1.1 Up eth0Detailed BFD information
# View all sessions in brief format
show bfd peers brief
# View the BFD configuration
show configuration protocols bfd
# View the BFD profiles
show protocols bfd profileReal-time monitoring
# Monitor BFD messages (requires debug mode)
monitor protocol bfd
# View the BFD logs
show log | match BFDIntegration with routing protocols
Checking BGP with BFD
# View the BGP neighbors with the BFD status
show bgp summary
# View detailed information about a BGP neighbor
show bgp neighbor 192.168.1.1
# The output will contain a section:
# BFD: Type: single hop
# Detect Multiplier: 3, Receive Interval: 300, Transmit Interval: 300
# Status: Up, Last update: 2 days, 5 hours, 15 minutes agoChecking OSPF with BFD
# View the OSPF neighbors
show ip ospf neighbor
# The output will show neighbors with a BFD indication
# Neighbor ID Pri State Up Time Dead Time Address Interface BFD
# 10.0.0.2 1 Full/- 1d02h30m 00:00:31 10.0.0.2 eth0 Up
# Detailed information about an OSPF interface
show ip ospf interface eth0Checking IS-IS with BFD
# View the IS-IS neighbors
show isis neighbor
# Detailed information
show isis neighbor detailDiagnostics and troubleshooting
Common problems and solutions
Problem 1: The BFD session does not come up
Symptoms:
show bfd peers
# Status: down
# Diagnostic: No DiagnosticPossible causes and solutions:
- Timer parameter mismatch
# Check that both nodes have compatible intervals
# On both nodes:
show configuration protocols bfd peer 192.168.1.1
# Make sure the receive interval of one node <= the transmit interval of the other- Network connectivity problems
# Check basic connectivity
ping 192.168.1.1
# Check that UDP ports 3784 (control) and 3785 (echo) are not blocked
# Temporarily disable the firewall for testing
set firewall group network-group BFD-ALLOW network 192.168.1.0/24
set firewall name WAN-LOCAL rule 100 source group network-group BFD-ALLOW
set firewall name WAN-LOCAL rule 100 protocol udp
set firewall name WAN-LOCAL rule 100 destination port 3784-3785
set firewall name WAN-LOCAL rule 100 action accept
commit- Incorrect source interface or address
# For single-hop BFD, check the source interface
set protocols bfd peer 192.168.1.1 source interface eth0
# For multi-hop BFD, check the source address
set protocols bfd peer 10.0.0.1 source address 10.0.0.2Problem 2: The BFD session is unstable (flapping)
Symptoms:
show bfd peer 192.168.1.1
# Session down events: 15
# Session up events: 16Possible causes and solutions:
- Timers that are too aggressive
# Increase the intervals and the multiplier
set protocols bfd peer 192.168.1.1 interval transmit 500
set protocols bfd peer 192.168.1.1 interval receive 500
set protocols bfd peer 192.168.1.1 multiplier 5
commit- High CPU or network load
# Check the CPU load
show system cpu
# Check the interface statistics for errors
show interfaces ethernet eth0
# Consider using less aggressive timers- Link quality problems
# Check the packet loss statistics
show interfaces ethernet eth0 statistics
# If there is loss, increase the multiplier
set protocols bfd peer 192.168.1.1 multiplier 5Problem 3: BFD works, but the routing protocol does not react
Symptoms:
show bfd peers
# Status: up
show bgp neighbor 192.168.1.1
# BGP state = Established
# (but when the BFD peer goes down, the BGP session does not drop quickly)Solution:
# Make sure BFD is enabled for the protocol
show configuration protocols bgp neighbor 192.168.1.1
# It should be:
# protocols {
# bgp {
# neighbor 192.168.1.1 {
# bfd
# }
# }
# }
# If it is missing, add it:
set protocols bgp neighbor 192.168.1.1 bfd
commitProblem 4: Multi-hop BFD does not work
Symptoms:
show bfd peer 10.0.0.1
# Status: down
# Diagnostic: Path DownSolution:
# Check that multihop is specified
set protocols bfd peer 10.0.0.1 multihop
# Check the source address
set protocols bfd peer 10.0.0.1 source address 10.0.0.2
# Check the minimum-ttl (it must be large enough)
set protocols bfd peer 10.0.0.1 minimum-ttl 250
# Make sure there is a route to the remote peer
show ip route 10.0.0.1Debug mode
Enabling debug for BFD
# Enable debug for BFD
debug bfd network
debug bfd peer 192.168.1.1
debug bfd zebra
# View the debug output
show log | match BFD
# Disable debug
no debug bfd network
no debug bfd peer 192.168.1.1
no debug bfd zebraAnalyzing BFD packets
# Capture BFD packets on an interface
monitor traffic interface eth0 filter "udp port 3784"
# Save to a file for analysis
monitor traffic interface eth0 filter "udp port 3784" save /tmp/bfd.pcapLogging BFD events
# Configure syslog for BFD
set system syslog global facility protocols level debug
# View the logs
show log | match "bfd|BFD"
# Configure a separate log file for BFD
set system syslog file bfd.log facility protocols level infoBFD diagnostics checklist
Basic connectivity
- Ping to the BFD peer succeeds
- No packet loss
- Latency is acceptable
BFD configuration
- The BFD peer is configured on both devices
- The intervals are compatible
- The source interface/address is specified correctly
- For multi-hop: multihop is enabled and the source address is specified
Firewall and ACLs
- UDP port 3784 (control) is allowed
- UDP port 3785 (echo) is allowed when echo mode is used
- There is no rate limiting on BFD packets
Protocol integration
- BFD is enabled for the routing protocol
- The routing protocol is active
- The protocol neighbor matches the BFD peer
Performance
- CPU load is within normal limits
- There are no memory problems
- The network interface is not overloaded
Recommendations and best practices
Choosing BFD timers
Fast failure detection (critical applications)
# Aggressive timers: detection in ~300 ms
set protocols bfd peer 192.168.1.1 interval transmit 100
set protocols bfd peer 192.168.1.1 interval receive 100
set protocols bfd peer 192.168.1.1 multiplier 3
# Risks: high CPU load, sensitivity to brief delaysStandard configuration (most scenarios)
# Balanced timers: detection in ~900 ms
set protocols bfd peer 192.168.1.1 interval transmit 300
set protocols bfd peer 192.168.1.1 interval receive 300
set protocols bfd peer 192.168.1.1 multiplier 3
# Recommended for most networksConservative configuration (unstable links)
# Conservative timers: detection in ~5 seconds
set protocols bfd peer 192.168.1.1 interval transmit 1000
set protocols bfd peer 192.168.1.1 interval receive 1000
set protocols bfd peer 192.168.1.1 multiplier 5
# For links with variable quality or high latencyScaling BFD
Recommendations by number of sessions
- Small networks (< 10 sessions): Aggressive timers can be used
- Medium networks (10-50 sessions): Use standard timers
- Large networks (> 50 sessions): Consider conservative timers or profiles
Using profiles for scaling
# Create profiles for different link types
set protocols bfd profile DATACENTER interval transmit 100
set protocols bfd profile DATACENTER interval receive 100
set protocols bfd profile DATACENTER multiplier 3
set protocols bfd profile WAN interval transmit 500
set protocols bfd profile WAN interval receive 500
set protocols bfd profile WAN multiplier 5
set protocols bfd profile BACKUP interval transmit 1000
set protocols bfd profile BACKUP interval receive 1000
set protocols bfd profile BACKUP multiplier 5
# Apply the profiles
set protocols bfd peer 10.0.1.1 profile DATACENTER
set protocols bfd peer 10.0.2.1 profile WAN
set protocols bfd peer 10.0.3.1 profile BACKUPImpact on CPU and optimization
Monitoring the CPU load from BFD
# View the processes
show system processes
show system processes summary
# Find the bfdd process
show system processes | match bfdOptimizing CPU usage
- Grouping timers
# Use identical intervals for a group of peers
# This makes it possible to optimize packet processing
set protocols bfd peer 10.0.1.1 interval transmit 300
set protocols bfd peer 10.0.1.2 interval transmit 300
set protocols bfd peer 10.0.1.3 interval transmit 300- Avoid overly aggressive timers
# Instead of 50ms, use 100ms or 300ms where possible
# 50ms may require significant CPU resources- Use echo mode where possible
# Echo mode reduces the load on the control plane
set protocols bfd peer 192.168.1.1 echo-mode
set protocols bfd peer 192.168.1.1 interval echo-interval 500BFD security
Protection against spoofing
# BFD uses a minimum TTL for multi-hop sessions
set protocols bfd peer 10.0.0.1 minimum-ttl 254
# This prevents acceptance of packets that have crossed more than 1 hop
# (255 - 254 = 1 allowed hop)Firewall rules for BFD
# Create an address-group for the BFD peers
set firewall group address-group BFD-PEERS address 192.168.1.1
set firewall group address-group BFD-PEERS address 192.168.1.2
set firewall group address-group BFD-PEERS address 192.168.1.3
# Allow BFD only from known peers
set firewall name WAN-LOCAL rule 100 source group address-group BFD-PEERS
set firewall name WAN-LOCAL rule 100 protocol udp
set firewall name WAN-LOCAL rule 100 destination port 3784-3785
set firewall name WAN-LOCAL rule 100 action accept
# Block all other BFD packets
set firewall name WAN-LOCAL rule 101 protocol udp
set firewall name WAN-LOCAL rule 101 destination port 3784-3785
set firewall name WAN-LOCAL rule 101 action drop
set firewall name WAN-LOCAL rule 101 log enableIntegration with monitoring
SNMP monitoring of BFD
# Configure SNMP for BFD monitoring
set service snmp community public authorization ro
set service snmp community public network 10.0.0.0/8
# BFD MIB OIDs:
# bfdSessState: .1.3.6.1.2.1.222.1.3.1.7
# bfdSessUpTime: .1.3.6.1.2.1.222.1.3.1.10
# bfdSessDownTime: .1.3.6.1.2.1.222.1.3.1.11Syslog for event monitoring
# Send BFD events to a syslog server
set system syslog host 10.0.0.100 facility protocols level warning
set system syslog host 10.0.0.100 facility protocols level err
set system syslog host 10.0.0.100 facility protocols level crit
# Local logging
set system syslog file bfd.log facility protocols level infoPlanning a migration to BFD
Phased rollout
Phase 1: Pilot deployment
# Start with non-critical links
set protocols bfd peer 192.168.99.1 interval transmit 1000
set protocols bfd peer 192.168.99.1 interval receive 1000
set protocols bfd peer 192.168.99.1 multiplier 5
# Enable BFD for the protocol, but keep the existing timers
set protocols ospf interface eth0 bfd
# Do not reduce the dead-interval right awayPhase 2: Monitoring and tuning
# Monitor the BFD sessions for a week
show bfd peers
show bfd peer 192.168.99.1 counters
# Check for flapping
show log | match "BFD.*down"Phase 3: Timer optimization
# After stable operation, reduce the intervals
set protocols bfd peer 192.168.99.1 interval transmit 300
set protocols bfd peer 192.168.99.1 interval receive 300
set protocols bfd peer 192.168.99.1 multiplier 3
commit
# For OSPF, you can increase the dead-interval
set protocols ospf interface eth0 dead-interval 40
set protocols ospf interface eth0 hello-interval 10Phase 4: Expansion to critical links
# After successful testing, roll out to production links
set protocols bfd peer 192.168.1.1 interval transmit 300
set protocols bfd peer 192.168.1.1 interval receive 300
set protocols bfd peer 192.168.1.1 multiplier 3
set protocols bgp neighbor 192.168.1.1 bfdBFD use cases
1. Critical financial applications
# Requirement: failure detection < 500 ms
set protocols bfd peer 192.168.1.1 interval transmit 150
set protocols bfd peer 192.168.1.1 interval receive 150
set protocols bfd peer 192.168.1.1 multiplier 3
# Detection time: 150ms × 3 = 450ms2. VoIP and real-time applications
# Requirement: failure detection < 1 second
set protocols bfd peer 192.168.1.1 interval transmit 300
set protocols bfd peer 192.168.1.1 interval receive 300
set protocols bfd peer 192.168.1.1 multiplier 3
# Detection time: 300ms × 3 = 900ms3. General enterprise applications
# Requirement: failure detection < 5 seconds
set protocols bfd peer 192.168.1.1 interval transmit 1000
set protocols bfd peer 192.168.1.1 interval receive 1000
set protocols bfd peer 192.168.1.1 multiplier 3
# Detection time: 1000ms × 3 = 3 seconds4. Backup links
# More conservative timers can be used
set protocols bfd peer 192.168.2.1 interval transmit 2000
set protocols bfd peer 192.168.2.1 interval receive 2000
set protocols bfd peer 192.168.2.1 multiplier 5
# Detection time: 2000ms × 5 = 10 secondsCombining with other HA technologies
BFD + VRRP
# BFD can trigger changes in the VRRP priority through scripts
# or integrate with tracked interfaces
# Example of tracking the BFD status for VRRP
# (requires additional scripts to monitor the BFD status)
set high-availability vrrp group LAN vrid 10
set high-availability vrrp group LAN interface eth1
set high-availability vrrp group LAN virtual-address 192.168.1.254/24
set high-availability vrrp group LAN priority 150BFD + Policy-Based Routing
# Using BFD to switch between providers
# Static route with BFD
set protocols static route 0.0.0.0/0 next-hop 203.0.113.1 distance 10
set protocols static route 0.0.0.0/0 next-hop 203.0.113.1 bfd
# Backup route
set protocols static route 0.0.0.0/0 next-hop 198.51.100.1 distance 20
set protocols static route 0.0.0.0/0 next-hop 198.51.100.1 bfd
# BFD peers
set protocols bfd peer 203.0.113.1 source interface eth0
set protocols bfd peer 203.0.113.1 interval transmit 500
set protocols bfd peer 203.0.113.1 interval receive 500
set protocols bfd peer 203.0.113.1 multiplier 3
set protocols bfd peer 198.51.100.1 source interface eth1
set protocols bfd peer 198.51.100.1 interval transmit 500
set protocols bfd peer 198.51.100.1 interval receive 500
set protocols bfd peer 198.51.100.1 multiplier 3Advanced configuration scenarios
VRF-Aware BFD
BFD can operate in the context of a VRF (Virtual Routing and Forwarding):
# Create a VRF
set vrf name CUSTOMER-A table 100
set vrf name CUSTOMER-A protocols static route 0.0.0.0/0 next-hop 10.1.1.1
# Bind an interface to the VRF
set interfaces ethernet eth2 vrf CUSTOMER-A
set interfaces ethernet eth2 address 10.1.1.2/30
# Configure BFD in the VRF context
set protocols bfd peer 10.1.1.1 source interface eth2
set protocols bfd peer 10.1.1.1 interval transmit 300
set protocols bfd peer 10.1.1.1 interval receive 300
set protocols bfd peer 10.1.1.1 multiplier 3
# BGP in the VRF with BFD
set vrf name CUSTOMER-A protocols bgp system-as 65001
set vrf name CUSTOMER-A protocols bgp neighbor 10.1.1.1 remote-as 65002
set vrf name CUSTOMER-A protocols bgp neighbor 10.1.1.1 bfdBFD with IPv6
Complete BFD configuration for IPv6:
# Configure the IPv6 interface
set interfaces ethernet eth0 address 2001:db8:1::1/64
# BFD peer for IPv6
set protocols bfd peer 2001:db8:1::2 source interface eth0
set protocols bfd peer 2001:db8:1::2 interval transmit 300
set protocols bfd peer 2001:db8:1::2 interval receive 300
set protocols bfd peer 2001:db8:1::2 multiplier 3
# BGP for IPv6 with BFD
set protocols bgp neighbor 2001:db8:1::2 bfd
set protocols bgp neighbor 2001:db8:1::2 address-family ipv6-unicast
set protocols bgp neighbor 2001:db8:1::2 remote-as 65002
# OSPFv3 with BFD
set protocols ospfv3 area 0.0.0.0 interface eth0
set protocols ospfv3 interface eth0 bfdDual-Stack BFD (IPv4 + IPv6)
# IPv4 BFD
set protocols bfd peer 192.168.1.1 source interface eth0
set protocols bfd peer 192.168.1.1 interval transmit 300
set protocols bfd peer 192.168.1.1 interval receive 300
set protocols bfd peer 192.168.1.1 multiplier 3
# IPv6 BFD on the same interface
set protocols bfd peer 2001:db8:1::2 source interface eth0
set protocols bfd peer 2001:db8:1::2 interval transmit 300
set protocols bfd peer 2001:db8:1::2 interval receive 300
set protocols bfd peer 2001:db8:1::2 multiplier 3
# BGP dual-stack with BFD
set protocols bgp neighbor 192.168.1.1 bfd
set protocols bgp neighbor 192.168.1.1 address-family ipv4-unicast
set protocols bgp neighbor 2001:db8:1::2 bfd
set protocols bgp neighbor 2001:db8:1::2 address-family ipv6-unicastFrequently asked questions (FAQ)
Q1: What is the minimum supported BFD interval?
A: The minimum BFD interval in VyOS is 10 ms; however, in practice it is recommended to use at least 100 ms for stable operation, especially on virtual machines or devices with limited resources.
Q2: How many BFD sessions can a single router support?
A: The count depends on the hardware resources and the timer configuration. On modern hardware with aggressive timers (100-300 ms), 50-100 sessions is typical. With conservative timers (1000 ms), several hundred sessions are possible.
Q3: Does BFD work through NAT?
A: BFD can work through NAT in multi-hop mode; however, this is not recommended for production environments because of the additional latency and potential session-matching problems. For critical applications, use direct IP connectivity.
Q4: Can BFD be used to monitor the availability of hosts that are not routers?
A: BFD is intended for monitoring between devices that support the BFD protocol. To monitor ordinary hosts, use other mechanisms such as ICMP ping or application-level health checks.
Q5: How does BFD interact with Graceful Restart?
A: BFD and Graceful Restart can conflict. If BFD detects a failure during Graceful Restart, it may interrupt the recovery process. Consider temporarily increasing the BFD timers or disabling BFD during planned maintenance.
Q6: Is BFD needed if fast hello is used in OSPF or BGP?
A: BFD is preferable because it:
- Provides a single mechanism for all protocols
- Is more CPU-efficient
- Can detect failures faster
- Allows slower timers to be used in the routing protocols themselves
Q7: What happens when the BFD process restarts?
A: When the bfdd process restarts, all BFD sessions are re-established. This causes paths to be temporarily declared unavailable, which may trigger routing convergence. Schedule such operations during maintenance windows.
Q8: Does VyOS support BFD for MPLS LDP?
A: At the time of writing, BFD for MPLS LDP has limited support. Check your current VyOS version for up-to-date information about feature support.
Recommendations by VyOS version
VyOS 1.3 (Equuleus)
- Full BFD support for BGP, OSPF, and IS-IS
- Support for single-hop and multi-hop modes
- Basic profile support
VyOS 1.4 (Sagitta)
- Improved BFD performance
- Extended profile support
- Improved VRF integration
- IPv6 BFD support
VyOS 1.5 (Circinus)
- Additional performance optimizations
- Enhanced monitoring capabilities
- Improved BFD support for static routes
- Updated FRR version with improved BFD support
Conclusion
BFD is a powerful tool for providing high availability and fast convergence in modern networks. Proper BFD configuration makes it possible to:
- Reduce failure detection time from minutes to milliseconds
- Reduce configuration complexity through a single mechanism for all protocols
- Improve the predictability of network behavior during failures
- Optimize resource usage through an efficient implementation
Key recommendations
- Start with conservative timers and optimize them gradually
- Use profiles to manage a large number of sessions
- Monitor CPU load and session stability
- Plan the migration in phases, starting with non-critical links
- Document your BFD configuration and the reasons for choosing specific timers
Additional resources
- VyOS Documentation - BFD
- RFC 5880 - Bidirectional Forwarding Detection
- RFC 5881 - BFD for IPv4 and IPv6
- RFC 5883 - BFD for Multihop Paths
- FRR BFD Documentation
Change history
| Date | Version | Changes |
|---|---|---|
| 2025-10-15 | 1.0 | Initial version of the documentation |
Note: This documentation is current for VyOS versions 1.3.x, 1.4.x, and 1.5.x. Always check the official VyOS documentation for your specific version.