Configuring OSPF Fault Detection using BFD
Understanding BFD for OSPF
The Bidirectional Forwarding Detection (BFD) protocol is a simple hello mechanism that detects failures in a network. BFD works with a wide variety of network environments and topologies. A pair of routing devices exchange BFD packets. Hello packets are sent at a specified, regular interval. A neighbor failure is detected when the routing device stops receiving a reply after a specified interval. The BFD failure detection timers have shorter time limits than the OSPF failure detection mechanisms, so they provide faster detection.
The BFD failure detection timers are adaptive
and can be adjusted to be faster or slower. The lower the BFD failure
detection timer value, the faster the failure detection and vice versa.
For example, the timers can adapt to a higher value if the adjacency
fails (that is, the timer detects failures more slowly). Or a neighbor
can negotiate a higher value for a timer than the configured value.
The timers adapt to a higher value when a BFD session flap occurs
more than three times in a span of 15 seconds. A back-off algorithm
increases the receive (Rx) interval by two if the local BFD instance
is the reason for the session flap. The transmission (Tx) interval
is increased by two if the remote BFD instance is the reason for the
session flap. You can use the clear bfd adaptation
command
to return BFD interval timers to their configured values. The clear bfd adaptation
command is hitless, meaning that the command
does not affect traffic flow on the routing device.
EX4600 switches do not support minimum interval values of less than 1 second.
BFD is supported for OSPFv3 in Junos OS Release 9.3 and later.
For branch SRX Series Firewalls, we recommend 1000 ms as the minimum keepalive time interval for BFD packets.
You can configure the following BFD protocol settings:
detection-time threshold
—Threshold for the adaptation of the detection time. When the BFD session detection time adapts to a value equal to or greater than the configured threshold, a single trap and a single system log message are sent.full-neighbors-only
—Ability to establish BFD sessions only for OSPF neighbors with full neighbor adjacency. The default behavior is to establish BFD sessions for all OSPF neighbors. This setting is available in Junos OS Release 9.5 and later.minimum-interval
—Minimum transmit and receive interval for failure detection. This setting configures both the minimum interval after which the local routing device transmits hello packets and the minimum interval after which the routing device expects to receive a reply from the neighbor with which it has established a BFD session. Both intervals are in milliseconds. You can also specify the minimum transmit and receive intervals separately using thetransmit-interval minimum-interval
andminimum-receive-interval
statements.Note:BFD is an intensive protocol that consumes system resources. Specifying a minimum interval for BFD of less than 100 ms for Routing Engine-based sessions and 10 ms for distributed BFD sessions can cause undesired BFD flapping.
Depending on your network environment, the following may apply:
For large-scale network deployments with a large number of BFD sessions, specify a minimum interval of no less than 500 ms. An interval of 1000 ms is recommended to avoid any instability issues.
For BFD sessions to remain up during a Routing Engine switchover event when nonstop active routing (NSR) is configured, specify a minimum interval of 2500 ms for Routing Engine-based sessions. Without NSR, Routing Engine-based sessions can have a minimum interval of 100 ms.
-
For distributed BFD sessions with NSR configured, the minimum interval recommendations are unchanged and depend only on your network deployment.
-
Junos OS 21.2R1 and later support distributed OSPFv3 and ISIS BFD sessions with IPv6 link local addresses on MX series routers running MPCs 1 through 9 (it is not supported on MPC 10 or MPC 11). The default for IPv6 link local BFD is inline mode.
-
BFD is not distributed prior to Junos 21.2 (because for OSPFv3, BFD is based in the Routing Engine).
On a single QFX5100 switch, when you add a QFX-EM-4Q expansion module, specify a minimum interval higher than 1000 ms.
minimum-receive-interval
—Minimum receive interval for failure detection. This setting configures the minimum receive interval, in milliseconds, after which the routing device expects to receive a hello packet from a neighbor with which it has established a BFD session. You can also specify the minimum receive interval using theminimum-interval
statement.multiplier
—Multiplier for hello packets. This setting configures the number of hello packets that are not received by a neighbor, which causes the originating interface to be declared down. By default, three missed hello packets cause the originating interface to be declared down.no-adaptation
—Disables BFD adaption. This setting disables BFD sessions from adapting to changing network conditions. This setting is available in Junos OS Release 9.0 and later.Note:We recommend that you do not disable BFD adaptation unless it is preferable not to have BFD adaptation in your network.
transmit-interval minimum-interval
—Minimum transmit interval for failure detection. This setting configures the minimum transmit interval, in milliseconds, at which the local routing device transmits hello packets to the neighbor with which it has established a BFD session. You can also specify the minimum transmit interval using theminimum-interval
statement.transmit-interval threshold
—Threshold for the adaptation of the BFD session transmit interval. When the transmit interval adapts to a value greater than the threshold, a single trap and a single system log message are sent. The threshold value must be greater than the minimum transmit interval. If you attempt to commit a configuration with a threshold value less than the minimum transmit interval, the routing device displays an error and does not accept the configuration.version
—BFD version. This setting configures the BFD version used for detection. You can explicitly configure BFD version 1, or the routing device can automatically detect the BFD version. By default, the routing device automatically detects the BFD version automatically, which is either 0 or 1.
You can also trace BFD operations for troubleshooting purposes.
Example: Configuring BFD for OSPF
This example shows how to configure the Bidirectional Forwarding Detection (BFD) protocol for OSPF.
Requirements
Before you begin:
Configure the device interfaces. See the Junos OS Network Interfaces Library for Routing Devices.
Configure the router identifiers for the devices in your OSPF network. See Example: Configuring an OSPF Router Identifier.
Control OSPF designated router election. See Example: Controlling OSPF Designated Router Election.
Configure a single-area OSPF network. See Example: Configuring a Single-Area OSPF Network.
Configure a multiarea OSPF network. See Example: Configuring a Multiarea OSPF Network.
Configure a multiarea OSPF network. See Example: Configuring a Multiarea OSPF Network.
Overview
An alternative to adjusting the OSPF hello interval and dead interval settings to increase route convergence is to configure BFD. The BFD protocol is a simple hello mechanism that detects failures in a network. The BFD failure detection timers have shorter timer limits than the OSPF failure detection mechanisms, thereby providing faster detection.
BFD is useful on interfaces that are unable to detect failure quickly, such as Ethernet interfaces. Other interfaces, such as SONET interfaces, already have built-in failure detection. Configuring BFD on those interfaces is unnecessary.
You configure BFD on a pair of neighboring OSPF interfaces. Unlike the OSPF hello interval and dead interval settings, you do not have to enable BFD on all interfaces in an OSPF area.
In this example, you enable failure detection by including
the bfd-liveness-detection
statement on the neighbor OSPF
interface fe-0/1/0 in area 0.0.0.0 and configure the BFD
packet exchange interval to 300 milliseconds, configure 4 as
the number of missed hello packets that causes the originating interface
to be declared down, and configure BFD sessions only for OSPF neighbors
with full neighbor adjacency by including the following settings:
full-neighbors-only—In Junos OS Release 9.5 and later, configures the BFD protocol to establish BFD sessions only for OSPF neighbors with full neighbor adjacency. The default behavior is to establish BFD sessions for all OSPF neighbors.
minimum-interval—Configures the minimum interval, in milliseconds, after which the local routing device transmits hello packets as well as the minimum interval after which the routing device expects to receive a reply from the neighbor with which it has established a BFD session. You can configure a number in the range from 1 through 255,000 milliseconds. You can also specify the minimum transmit and receive intervals separately using the transmit-interval minimum-interval and
minimum-receive-interval
statements.Note:BFD is an intensive protocol that consumes system resources. Specifying a minimum interval for BFD of less than 100 ms for Routing Engine-based sessions and 10 ms for distributed BFD sessions can cause undesired BFD flapping.
Depending on your network environment, these additional recommendations might apply:
For large-scale network deployments with a large number of BFD sessions, specify a minimum interval of no less than 500 ms. An interval of 1000 ms is recommended to avoid any instability issues.
Note:For the bfdd process, the detection time interval set is lower than 300 ms. If there is a high priority process such as ppmd running on the system, the CPU might spend time on the ppmd process rather than the bfdd process.
For branch SRX Series Firewalls, we recommend 1000 ms as the minimum keepalive time interval for BFD packets.
For very large-scale network deployments with a large number of BFD sessions, contact Juniper Networks customer support for more information.
For BFD sessions to remain up during a Routing Engine switchover event when nonstop active routing (NSR) is configured, specify a minimum interval of 2500 ms for Routing Engine-based sessions. For distributed BFD sessions with NSR configured, the minimum interval recommendations are unchanged and depend only on your network deployment.
multiplier—Configures the number of hello packets not received by a neighbor that causes the originating interface to be declared down. By default, three missed hello packets cause the originating interface to be declared down. You can configure a value in the range from 1 through 255.
Topology
Configuration
Procedure
CLI Quick Configuration
To quickly configure the BFD protocol for
OSPF, copy the following commands, paste them into a text file, remove
any line breaks, change any details necessary to match your network
configuration, copy and paste the commands into the CLI at the [edit]
hierarchy level, and then enter commit
from configuration
mode.
[edit] set protocols ospf area 0.0.0.0 interface fe-0/0/1 bfd-liveness-detection minimum-interval 300 set protocols ospf area 0.0.0.0 interface fe-0/0/1 bfd-liveness-detection multiplier 4 set protocols ospf area 0.0.0.0 interface fe-0/0/1 bfd-liveness-detection full-neighbors-only
Step-by-Step Procedure
To configure the BFD protocol for OSPF on one neighboring interface:
Create an OSPF area.
Note:To specify OSPFv3, include the
ospf3
statement at the[edit protocols]
hierarchy level.[edit] user@host# edit protocols ospf area 0.0.0.0
Specify the interface.
[edit protocols ospf area 0.0.0.0] user@host# set interface fe-0/0/1
Specify the minimum transmit and receive intervals.
[edit protocols ospf area 0.0.0.0 ] user@host# set interface fe-0/0/1 bfd-liveness-detection minimum-interval 300
Configure the number of missed hello packets that cause the originating interface to be declared down.
[edit protocols ospf area 0.0.0.0 ] user@host# set interface fe-0/0/1 bfd-liveness-detection multiplier 4
Configure BFD sessions only for OSPF neighbors with full neighbor adjacency.
[edit protocols ospf area 0.0.0.0 ] user@host# set interface fe-0/0/1 bfd-liveness-detection full-neighbors-only
If you are done configuring the device, commit the configuration.
[edit protocols ospf area 0.0.0.0 ] user@host# commit
Note:Repeat this entire configuration on the other neighboring interface.
Results
Confirm your configuration by entering the show
protocols ospf
command. If the output does not display the intended
configuration, repeat the instructions in this example to correct
the configuration.
user@host# show protocols ospf area 0.0.0.0 { interface fe-0/0/1.0 { bfd-liveness-detection { minimum-interval 300; multiplier 4; full-neighbors-only; } } }
To confirm your OSPFv3 configuration, enter the show protocols
ospf3
command.
Verification
Confirm that the configuration is working properly.
Verifying the BFD Sessions
Purpose
Verify that the OSPF interfaces have active BFD sessions, and that session components have been configured correctly.
Action
From operational mode, enter the show bfd session detail
command.
Meaning
The output displays information about the BFD sessions.
The Address field displays the IP address of the neighbor.
The Interface field displays the interface you configured for BFD.
The State field displays the state of the neighbor and should show Full to reflect the full neighbor adjacency that you configured.
The Transmit Interval field displays the time interval you configured to send BFD packets.
The Multiplier field displays the multiplier you configured.
Understanding BFD Authentication for OSPF
Bidirectional Forwarding Detection (BFD) enables rapid detection of communication failures between adjacent systems. By default, authentication for BFD sessions is disabled. However, when you run BFD over Network Layer protocols, the risk of service attacks can be significant. We strongly recommend using authentication if you are running BFD over multiple hops or through insecure tunnels. Beginning with Junos OS Release 9.6, Junos OS supports authentication for BFD sessions running over OSPFv2. BFD authentication is not supported on MPLS OAM sessions. BFD authentication is only supported in the Canada and United States version of the Junos OS image and is not available in the export version.
You authenticate BFD sessions by specifying an authentication algorithm and keychain, and then associating that configuration information with a security authentication keychain using the keychain name.
The following sections describe the supported authentication algorithms, security keychains, and level of authentication that can be configured:
BFD Authentication Algorithms
Junos OS supports the following algorithms for BFD authentication:
simple-password—Plain-text password. One to 16 bytes of plain text are used to authenticate the BFD session. One or more passwords can be configured. This method is the least secure and should be used only when BFD sessions are not subject to packet interception.
keyed-md5—Keyed Message Digest 5 hash algorithm for sessions with transmit and receive intervals greater than 100 ms. To authenticate the BFD session, keyed MD5 uses one or more secret keys (generated by the algorithm) and a sequence number that is updated periodically. With this method, packets are accepted at the receiving end of the session if one of the keys matches and the sequence number is greater than or equal to the last sequence number received. Although more secure than a simple password, this method is vulnerable to replay attacks. Increasing the rate at which the sequence number is updated can reduce this risk.
meticulous-keyed-md5—Meticulous keyed Message Digest 5 hash algorithm. This method works in the same manner as keyed MD5, but the sequence number is updated with every packet. Although more secure than keyed MD5 and simple passwords, this method might take additional time to authenticate the session.
keyed-sha-1—Keyed Secure Hash Algorithm I for sessions with transmit and receive intervals greater than 100 ms. To authenticate the BFD session, keyed SHA uses one or more secret keys (generated by the algorithm) and a sequence number that is updated periodically. The key is not carried within the packets. With this method, packets are accepted at the receiving end of the session if one of the keys matches and the sequence number is greater than the last sequence number received.
meticulous-keyed-sha-1—Meticulous keyed Secure Hash Algorithm I. This method works in the same manner as keyed SHA, but the sequence number is updated with every packet. Although more secure than keyed SHA and simple passwords, this method might take additional time to authenticate the session.
Nonstop active routing (NSR) is not supported with the meticulous-keyed-md5 and meticulous-keyed-sha-1 authentication algorithms. BFD sessions using these algorithms might go down after a switchover.
QFX5000 Series switches and EX4600 switches do not support minimum interval values of less than 1 second.
Security Authentication Keychains
The security authentication keychain defines the authentication attributes used for authentication key updates. When the security authentication keychain is configured and associated with a protocol through the keychain name, authentication key updates can occur without interrupting routing and signaling protocols.
The authentication keychain contains one or more keychains. Each keychain contains one or more keys. Each key holds the secret data and the time at which the key becomes valid. The algorithm and keychain must be configured on both ends of the BFD session, and they must match. Any mismatch in configuration prevents the BFD session from being created.
BFD allows multiple clients per session, and each client can have its own keychain and algorithm defined. To avoid confusion, we recommend specifying only one security authentication keychain.
Strict Versus Loose Authentication
By default, strict authentication is enabled and authentication is checked at both ends of each BFD session. Optionally, to smooth migration from nonauthenticated sessions to authenticated sessions, you can configure loose checking. When loose checking is configured, packets are accepted without authentication being checked at each end of the session. This feature is intended for transitional periods only.
Configuring BFD Authentication for OSPF
Beginning with Junos OS Release 9.6, you can configure authentication for BFD sessions running over OSPFv2. Routing instances are also supported.
The following sections provide instructions for configuring and viewing BFD authentication on OSPF:
Configuring BFD Authentication Parameters
Only three steps are needed to configure authentication on a BFD session:
Specify the BFD authentication algorithm for the OSPFv2 protocol.
Associate the authentication keychain with the OSPFv2 protocol.
Configure the related security authentication keychain.
To configure BFD authentication:
BFD authentication is only supported in the Canada and United States version of the Junos OS image and is not available in the export version.
Viewing Authentication Information for BFD Sessions
You can view the existing BFD authentication configuration using
the show bfd session detail
and show bfd session extensive
commands.
The following example shows BFD authentication configured for the if2-ospf BGP group. It specifies the keyed SHA-1 authentication algorithm and a keychain name of bfd-ospf. The authentication keychain is configured with two keys. Key 1 contains the secret data “$ABC123$ABC123” and a start time of June 1, 2009, at 9:46:02 AM PST. Key 2 contains the secret data “$ABC123$ABC123” and a start time of June 1, 2009, at 3:29:20 PM PST.
[edit protocols ospf] area 0.0.0.1 { interface if2-ospf { bfd-liveness-detection { authentication { algorithm keyed-sha-1; key-chain bfd-ospf; } } } } [edit security] authentication key-chains { key-chain bfd-ospf { key 1 { secret “$ABC123$ABC123”; ## SECRET-DATA start-time “2009-6-1.09:46:02 -0700”; } key 2 { secret “$ABC123$ABC123”; start-time “2009-6-1.15:29:20 -0700”; ## SECRET-DATA } } }
If you commit these updates to your configuration, you see output
similar to the following. In the output for the show bfd session
detail
command, Authenticate is displayed to indicate
that BFD authentication is configured.
show bfd session detail
user@host# show bfd session detail Detect Transmit Address State Interface Time Interval Multiplier 10.9.1.33 Up so-7/1/0.0 0.600 0.200 3 Client OSPF, TX interval 0.200, RX interval 0.200, multiplier 3, Authenticate Session up time 3d 00:34 Local diagnostic None, remote diagnostic None Remote state Up, version 1 Replicated 1 sessions, 1 clients Cumulative transmit rate 10.0 pps, cumulative receive rate 10.0 pps
For more information about the configuration, use the show
bfd session extensive
command. The output for this command provides
the keychain name, the authentication algorithm and mode for each
client in the session, and the overall BFD authentication configuration
status, keychain name, and authentication algorithm and mode.
show bfd session extensive
user@host# show bfd session extensive Detect Transmit Address State Interface Time Interval Multiplier 10.9.1.33 Up so-7/1/0.0 0.600 0.200 3 Client OSPF, TX interval 0.200, RX interval 0.200, multiplier 3, Authenticate keychain bfd-ospf, algo keyed-md5, mode loose Session up time 3d 00:34 Local diagnostic None, remote diagnostic None Remote state Up, version 1 Replicated Min async interval 0.200, min slow interval 1.000 Adaptive async tx interval 0.200, rx interval 0.200 Local min tx interval 0.200, min rx interval 0.200, multiplier 3 Remote min tx interval 0.100, min rx interval 0.100, multiplier 3 Threshold transmission interval 0.000, Threshold for detection time 0.000 Local discriminator 11, remote discriminator 80 Echo mode disabled/inactive Authentication enabled/active, keychain bfd-ospf, algo keyed-sha-1, mode strict 1 sessions, 1 clients Cumulative transmit rate 10.0 pps, cumulative receive rate 10.0 pps