Skip to content
Thomas Mangin edited this page Jul 25, 2026 · 2 revisions

Pre-Alpha. This page describes behavior that may change.

Ze includes a full BFD implementation (RFC 5880/5881/5882/5883) as a plugin. BFD detects forwarding failures in tens to hundreds of milliseconds, one or two orders of magnitude faster than BGP keepalives. BGP peers opt in by adding a bfd { } block in their connection config.

When to use it

Scenario BFD value
eBGP transit session Sub-second failure detection without waiting for BGP hold time (default 90 s).
iBGP over a loopback Multi-hop BFD can accelerate route reconvergence if the IGP alone is too slow.
Static route to a gateway Withdraw the route when the gateway stops forwarding, even if the physical link is up.

Do not use BFD between two routers where the IGP already runs fast BFD. The redundant sessions double the packet rate and can amplify instability.

Configuration

Profiles

Profiles are named bundles of timer and feature parameters. Sessions reference a profile by name.

bfd {
    profile fast-link {
        desired-min-tx-us   50000;    # 50 ms
        required-min-rx-us  50000;
        detect-multiplier   3;        # 150 ms detection time
    }
    profile ibgp-loopback {
        desired-min-tx-us   300000;
        required-min-rx-us  300000;
        detect-multiplier   5;
    }
}

All interval fields are in microseconds (RFC 5880 convention).

Leaf Range Default Meaning
desired-min-tx-us 1 - 4294967295 300000 Local target transmit rate.
required-min-rx-us 0 - 4294967295 300000 Minimum inter-packet gap the local end can handle.
detect-multiplier 1 - 255 3 Consecutive missed packets that trigger Down.
passive boolean false Wait for the peer's first packet instead of transmitting from creation.

Authentication

Profiles may carry an auth { ... } block for RFC 5880 S6.7 authentication. Four types are supported: keyed-md5, meticulous-keyed-md5, keyed-sha1, and meticulous-keyed-sha1. Simple Password is refused at config parse time.

bfd {
    persist-dir "/var/lib/ze/bfd";
    profile authenticated-fast {
        desired-min-tx-us   50000;
        required-min-rx-us  50000;
        detect-multiplier   3;
        auth {
            type   meticulous-keyed-sha1;
            key-id 7;
            secret "BFD-SHARED-SECRET-V1";
        }
    }
}

The persist-dir leaf stores the last TX sequence per session so Meticulous sessions resume above the peer's replay window after a restart.

Echo mode

Profiles may carry an echo { desired-min-echo-tx-us N } block for RFC 5880 S6.4 Echo mode. Echo mode is valid only on single-hop sessions.

bfd {
    profile fast-echo {
        desired-min-tx-us   100000;
        required-min-rx-us  100000;
        echo {
            desired-min-echo-tx-us 50000;
        }
    }
}

Enabling BFD on a BGP peer

Add a bfd { } container inside a BGP peer's connection { } block:

bgp {
    peer peer1 {
        connection {
            local  { ip 192.0.2.1; }
            remote { ip 192.0.2.2; }
            bfd {
                enabled true;
                mode single-hop;
                profile fast-link;
            }
        }
        session {
            asn { local 65001; remote 65002; }
            router-id 192.0.2.1;
            family { ipv4/unicast; }
        }
    }
}

On session Established, the reactor opens a BFD session. When BFD reports Down, the reactor tears the BGP session with RFC 9384 Cease NOTIFICATION subcode 10 ("BFD Down") without waiting for the hold timer.

Multi-hop

For iBGP between loopbacks:

bfd {
    enabled true;
    mode multi-hop;
    min-ttl 250;
    profile ibgp-loopback;
}

mode multi-hop uses UDP port 4784 and skips GTSM. min-ttl must be 256 - max-hops.

Standalone sessions

Sessions without a protocol client:

bfd {
    single-hop-session 192.0.2.254 {
        local     192.0.2.1;
        interface eth0;
        profile   gateway;
    }
    multi-hop-session 198.51.100.7 {
        local   10.0.0.1;
        profile gateway;
        min-ttl 254;
    }
}

Operator commands

Command Description
show bfd sessions All sessions with state, timers, packet counts.
show bfd session <peer> Single session detail with transition history.
show bfd profile Resolved profiles.

Prometheus metrics

Metric Type Meaning
ze_bfd_sessions gauge Live session count by state, mode, VRF.
ze_bfd_transitions_total counter State changes by from/to/diag/mode.
ze_bfd_detection_expired_total counter Detection-timer expirations.
ze_bfd_tx_packets_total counter Control packets transmitted.
ze_bfd_rx_packets_total counter Control packets received.

Transport hardening

Single-hop BFD enforces GTSM (RFC 5082): packets are sent with TTL=255 and received packets with any other TTL are silently discarded. Multi-hop sessions use min-ttl as a weaker replacement. TX jitter per RFC 5880 S6.8.7 is applied automatically. SO_BINDTODEVICE binds sockets to the named interface for single-hop sessions.

What is not yet supported

Feature RFC Status
Demand mode 5880 S6.6 Not implemented. Rarely deployed.
Seamless BFD (S-BFD) 7880, 7881 Not implemented.
Micro-BFD on LAG 7130 Not implemented.
Multipoint BFD 8562 Not implemented.

See also

Adapted from main/docs/guide/bfd.md.

Home

About

First Steps

Configuration

Operation

Interfaces

Plugins

Plugin Development

Chaos Testing

Blueprints

Development

Reference

Clone this wiki locally