โก BFD Failover
Bidirectional Forwarding Detection (BFD) provides subโsecond link failure detection for OSPF, BGP, and static routes. This guide enables BFD on MikroTik RouterOS v7 to achieve faster failover and smoother reconvergence.
BFD works best on pointโtoโpoint links and stable transport. Use conservative timers if you have noisy links or high CPU usage.
Prerequisitesโ
- โ MikroTik RouterOS v7.x
- โ Two routers with a direct link (PTP recommended)
- โ OSPF or BGP already configured
- โ Administrative access via Winbox/SSH
- โ Firewall allows UDP 3784/3785 (BFD)
Aggressive BFD timers can cause flapping on unstable links. Start with safe values and tune gradually.
Configuration Stepsโ
Option A: Terminalโ
-
Enable BFD on an interface
/routing bfd interface add interface=vlan10-OSPF required-min-rx=200ms desired-min-tx=200ms detect-mult=3 -
Enable BFD for OSPF
/routing ospf interface-template set [find interfaces=vlan10-OSPF] bfd=yes -
Verify BFD sessions
/routing bfd session print
Option B: Winboxโ
-
Routing โ BFD โ Interfaces โ Add (+)
- Interface:
vlan10-OSPF - Desired Min TX:
200ms - Required Min RX:
200ms - Detect Mult:
3
- Interface:
-
Routing โ OSPF โ Interface Templates
- Select your PTP interface
- Enable BFD
-
Routing โ BFD โ Sessions
- Confirm state is Up
Understanding the Configurationโ
Flow Diagram
[Link] -> [BFD Session] -> [OSPF/BGP] -> [Fast Failover]
Components Table
| Component | Purpose | Notes |
|---|---|---|
| BFD interface | Link monitoring | Perโinterface settings |
| OSPF template | Routing integration | bfd=yes |
| BFD session | Detection state | Should show Up |
| Timers | Failover speed | Lower = faster, riskier |
Verificationโ
- Check BFD sessions
/routing bfd session print - Check OSPF neighbors
/routing ospf neighbor print - Simulate link failure
- Disable interface or unplug cable
- Observe adjacency drops within subโsecond range
Troubleshootingโ
| Issue | Cause | Solution |
|---|---|---|
| No BFD session | BFD not enabled | Enable on both routers |
| Session flaps | Timers too low | Increase to 300โ500ms |
| CPU spikes | Too many sessions | Use BFD only on core links |
| OSPF not reacting | BFD not linked | Ensure bfd=yes in template |
| Oneโway BFD | Firewall blocking | Allow UDP 3784/3785 |
| Session Down | Link unstable | Check cable, MTU, VLANs |
| BFD Up, OSPF Down | OSPF misconfig | Validate OSPF area + IPs |
| BGP not failing fast | BFD not on BGP | Enable BFD in BGP peer |
| Duplicate sessions | Multiple templates | Use one template per link |
| No logs | Logging disabled | Enable routing logs |
| Timers ignored | Wrong interface | Match correct interface name |
| BFD missing in v6 | Unsupported | Upgrade to RouterOS v7 |
Advanced Optionsโ
- Use different timers per link class
- Combine BFD with ECMP for resilience
- Add route filters to prevent churn
- Enable BFD on BGP peers only
- Use BFD for static routes (routing rules)
- Monitor BFD with Netwatch/Telegram
- Increase detectโmult for noisy links
- Use dedicated VLAN for core links
- Log BFD events to syslog
- Document timer settings per link
Two-Link Failover Example (BFD + OSPF)โ
Use BFD on both PTP links so OSPF fails over within subโsecond ranges when a link drops.
Topology
R1 <==== Link A (vlan10) ====> R2
R1 <==== Link B (vlan20) ====> R2
Link A: 172.16.0.0/30
Link B: 172.16.0.4/30
Router-A (R1)โ
/routing bfd interface add interface=vlan10-OSPF required-min-rx=200ms desired-min-tx=200ms detect-mult=3
/routing bfd interface add interface=vlan20-OSPF required-min-rx=200ms desired-min-tx=200ms detect-mult=3
/routing ospf interface-template set [find interfaces=vlan10-OSPF] bfd=yes
/routing ospf interface-template set [find interfaces=vlan20-OSPF] bfd=yes
Router-B (R2)โ
/routing bfd interface add interface=vlan10-OSPF required-min-rx=200ms desired-min-tx=200ms detect-mult=3
/routing bfd interface add interface=vlan20-OSPF required-min-rx=200ms desired-min-tx=200ms detect-mult=3
/routing ospf interface-template set [find interfaces=vlan10-OSPF] bfd=yes
/routing ospf interface-template set [find interfaces=vlan20-OSPF] bfd=yes
If you want one link as primary, set different OSPF costs. BFD will still detect failure quickly on both links.
Related Guidesโ
Completionโ
โ BFD fast failover is active!
Next steps:
- Test failover under maintenance window
- Tune timers based on link stability
- Document BFD settings per link