BFD for Static Routes
Load base.ipv4.and.ipv6.cfg
#IOS-XE
config replace flash:base.ipv4.and.ipv6.cfg
#IOS-XR
configure
load bootflash:base.ipv4.and.ipv6.cfg
commit replace

Configure static routes between R4 and R6 to their IPv4/IPv6 loopbacks via their directly connected interfaces.
If this link goes down, they should use R5.
Use BFD for failure detection.
Simply configure R5 with static routes to the IPv4/IPv6 loopbacks of R4 and R6.
Answer
#R5
ip route 4.4.4.4 255.255.255.255 20.4.5.4
ip route 6.6.6.6 255.255.255.255 20.5.6.6
!
ipv6 route 2001::4:4:4:4/128 2001:20:4:5::4
ipv6 route 2001::6:6:6:6/128 2001:20:5:6::6
#R4
int gi3.46
bfd interval 750 min_rx 750 multiplier 3
!
ip route static bfd gi3.46 20.4.6.6
ip route 6.6.6.6 255.255.255.255 gi2.46 20.4.6.6
ip route 6.6.6.6 255.255.255.255 20.4.5.5 210
!
ipv6 route static bfd gi2.46 2001:20:4:6::6
ipv6 route 2001::6:6:6:6/128 gi2.46 2001:20:4:6::6
ipv6 route 2001::6:6:6:6/128 2001:20:4:5::5 210
#R6
int gi1.46
bfd interval 750 min_rx 750 multiplier 3
!
ip route static bfd gi2.46 20.4.6.4
ip route 4.4.4.4 255.255.255.255 gi2.46 20.4.6.4
ip route 4.4.4.4 255.255.255.255 20.5.6.5 210
!
ipv6 route static bfd gi2.46 2001:20:4:6::4
ipv6 route 2001::4:4:4:4/128 gi2.46 2001:20:4:6::4
ipv6 route 2001::4:4:4:4/128 2001:20:5:6::5 210
Explanation
BFD can also be used for static routes. This is an attractive alternative to using IP SLA, tracking, and associating the tracking with a static route. In this lab, R4 and R6 are directly connected (single-hop), so the echo can be used, which provides for hardware offloading as well.
To use BFD with a static route we need three things:
We need the static route to have both an outgoing interface and nexthop address.
#R4
ip route 6.6.6.6 255.255.255.255 gi2.46 20.4.6.6
!
ipv6 route 2001::6:6:6:6/128 gi2.46 2001:20:4:6::6
#R6
ip route 4.4.4.4 255.255.255.255 gi2.46 20.4.6.4
!
ipv6 route 2001::4:4:4:4/128 gi2.46 2001:20:4:6::4
We need a second command that instructs the router to use BFD for static routes with the matching outgoing interface and nexthop. Essentially, the following commands state “for static routes that have a specified outgoing interface of gi2.46 and nexthop of 20.4.6.6/2001:20:4:6::6, use BFD.” You can also think of this command as replacing the activation of BFD for a given protocol (i.e. “ip ospf bfd”).
#R4
ip route static bfd gi2.46 20.4.6.6
!
ipv6 route static bfd gi2.46 2001:20:4:6::6
#R6
ip route static bfd gi2.46 20.4.6.4
!
ipv6 route static bfd gi2.46 2001:20:4:6::4
We need to activate BFD on the interface as usual, with either the bfd interval command or using a BFD template.
#R4
int gi2.46
bfd interval 750 min_rx 750 multiplier 3
#R6
int gi2.46
bfd interval 750 min_rx 750 multiplier 3
Finally, in this lab we need a floating static route via R5. This will replace the static route to R4/R6 when BFD detects that the neighbor has failed.
#R5
ip route 4.4.4.4 255.255.255.255 20.4.5.4
ip route 6.6.6.6 255.255.255.255 20.5.6.6
!
ipv6 route 2001::4:4:4:4/128 2001:20:4:5::4
ipv6 route 2001::6:6:6:6/128 2001:20:5:6::6
Verification
When using BFD for static routes, there is a sort of “reverse logic” compared to when using BFD with a routing protocol. For instance, OSPF first discovers the neighbor and then tells BFD to form a session with this neighbor. With a static route, the neighbor is essentially maunally specified via the ip route static bfd interface next-hop command. BFD first forms the session, and if it comes up, the static route is installed in the RIB.
On R4 we should see two BFD sessions, one for R6’s IPv4 address and one for R6’s IPv6 address:

As we saw previously for OSPFv3, IPv6 does not support BFD echos:

A handy command to verify the static route is show ip static route. This displays all known static routes, and many more flags than are available in the normal show ip route static command.

Above, we see that 6.6.6.6/32 via Gi2.46 20.4.6.6 is a manually specified static route, is tracked using BFD, and is active. The route via 20.4.5.5 is current not active. If we shut gi2.46 on R6, R4 will remove the static BFD-tracked route, and the floating static will appear in the RIB.

In the show ip static route table, we can now see that the BFD-tracked route is not active.

Similar information is available for IPv6 static routes using show ipv6 static detail:

BFD static route groups
It is worth spending a moment to examine the BFD groups feature for static routes. This allows you to group together multiple BFD peers that share the same fate. If one peer goes down, you may want to mark routes reachable via the other peer as down as well. By grouping these peers together, you only need to run a single BFD session to one peer. If desired, you can run BFD with multiple peers in the group. The passive keyword controls whether you run BFD with the nexthop. When all BFD peers are down in that group, then all routes associated with the group are withdrawn from the RIB.
For example, let’s join R3 and R5 to the VLAN 46 LAN.
#R3
int gi2.46
encap dot1q 46
ip add 20.4.6.3 255.255.255.0
#R5
int gi2.46
encap dot1q 46
ip add 20.4.6.5 255.255.255.0
On R4, we’ll add two more static routes via Gi2.46. We’ll consider R3, R5, and R6 all in the same BFD group. We will not run BFD with R3 or R5. You can only have one peer in the BFD group as active.
#R4
no ip route static bfd gi2.46 20.4.6.6
ip route static bfd gi2.46 20.4.6.6 group GROUP46
ip route static bfd gi2.46 20.4.6.5 group GROUP46 passive
ip route static bfd gi2.46 20.4.6.3 group GROUP46 passive
ip route 6.6.6.6 255.255.255.255 gi2.46 20.4.6.6
ip route 5.5.5.5 255.255.255.255 gi2.46 20.4.6.5
ip route 3.3.3.3 255.255.255.255 gi2.46 20.4.6.3
When BFD is up with R6, all static routes are present in the RIB. Note that R4 only has one single BFD IPv4 session.

When Gi2.46 goes down on R6, all static routes with nexthops in the BFD group go down as well.

Note that this feature appears to only be available for IPv4.
Unassociated
Both IPv4 and IPv6 BFD static route commands have the keyword unassociate available. This appears to just disable BFD for the static route peer.
For example, currently the route to R6’s loopback is via R5 because the BFD peer is down.

If we change the R6 IPv6 BFD peer to be “unassociated” then the static route appears again in the table. I don’t quite understand why you wouldn’t just remove the BFD static route statement in the first place.
#R4
ipv6 route static bfd GigabitEthernet2.46 2001:20:4:6::6 unassociated

Last updated