Supported Platforms
Related Documentation
- ACX, EX, M, MX, T Series, QFabric System, QFX Series standalone switches
- Example: Configuring BFD Authentication for Static Routes
- ACX, M, MX, T Series, QFabric System, QFX Series standalone switches
- Example: Configuring BFD for OSPF
- Example: Configuring BFD for BGP
- ACX, J, M, MX, SRX, T Series
- Example: Configuring BFD for IS-IS
- EX, M, MX, T Series
- Configuring PIM and the Bidirectional Forwarding Detection (BFD) Protocol
Examples: Configuring BFD for Static Routes
Understanding BFD for Static Routes
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 exchanges 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 static route 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.
By default, BFD is supported on single-hop static routes. In Junos OS Release 8.2 and later, BFD also supports multihop static routes.
To enable failure detection, include the bfd-liveness-detection statement in the static route configuration.
In Junos OS Release 9.1 and later, the BFD protocol is supported for IPv6 static routes. Global unicast and link-local IPv6 addresses are supported for static routes. The BFD protocol is not supported on multicast or anycast IPv6 addresses. For IPv6, the BFD protocol supports only static routes and only in Junos OS Release 9.3 and later. IPv6 for BFD is not supported for any other protocol.
To configure the BFD protocol for IPv6 static routes, include the bfd-liveness-detection statement at the [edit routing-options rib inet6.0 static route destination-prefix] hierarchy level.
In Junos OS Release 8.5 and later, you can configure a hold-down interval to specify how long the BFD session must remain up before a state change notification is sent.
To specify the hold-down interval, include the holddown-interval statement in the BFD configuration.
You can configure a number in the range from 0 through 255,000 milliseconds. The default is 0. If the BFD session goes down and then comes back up during the hold-down interval, the timer is restarted.
![]() | Note: If a single BFD session includes multiple static routes, the hold-down interval with the highest value is used. |
To specify the minimum transmit and receive intervals for failure detection, include the minimum-interval statement in the BFD configuration.
This value represents 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. You can configure a number in the range from 1 through 255,000 milliseconds. Optionally, instead of using this statement, you can configure 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:
|
![]() | Note: SRX Series devices do not support distributed BFD. |
To specify the minimum receive interval for failure detection, include the minimum-receive-interval statement in the BFD configuration. This value represents the minimum interval after which the routing device expects to receive a reply from a neighbor with which it has established a BFD session. You can configure a number in the range from 1 through 255,000 milliseconds. Optionally, instead of using this statement, you can configure the minimum receive interval using the minimum-interval statement at the [edit routing-options static route destination-prefix bfd-liveness-detection] hierarchy level.
To specify the number of hello packets not received by the neighbor that causes the originating interface to be declared down, include the multiplier statement in the BFD configuration.
The default value is 3. You can configure a number in the range from 1 through 255.
To specify a threshold for detecting the adaptation of the detection time, include the threshold statement in the BFD configuration.
When the BFD session detection time adapts to a value equal to or higher than the threshold, a single trap and a system log message are sent. The detection time is based on the multiplier of the minimum-interval or the minimum-receive-interval value. The threshold must be a higher value than the multiplier for either of these configured values. For example if the minimum-receive-interval is 300 ms and the multiplier is 3, the total detection time is 900 ms. Therefore, the detection time threshold must have a value higher than 900.
To specify the minimum transmit interval for failure detection, include the transmit-interval minimum-interval statement in the BFD configuration.
This value represents the minimum interval after which the local routing device transmits hello packets to the neighbor with which it has established a BFD session. You can configure a value in the range from 1 through 255,000 milliseconds. Optionally, instead of using this statement, you can configure the minimum transmit interval using the minimum-interval statement at the [edit routing-options static route destination-prefix bfd-liveness-detection] hierarchy level.
To specify the threshold for the adaptation of the transmit interval, include the transmit-interval threshold statement in the BFD configuration.
The threshold value must be greater than the transmit interval. When the BFD session transmit time adapts to a value greater than the threshold, a single trap and a system log message are sent. The detection time is based on the multiplier of the value for the minimum-interval or the minimum-receive-interval statement at the [edit routing-options static route destination-prefix bfd-liveness-detection] hierarchy level. The threshold must be a higher value than the multiplier for either of these configured values.
To specify the BFD version, include the version statement in the BFD configuration. The default is to have the version detected automatically.
To include an IP address for the next hop of the BFD session, include the neighbor statement in the BFD configuration.
![]() | Note: You must configure the neighbor statement if the next hop specified is an interface name. If you specify an IP address as the next hop, that address is used as the neighbor address for the BFD session. |
In Junos OS Release 9.0 and later, you can configure BFD sessions not to adapt to changing network conditions.
To disable BFD adaptation, include the no-adaptation statement in the BFD configuration.
![]() | Note: We recommend that you not disable BFD adaptation unless it is preferable not to have BFD adaptation in your network. |
![]() | Note: If BFD is configured only on one end of a static route, the route is removed from the routing table. BFD establishes a session when BFD is configured on both ends of the static route. BFD is not supported on ISO address families in static routes. BFD does support IS-IS. If you configure graceful Routing Engine switchover (GRES) at the same time as BFD, GRES does not preserve the BFD state information during a failover. |
Junos OS also supports BFD over multihop static routes. For example, you can configure BFD over a Layer 3 path to provide path integrity over that path. You can limit the number of hops by specifying the time to live (TTL).
To configure BFD over multihop static routes, include the following statements:
To specify the source address for the multihop static route and to enable multihop BFD support, include the local-address statement.
To specify the number of hops, include the minimum-receive-ttl statement. You must configure this statement for a multihop BFD session. You can configure a value in the range from 1 through 255. It is optional for a single-hop BFD session. If you configure the minimum-receive-ttl statement for a single-hop session, the value must be 255.
On M Series and T Series platforms only, starting in Junos OS Release 12.3, multihop BFD runs on the CPU in the FPC, DPC, or MPC. This is referred to as distributed BFD. Previously, multihop BFD ran from the Routing Engine.
Example: Configuring BFD for Static Routes
This example shows how to configure Bidirectional Forwarding Detection (BFD) for static routes.
Requirements
In this example, no special configuration beyond device initialization is required.
Overview
There are many practical applications for static routes. Static routing is often used at the network edge to support attachment to stub networks, which, given their single point of entry and egress, are well suited to the simplicity of a static route. In Junos OS, static routes have a global preference of 5. Static routes are activated if the specified next hop is reachable.
In this example, you configure the static route 192.168.47.0/24 from the provider network to the customer network, using the next-hop address of 172.16.1.2. You also configure a static default route of 0.0.0.0/0 from the customer network to the provider network, using a next-hop address of 172.16.1.1.
For demonstration purposes, some loopback interfaces are configured on Device B and Device D. These loopback interfaces provide addresses to ping and thus verify that the static routes are working.
Figure 1 shows the sample network.
Figure 1: Customer Routes Connected to a Service Provider

Configuration
CLI Quick Configuration
To quickly configure this example, copy the following commands, paste them into a text file, remove any line breaks, change any details necessary to match your network configuration, and then copy and paste the commands into the CLI at the [edit] hierarchy level.
Device B
Device D
Step-by-Step Procedure
The following example requires that you navigate various levels in the configuration hierarchy. For information about navigating the CLI, see Using the CLI Editor in Configuration Mode in the CLI User Guide.
To configure BFD for static routes:
- On Device B, configure the interfaces.[edit interfaces]user@B# set ge-1/2/0 unit 0 description B->Duser@B# set ge-1/2/0 unit 0 family inet address 172.16.1.1/24user@B# set lo0 unit 57 family inet address 10.0.0.1/32user@B# set lo0 unit 57 family inet address 10.0.0.2/32
- On Device B, create a static route and set the next-hop
address.[edit routing-options]user@B# set static route 192.168.47.0/24 next-hop 172.16.1.2
- On Device B, configure BFD for the static route.[edit routing-options]user@B# set static route 192.168.47.0/24 bfd-liveness-detection minimum-interval 1000
- On Device B, configure tracing operations for BFD.
- If you are done configuring Device B, commit the configuration.[edit]user@B# commit
- On Device D, configure the interfaces.[edit interfaces]user@D# set ge-1/2/0 unit 1 description D->Buser@D# set ge-1/2/0 unit 1 family inet address 172.16.1.2/24user@D# set lo0 unit 2 family inet address 192.168.47.5/32user@D# set lo0 unit 2 family inet address 192.168.47.6/32
- On Device D, create a static route and set the next-hop
address.[edit routing-options]user@D# set static route 0.0.0.0/0 next-hop 172.16.1.1
- On Device D, configure BFD for the static route.[edit routing-options]user@D# set static route 0.0.0.0/0 bfd-liveness-detection minimum-interval 1000
- On Device D, configure tracing operations for BFD.[edit protocols]user@D# set bfd traceoptions file bfd-trace user@D# set bfd traceoptions flag all
- If you are done configuring Device D, commit the configuration.[edit]user@D# commit
Results
Confirm your configuration by issuing the show interfaces, show protocols, and show routing-options commands. If the output does not display the intended configuration, repeat the instructions in this example to correct the configuration.
Device B
Device D
Verification
Confirm that the configuration is working properly.
Verifying That BFD Sessions Are Up
Purpose
Verify that the BFD sessions are up, and view details about the BFD sessions.
Action
From operational mode, enter the show bfd session extensive command.
user@B> show bfd session extensive
Detect Transmit Address State Interface Time Interval Multiplier 172.16.1.2 Up lt-1/2/0.0 3.000 1.000 3 Client Static, TX interval 1.000, RX interval 1.000 Session up time 00:14:30 Local diagnostic None, remote diagnostic None Remote state Up, version 1 Replicated, routing table index 172 Min async interval 1.000, min slow interval 1.000 Adaptive async TX interval 1.000, RX interval 1.000 Local min TX interval 1.000, minimum RX interval 1.000, multiplier 3 Remote min TX interval 1.000, min RX interval 1.000, multiplier 3 Local discriminator 2, remote discriminator 1 Echo mode disabled/inactive 1 sessions, 1 clients Cumulative transmit rate 1.0 pps, cumulative receive rate 1.0 pps
user@D> show bfd session extensive
Detect Transmit Address State Interface Time Interval Multiplier 172.16.1.1 Up lt-1/2/0.1 3.000 1.000 3 Client Static, TX interval 1.000, RX interval 1.000 Session up time 00:14:35 Local diagnostic None, remote diagnostic None Remote state Up, version 1 Replicated, routing table index 170 Min async interval 1.000, min slow interval 1.000 Adaptive async TX interval 1.000, RX interval 1.000 Local min TX interval 1.000, minimum RX interval 1.000, multiplier 3 Remote min TX interval 1.000, min RX interval 1.000, multiplier 3 Local discriminator 1, remote discriminator 2 Echo mode disabled/inactive 1 sessions, 1 clients Cumulative transmit rate 1.0 pps, cumulative receive rate 1.0 pps
Meaning
The TX interval 1.000, RX interval 1.000 output represents the setting configured with the minimum-interval statement. All of the other output represents the default settings for BFD. To modify the default settings, include the optional statements under the bfd-liveness-detection statement.
Viewing Detailed BFD Events
Purpose
View the contents of the BFD trace file to assist in troubleshooting, if needed.
Action
From operational mode, enter the file show /var/log/bfd-trace command.
user@B> file show /var/log/bfd-trace
Nov 23 14:26:55 Data (9) len 35: (hex) 42 46 44 20 70 65 72 69 6f 64 69 63 20 78 6d 69 74 20 72 Nov 23 14:26:55 PPM Trace: BFD periodic xmit rt tbl index 172 Nov 23 14:26:55 Received Downstream TraceMsg (22) len 108: Nov 23 14:26:55 IfIndex (3) len 4: 0 Nov 23 14:26:55 Protocol (1) len 1: BFD Nov 23 14:26:55 Data (9) len 83: (hex) 70 70 6d 64 5f 62 66 64 5f 73 65 6e 64 6d 73 67 20 3a 20 Nov 23 14:26:55 PPM Trace: ppmd_bfd_sendmsg : socket 12 len 24, ifl 78 src 172.16.1.1 dst 172.16.1.2 errno 65 Nov 23 14:26:55 Received Downstream TraceMsg (22) len 93: Nov 23 14:26:55 IfIndex (3) len 4: 0 Nov 23 14:26:55 Protocol (1) len 1: BFD Nov 23 14:26:55 Data (9) len 68: (hex) 42 46 44 20 70 65 72 69 6f 64 69 63 20 78 6d 69 74 20 74
Meaning
BFD messages are being written to the trace file.
Example: Enabling BFD on Qualified Next Hops in Static Routes
This example shows how to configure a static route with multiple possible next hops. Each next hop has Bidirectional Forwarding Detection (BFD) enabled.
Requirements
In this example, no special configuration beyond device initialization is required.
Overview
In this example, Device B has the static route 192.168.47.0/24 with two possible next hops. The two next hops are defined using two qualified-next-hop statements. Each next hop has BFD enabled.
BFD is also enabled on Device D because BFD must be enabled on both ends of the connection.
A next hop is included in the routing table if the BFD session is up. The next hop is removed from the routing table if the BFD session is down.
See Figure 2.
Figure 2: BFD Enabled on Qualified Next Hops

Configuration
CLI Quick Configuration
To quickly configure this example, copy the following commands, paste them into a text file, remove any line breaks, change any details necessary to match your network configuration, and then copy and paste the commands into the CLI at the [edit] hierarchy level.
Device B
Device D
Step-by-Step Procedure
The following example requires that you navigate various levels in the configuration hierarchy. For instructions on how to do that, see Using the CLI Editor in Configuration Mode in the CLI User Guide.
To configure a static route with two possible next hops, both with BFD enabled:
- On Device B, configure the interfaces.[edit interfaces fe-0/1/0]user@B# set unit 2 description secondary-B->Duser@B# set unit 2 family inet address 192.168.2.1/24
[edit interfaces ge-1/2/0]user@B# set unit 0 description B->Duser@B# set unit 0 family inet address 172.16.1.1/24 - On Device B, configure the static route with two next
hops, both with BFD enabled.[edit routing-options static route 192.168.47.0/24]user@B# set qualified-next-hop 192.168.2.2 bfd-liveness-detection minimum-interval 60user@B# set qualified-next-hop 172.16.1.2 bfd-liveness-detection minimum-interval 60
- On Device D, configure the interfaces.[edit interfaces fe-0/1/0]user@D# set unit 3 description secondary-D->Buser@D# set unit 3 family inet address 192.168.2.2/24
[edit interfaces ge-1/2/0]user@D# set unit 1 description D->Buser@D# set unit 1 family inet address 172.16.1.2/24 - On Device D, configure a BFD-enabled default static route
with two next hops to the provider network.
In this case, BFD is enabled on the route, not on the next hops.
[edit routing-options static route 0.0.0.0/0]user@D# set qualified-next-hop 192.168.2.1user@D# set qualified-next-hop 172.16.1.1user@D# set bfd-liveness-detection minimum-interval 60
Results
Confirm your configuration by issuing the show interfaces and show routing-options commands. If the output does not display the intended configuration, repeat the instructions in this example to correct the configuration.
If you are done configuring the devices, enter commit from configuration mode.
Verification
Confirm that the configuration is working properly.
- Checking the Routing Tables
- Verifying the BFD Sessions
- Removing BFD from Device D
- Removing BFD from One Next Hop
Checking the Routing Tables
Purpose
Make sure that the static route appears in the routing table on Device B with two possible next hops.
Action
user@B> show route 192.168.47.0 extensive
inet.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden) 192.168.47.0/24 (1 entry, 1 announced) TSI: KRT in-kernel 192.168.47.0/24 -> {192.168.2.2} *Static Preference: 5 Next hop type: Router Address: 0x9334010 Next-hop reference count: 1 Next hop: 172.16.1.2 via ge-1/2/0.0 Next hop: 192.168.2.2 via fe-0/1/0.2, selected State: <Active Int Ext> Age: 9 Task: RT Announcement bits (1): 3-KRT AS path: I
Meaning
Both next hops are listed. The next hop 192.168.2.2 is the selected route.
Verifying the BFD Sessions
Purpose
Make sure that the BFD sessions are up.
Action
user@B> show bfd session
Detect Transmit Address State Interface Time Interval Multiplier 172.16.1.2 Up ge-1/2/0.0 0.720 0.240 3 192.168.2.2 Up fe-0/1/0.2 0.720 0.240 3 2 sessions, 2 clients Cumulative transmit rate 8.3 pps, cumulative receive rate 8.3 pps
Meaning
The output shows that the BFD sessions are up.
Removing BFD from Device D
Purpose
Demonstrate what happens when the BFD session is down for both next hops.
Action
- Deactivate BFD on Device D.[edit routing-options static route 0.0.0.0/0]user@D# deactivate bfd-liveness-detectionuser@D# commit
- Rerun the show bfd session command on Device
B.
user@B> show bfd session
Detect Transmit Address State Interface Time Interval Multiplier 172.16.1.2 Down ge-1/2/0.0 3.000 1.000 3 192.168.2.2 Down fe-0/1/0.2 3.000 1.000 3 2 sessions, 2 clients Cumulative transmit rate 2.0 pps, cumulative receive rate 2.0 pps
- Rerun the show route 192.168.47.0 command on
Device B.
user@B> show route 192.168.47.0
Meaning
As expected, when the BFD sessions are down, the static route is removed from the routing table.
Removing BFD from One Next Hop
Purpose
Demonstrate what happens when only one next hop has BFD enabled.
Action
- If it is not already deactivated, deactivate BFD on Device
D.[edit routing-options static route 0.0.0.0/0]user@D# deactivate bfd-liveness-detectionuser@D# commit
- Deactivate BFD on one of the next hops on Device B.[edit routing-options static route 192.168.47.0/24 qualified-next-hop 172.16.1.2]user@B# deactivate bfd-liveness-detectionuser@B# commit
- Rerun the show bfd session command on Device
B.
user@B> show bfd session
Detect Transmit Address State Interface Time Interval Multiplier 192.168.2.2 Down fe-0/1/0.2 3.000 1.000 3
- Rerun the show route 192.168.47.0 extensive command on Device B.
user@B> show route 192.168.47.0 extensive
inet.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden) 192.168.47.0/24 (1 entry, 1 announced) TSI: KRT in-kernel 192.168.47.0/24 -> {172.16.1.2} *Static Preference: 5 Next hop type: Router, Next hop index: 624 Address: 0x92f0178 Next-hop reference count: 3 Next hop: 172.16.1.2 via ge-1/2/0.0, selected State: <Active Int Ext> Age: 2:36 Task: RT Announcement bits (1): 3-KRT AS path: I
Meaning
As expected, the BFD session is down for the 192.168.2.2 next hop. The 172.16.1.2 next hop remains in the routing table, and the route remains active, because BFD is not a condition for this next hop to remain valid.
Related Documentation
- ACX, EX, M, MX, T Series, QFabric System, QFX Series standalone switches
- Example: Configuring BFD Authentication for Static Routes
- ACX, M, MX, T Series, QFabric System, QFX Series standalone switches
- Example: Configuring BFD for OSPF
- Example: Configuring BFD for BGP
- ACX, J, M, MX, SRX, T Series
- Example: Configuring BFD for IS-IS
- EX, M, MX, T Series
- Configuring PIM and the Bidirectional Forwarding Detection (BFD) Protocol
Published: 2014-06-30
Supported Platforms
Related Documentation
- ACX, EX, M, MX, T Series, QFabric System, QFX Series standalone switches
- Example: Configuring BFD Authentication for Static Routes
- ACX, M, MX, T Series, QFabric System, QFX Series standalone switches
- Example: Configuring BFD for OSPF
- Example: Configuring BFD for BGP
- ACX, J, M, MX, SRX, T Series
- Example: Configuring BFD for IS-IS
- EX, M, MX, T Series
- Configuring PIM and the Bidirectional Forwarding Detection (BFD) Protocol