=== BFD === .. sidebar:: Contents .. contents:: :depth: 2 :local: This chapter covers some aspects related to the :osdx:cfg:`protocols bfd`, which is a feature that allows users to **manage and monitor** the BFD protocol. BFD (Bidirectional Forwarding Detection) is a network protocol described in RFC 5880. It provides rapid detection of communication failures between adjacent forwarding engines (routers, switches). BFD provides sub-second failure detection, allowing routing protocols such as BGP, OSPF and static routes to react much faster than when they rely on their own keepalive mechanisms. BFD operates separately from the routing protocol that uses it. A BFD session is established between two endpoints and, if the session detects a failure, it notifies the associated routing protocol so that the latter can then take a corrective action (for example, ending a BGP session or removing a static route). Configuration ============= The BFD protocol can be configured using :osdx:cfg:`protocols bfd`. BFD sessions are typically created dynamically by other protocols (BGP, OSPF, static routes) when they enable BFD on a neighbor or route. BFD profiles allow a reusable set of parameters that can be applied to multiple sessions to be defined. An explanation of each configurable parameter is provided below: Peer ---- A BFD peer defines a direct session with a specific remote endpoint. * ``peer``: IP address (IPv4 or IPv6) of the remote BFD peer. The following parameters can be configured per peer: * ``detect-multiplier``: Detection multiplier. Specifies how many consecutive packets can be missed before declaring the session down. Valid range: 2-255. Default: 3. * ``echo-interval``: Desired echo packet transmission interval in milliseconds. Valid range: 10-60000. Default: 50. * ``echo-mode``: Enables echo mode. In echo mode, the local system sends echo packets that the remote system loops back through its forwarding path, allowing path failures to be detected. * ``interface``: Specifies the interface for this BFD peer session. * ``local-address``: Local IPv4 address used for BFD packets. * ``minimum-ttl``: Minimum TTL value expected on received packets. Acts as a security mechanism to limit the maximum number of hops a BFD packet can cross. Valid range: 1-254. * ``multihop``: Enables a multihop BFD session (RFC 5883). Required when the peer is not directly connected. * ``passive-mode``: Don't attempt to start sessions. The system will not begin sending BFD control packets until it receives one from the remote end. * ``profile``: Associates a BFD profile with this peer, inheriting its configuration parameters. * ``receive-interval``: Minimum receive interval required (in milliseconds). Valid range: 10-60000. Default: 300. * ``shutdown``: Disable BFD peer. * ``transmit-interval``: Desired transmit interval in milliseconds. Valid range: 10-60000. Default: 300. * ``vrf``: Associates the peer with a VRF. Profile ------- BFD profiles provide a reusable set of parameters that can be applied to multiple BFD sessions. This simplifies management when multiple sessions share the same configuration. Profiles are referenced by name from BGP neighbors, OSPF interfaces, or static routes. * ``profile``: BFD profile name. The following parameters can be configured per profile: * ``detect-multiplier``: Detection multiplier. Specifies how many consecutive packets can be missed before declaring the session down. Valid range: 2-255. Default: 3. * ``echo-interval``: Desired echo packet transmission interval in milliseconds. Valid range: 10-60000. Default: 50. * ``echo-mode``: Enables echo mode. In echo mode, the local system sends echo packets that the remote system loops back through its forwarding path, allowing path failures to be detected. * ``mark``: Marks BFD packets for policy routing. This allows the network to direct BFD packets through the correct path in scenarios with VRFs and multiple WAN links. Valid range: 1-2147483647. * ``vrf-mark``: Alternative to ``mark``. Instead of specifying a numeric value, references a VRF and automatically calculates the appropriate mark value. Only ``mark`` or ``vrf-mark`` can be configured at the same time. * ``tos``: Sets the Type of Service (ToS) field on BFD packets. By default, BFD uses CS6 (DSCP 48) as recommended by RFC 5881. This parameter allows the default value for specific QoS requirements to be overridden. Valid range: 0-255. * ``minimum-ttl``: Minimum TTL value expected on packets received. Acts as a security mechanism to limit the maximum number of hops a BFD packet can cross. Valid range: 1-254. * ``passive-mode``: Don't attempt to start sessions. The system will not begin sending BFD control packets until it receives one from the remote end. * ``receive-interval``: Minimum receive interval required in milliseconds. Valid range: 10-60000. Default: 300. * ``shutdown``: Disable BFD peer. * ``transmit-interval``: Desired transmit interval in milliseconds. Valid range: 10-60000. Default: 300. Use with BGP ------------- To enable BFD on a BGP neighbor, use the ``bfd`` parameter within the neighbor configuration. Optionally, associate a profile: .. code-block:: none set protocols bgp 10 neighbor peer remote-address 10.10.0.200 set protocols bgp 10 neighbor peer remote-as 20 set protocols bgp 10 neighbor peer bfd set protocols bgp 10 neighbor peer bfd profile MY_PROFILE Use with OSPF --------------- To enable BFD on an OSPF interface, enter the following (optionally with a profile): .. code-block:: none set interfaces ethernet eth0 ip ospf bfd set interfaces ethernet eth0 ip ospf bfd profile MY_PROFILE Use with Static Routes ----------------------- To enable BFD on a static route, enter the following (optionally with a profile): .. code-block:: none set protocols static route 10.0.0.0/24 next-hop 192.168.1.1 bfd set protocols static route 10.0.0.0/24 next-hop 192.168.1.1 bfd profile MY_PROFILE Monitoring ========== To monitor the status and configuration of BFD sessions, you can use the following commands: * :osdx:op:`protocols bfd show peers` displays information about all BFD peers, including session status, timers, diagnostics, mark and ToS values. .. code-block:: none admin@osdx$ protocols bfd show peers BFD Peers: peer 10.10.0.200 local-address 10.10.0.100 vrf default interface eth1 ID: 886568408 Remote ID: 2783626931 Active mode Mark: 99 ToS: 48 Status: up Uptime: 6 minute(s), 23 second(s) Diagnostics: ok Remote diagnostics: ok Peer Type: dynamic Local timers: Detect-multiplier: 3 Receive interval: 300ms Transmission interval: 300ms * :osdx:op:`protocols bfd show peer *` displays information about a specific BFD peer. * :osdx:op:`protocols bfd show static route` displays BFD-monitored static routes. .. _bfd_examples: Examples ======== Mark ---- In this example, two eBGP routers are connected using BFD. A BFD profile is configured with ``mark 99`` to ensure BFD packets are directed through the correct path when using policy routing. .. code-block:: none Router A (10.10.0.100, AS 10) ---- Router B (10.10.0.200, AS 20) **Router A:** .. code-block:: none set interfaces ethernet eth1 address 10.10.0.100/24 set protocols bfd profile BFD_MARK mark 99 set protocols bgp 10 neighbor peer remote-address 10.10.0.200 set protocols bgp 10 neighbor peer remote-as 20 set protocols bgp 10 neighbor peer route-map import PERMIT set protocols bgp 10 neighbor peer bfd profile BFD_MARK set protocols route-map PERMIT rule 1 action permit **Router B:** .. code-block:: none set interfaces ethernet eth1 address 10.10.0.200/24 set interfaces dummy dum0 address 1.1.1.1/24 set protocols bfd profile BFD_MARK mark 99 set protocols bgp 20 neighbor peer remote-address 10.10.0.100 set protocols bgp 20 neighbor peer remote-as 10 set protocols bgp 20 neighbor peer route-map export PERMIT set protocols bgp 20 neighbor peer bfd profile BFD_MARK set protocols bgp 20 redistribute connected route-map REDIS set protocols route-map PERMIT rule 1 action permit set protocols route-map REDIS rule 1 action permit set protocols route-map REDIS rule 1 match interface dum0 After committing, check the mark is applied: .. code-block:: none admin@osdx$ protocols bfd show peers BFD Peers: peer 10.10.0.200 local-address 10.10.0.100 vrf default interface eth1 Mark: 99 Status: up The mark value can be dynamically changed without having to restart the BFD session: .. code-block:: none set protocols bfd profile BFD_MARK mark 200 ToS --- In this example, a BFD profile is configured with ``tos 184`` (EF - Expedited Forwarding) to assign a specific QoS class to BFD packets instead of the default CS6: .. code-block:: none set protocols bfd profile BFD_TOS tos 184 set protocols bgp 10 neighbor peer bfd profile BFD_TOS After committing, verify the ToS is applied: .. code-block:: none admin@osdx$ protocols bfd show peers BFD Peers: peer 10.10.0.200 local-address 10.10.0.100 vrf default interface eth1 ToS: 184 Status: up The ToS value can be dynamically changed without having to restart the BFD session: .. code-block:: none set protocols bfd profile BFD_TOS tos 48 Command Summary =============== .. osdx:cmdtree:: cfg protocols bfd .. osdx:cmdtree:: op protocols bfd show