Juniper BFD configuration examples.

BFD is not a very complicated protocol and the Juniper implementation and configuration is rather straightforward.

The only thing besides the configuration that is worth mentioning here is that in Juniper there is a non-distributed and a distributed BFD. Non-distributed BFD runs on the routing-engine and distributed BFD runs on the packet-forwarding engine. Needless to say that you can push the timers for distributed BFD a lot lower than those for non-distributed BFD.

Finding out what Juniper devices offer distributed BFD support is something really worth checking out. It can vary per platform and per Junos release. Take an MX480 for example. OSPFv2 BFD runs on the packet-forwarding engine and OSPFv3 runs on the routing engine. BGP multihop BFD prior to release 12.3 runs on the routing-engine and starting release 12.3 it runs in the packet-forwarding engine.

Another thing worth noting is that Juniper SRX’s do not offer any distributed BFD whatsoever.

Up next are some configuration examples to configure BFD for:

    • OSPF and OSPF3
    • an RSVP signaled LSP
    • ISIS and multihop BGP
    • a static route

At the end, you will also find a RE filter example for BFD.

All configuration and output listed below is from an MX series router.



BFD on OSPF and OSPF3.

In this example, BFD is used to detect failures between two OSPF neighbors.



scenario


Between the Gaius and the Commodus router, there is an active OSPF and an active OSPFv3 neighbor relationship. Both of these relationships have BFD enabled for faster failure detection.

The configuration for this setup:

Gaius:
 
set interfaces xe-0/3/0 unit 8 description COMMODUS
set interfaces xe-0/3/0 unit 8 vlan-id 8
set interfaces xe-0/3/0 unit 8 family inet mtu 1500
set interfaces xe-0/3/0 unit 8 family inet address 2.0.0.29/30
set interfaces xe-0/3/0 unit 8 family iso
set interfaces xe-0/3/0 unit 8 family inet6 mtu 1500
set interfaces xe-0/3/0 unit 8 family inet6 address 2001:2:29::/64 eui-64
set interfaces xe-0/3/0 unit 8 family inet6 address fe80::0008:0000:0000:0003/64
set interfaces lo0 unit 3 family inet address 1.1.1.3/32
set interfaces lo0 unit 3 family inet6 address 2001::3/128
set protocols ospf area 0.0.0.0 interface xe-0/3/0.8 bfd-liveness-detection minimum-interval 100
set protocols ospf area 0.0.0.0 interface xe-0/3/0.8 bfd-liveness-detection multiplier 3
set protocols ospf3 area 0.0.0.0 interface xe-0/3/0.8 bfd-liveness-detection minimum-interval 100
set protocols ospf3 area 0.0.0.0 interface xe-0/3/0.8 bfd-liveness-detection multiplier 3
                
Commodus:
 
set interfaces xe-0/2/0 unit 8 description GAIUS
set interfaces xe-0/2/0 unit 8 vlan-id 8
set interfaces xe-0/2/0 unit 8 family inet mtu 1500
set interfaces xe-0/2/0 unit 8 family inet address 2.0.0.30/30
set interfaces xe-0/2/0 unit 8 family iso
set interfaces xe-0/2/0 unit 8 family inet6 mtu 1500
set interfaces xe-0/2/0 unit 8 family inet6 address 2001:2:29::/64 eui-64
set interfaces xe-0/2/0 unit 8 family inet6 address fe80::0008:0000:0000:0004/64
set interfaces lo0 unit 4 family inet address 1.1.1.4/32
set interfaces lo0 unit 4 family inet6 address 2001::4/128
set protocols ospf area 0.0.0.0 interface xe-0/2/0.8 bfd-liveness-detection minimum-interval 100
set protocols ospf area 0.0.0.0 interface xe-0/2/0.8 bfd-liveness-detection multiplier 3
set protocols ospf3 area 0.0.0.0 interface xe-0/2/0.8 bfd-liveness-detection minimum-interval 100
set protocols ospf3 area 0.0.0.0 interface xe-0/2/0.8 bfd-liveness-detection multiplier 3 
                

After the configuration is applied, the following can be observed: Note, the BFD session for OSPFv2 is showing 'Remote is control-plane independent' and the BFD session for OSPFv3 is not. This tells us that OSPFv2 is in distributed mode and that BFD for OSPFv3 is non-distributed.

 
play@MX480-TEST:GAIUS> show bfd session extensive
                                                  Detect   Transmit
Address                  State     Interface      Time     Interval  Multiplier
2.0.0.30                 Up        xe-0/3/0.8     0.300     0.100        3
 Client OSPF realm ospf-v2 Area 0.0.0.0, TX interval 0.100, RX interval 0.100
 Session up time 00:06:10
 Local diagnostic None, remote diagnostic None
 Remote state Up, version 1
 Logical system 8, routing table index 39
 Min async interval 0.100, min slow interval 1.000
 Adaptive async TX interval 0.100, RX interval 0.100
 Local min TX interval 0.100, minimum RX interval 0.100, multiplier 3
 Remote min TX interval 0.100, min RX interval 0.100, multiplier 3
 Local discriminator 389, remote discriminator 388
 Echo mode disabled/inactive
 Remote is control-plane independent
  Session ID: 0x400102

                                                  Detect   Transmit
Address                  State     Interface      Time     Interval  Multiplier
fe80::8:0:0:4            Up        xe-0/3/0.8     0.300     0.100        3
 Client OSPF realm ipv6-unicast Area 0.0.0.0, TX interval 0.100, RX interval 0.100
 Session up time 00:05:34
 Local diagnostic NbrSignal, remote diagnostic NbrSignal
 Remote state Up, version 1
 Logical system 8, routing table index 39
 Min async interval 0.100, min slow interval 1.000
 Adaptive async TX interval 0.100, RX interval 0.100
 Local min TX interval 0.100, minimum RX interval 0.100, multiplier 3
 Remote min TX interval 0.100, min RX interval 0.100, multiplier 3
 Local discriminator 390, remote discriminator 391
 Echo mode disabled/inactive Session ID: 0x400103

2 sessions, 2 clients
Cumulative transmit rate 20.0 pps, cumulative receive rate 20.0 pps
                


BFD on an RSVP signaled LSP:

Continuing with the previous two routers, let’s enable BFD to enable a fast failure detection across an LSP:



scenario


Gaius:
 
set  interfaces xe-0/3/0 unit 8 family mpls
set  protocols rsvp interface xe-0/3/0.8
set  protocols mpls interface xe-0/3/0.8
set  protocols ospf traffic-engineering
set protocols mpls label-switched-path to_Commodus to 1.1.1.4
set protocols mpls label-switched-path to_Commodus oam bfd-liveness-detection version automatic
set protocols mpls label-switched-path to_Commodus oam bfd-liveness-detection minimum-interval 100
set protocols mpls label-switched-path to_Commodus oam bfd-liveness-detection multiplier 3
set protocols mpls label-switched-path to_Commodus oam bfd-liveness-detection failure-action teardown
                
Commodus:
 
set  interfaces xe-0/2/0 unit 8 family mpls
set  protocols rsvp interface xe-0/2/0.8
set  protocols mpls interface xe-0/2/0.8
set  protocols ospf traffic-engineering
set protocols mpls label-switched-path to_Gaius to 1.1.1.3
set protocols mpls label-switched-path to_Gaius oam bfd-liveness-detection version automatic
set protocols mpls label-switched-path to_Gaius oam bfd-liveness-detection minimum-interval 100
set protocols mpls label-switched-path to_Gaius oam bfd-liveness-detection multiplier 3
set protocols mpls label-switched-path to_Gaius oam bfd-liveness-detection failure-action teardown
                

Let’s verify the configuration. Notice the ‘OAM state : BFD session up LSP-ping up’ under ‘show mpls lsp extensive’:

 
play@MX480-TEST:GAIUS> show mpls lsp extensive | no-more
Ingress LSP: 1 sessions

1.1.1.4
  From: 1.1.1.3, State: Up, ActiveRoute: 0, LSPname: to_Commodus
  ActivePath:  (primary)
  LSPtype: Static Configured, Penultimate hop popping
  LoadBalance: Random
  Encoding type: Packet, Switching type: Packet, GPID: IPv4
 *Primary                    State: Up
    Priorities: 7 0
    SmartOptimizeTimer: 180
    Computed ERO (S [L] denotes strict [loose] hops): (CSPF metric: 1)
 2.0.0.30 S
    Received RRO (ProtectionFlag 1=Available 2=InUse 4=B/W 8=Node 10=SoftPreempt 20=Node-ID):
          2.0.0.30
    OAM state : BFD session up  LSP-ping up
    5 Jan  9 22:33:23.838 Selected as active path
    4 Jan  9 22:33:23.834 Record Route:  2.0.0.30
    3 Jan  9 22:33:23.830 Up
    2 Jan  9 22:33:23.746 Originate Call
    1 Jan  9 22:33:23.746 CSPF: computation result accepted  2.0.0.30
  Created: Fri Jan  9 22:30:57 2015
Total 1 displayed, Up 1, Down 0

Egress LSP: 1 sessions

1.1.1.3
  From: 1.1.1.4, LSPstate: Up, ActiveRoute: 0
  LSPname: to_Gaius, LSPpath: Primary
  Suggested label received: -, Suggested label sent: -
  Recovery label received: -, Recovery label sent: -
  Resv style: 1 FF, Label in: 3, Label out: -
  Time left:  137, Since: Fri Jan  9 22:36:22 2015
  Tspec: rate 0bps size 0bps peak Infbps m 20 M 1500
  Port number: sender 1 receiver 18288 protocol 0
  PATH rcvfrom: 2.0.0.30 (xe-0/3/0.8) 19 pkts
  Adspec: received MTU 1500
  PATH sentto: localclient
  RESV rcvfrom: localclient
  Record route: 2.0.0.30 <self>
Total 1 displayed, Up 1, Down 0

Transit LSP: 0 sessions
Total 0 displayed, Up 0, Down 0

play@MX480-TEST:GAIUS> show bfd session extensive

                                                  Detect   Transmit
Address                  State     Interface      Time     Interval  Multiplier
127.0.0.1                Up        xe-0/3/0.8     0.300     0.100        3
 Client RSVP-OAM, TX interval 0.100, RX interval 0.100
 Session up time 00:11:26
 Local diagnostic NbrSignal, remote diagnostic None
 Remote state Up, version 1
 Logical system 8, routing table index 39
 Min async interval 0.100, min slow interval 1.000
 Adaptive async TX interval 0.100, RX interval 0.100
 Local min TX interval 0.100, minimum RX interval 0.100, multiplier 3
 Remote min TX interval 0.050, min RX interval 0.050, multiplier 3
 Local discriminator 392, remote discriminator 393
 Echo mode disabled/inactive
 LSP-Name to_Commodus
  Session ID: 0x400104

                                                  Detect   Transmit
Address                  State     Interface      Time     Interval  Multiplier
1.1.1.4                  Up                       0.300     0.100        3
 Client RSVP-OAM, TX interval 0.050, RX interval 0.050
 Session up time 00:10:22
 Local diagnostic None, remote diagnostic NbrSignal
 Remote state Up, version 1
 Logical system 8, routing table index 39
 Min async interval 0.050, min slow interval 1.000
 Adaptive async TX interval 0.050, RX interval 0.050
 Local min TX interval 0.050, minimum RX interval 0.050, multiplier 3
 Remote min TX interval 0.100, min RX interval 0.100, multiplier 3
 Local discriminator 395, remote discriminator 394
 Echo mode disabled/inactive
 LSP-Name to_Gaius
 Egress
  Session ID: 0x400105

4 sessions, 4 clients
Cumulative transmit rate 40.0 pps, cumulative receive rate 40.0 pps
                


BFD on ISIS and multihop BGP:



scenario


In this example, ISIS is running between Romulus and Remus enabling IP connectivity between their loopback interfaces. This enables the configuration of 2 EBGP multihop sessions between the two routers. One BGP session for IPv4 and another one for IPv6. BFD is configured for both ISIS and BGP:

Remus:
 
set interfaces xe-0/3/0 unit 1 description ROMULUS
set interfaces xe-0/3/0 unit 1 vlan-id 1
set interfaces xe-0/3/0 unit 1 family inet mtu 1500
set interfaces xe-0/3/0 unit 1 family inet address 2.0.0.1/30
set interfaces xe-0/3/0 unit 1 family iso
set interfaces xe-0/3/0 unit 1 family inet6 mtu 1500
set interfaces xe-0/3/0 unit 1 family inet6 address 2001:2:1::/64 eui-64
set interfaces xe-0/3/0 unit 1 family inet6 address fe80::0001:0000:0000:0004/64
set interfaces lo0 unit 5 family inet address 1.1.1.5/32
set interfaces lo0 unit 5 family iso address 49.0555.0000.0000.0005.00
set interfaces lo0 unit 5 family inet6 address 2001::5/128
set protocols bgp group ebgp neighbor 1.1.1.6 multihop ttl 1
set protocols bgp group ebgp neighbor 1.1.1.6 local-address 1.1.1.5
set protocols bgp group ebgp neighbor 1.1.1.6 peer-as 2
set protocols bgp group ebgp neighbor 1.1.1.6 bfd-liveness-detection version 1
set protocols bgp group ebgp neighbor 1.1.1.6 bfd-liveness-detection minimum-interval 100
set protocols bgp group ebgp neighbor 1.1.1.6 bfd-liveness-detection multiplier 3
set protocols bgp group ebgp-v6 neighbor 2001::6 multihop ttl 1
set protocols bgp group ebgp-v6 neighbor 2001::6 local-address 2001::5
set protocols bgp group ebgp-v6 neighbor 2001::6 peer-as 2
set protocols bgp group ebgp-v6 neighbor 2001::6 bfd-liveness-detection version 1
set protocols bgp group ebgp-v6 neighbor 2001::6 bfd-liveness-detection minimum-interval 100
set protocols bgp group ebgp-v6 neighbor 2001::6 bfd-liveness-detection multiplier 3
set protocols isis interface xe-0/3/0.1 point-to-point
set protocols isis interface xe-0/3/0.1 bfd-liveness-detection version 1
set protocols isis interface xe-0/3/0.1 bfd-liveness-detection minimum-interval 100
set protocols isis interface xe-0/3/0.1 bfd-liveness-detection multiplier 3
set protocols isis interface lo0.5
set routing-options autonomous-system 1
                
Romulus:
 
set interfaces xe-0/2/0 unit 1 description REMUS
set interfaces xe-0/2/0 unit 1 vlan-id 1
set interfaces xe-0/2/0 unit 1 family inet mtu 1500
set interfaces xe-0/2/0 unit 1 family inet address 2.0.0.2/30
set interfaces xe-0/2/0 unit 1 family iso
set interfaces xe-0/2/0 unit 1 family inet6 mtu 1500
set interfaces xe-0/2/0 unit 1 family inet6 address 2001:2:1::/64 eui-64
set interfaces xe-0/2/0 unit 1 family inet6 address fe80::0001:0000:0000:0006/64
set interfaces lo0 unit 6 family inet address 1.1.1.6/32
set interfaces lo0 unit 6 family iso address 49.0555.0000.0000.0006.00
set interfaces lo0 unit 6 family inet6 address 2001::6/128
set protocols bgp group ebgp neighbor 1.1.1.5 multihop ttl 1
set protocols bgp group ebgp neighbor 1.1.1.5 local-address 1.1.1.6
set protocols bgp group ebgp neighbor 1.1.1.5 peer-as 1
set protocols bgp group ebgp neighbor 1.1.1.5 bfd-liveness-detection version 1
set protocols bgp group ebgp neighbor 1.1.1.5 bfd-liveness-detection minimum-interval 100
set protocols bgp group ebgp neighbor 1.1.1.5 bfd-liveness-detection multiplier 3
set protocols bgp group ebgp-v6 neighbor 2001::5 multihop ttl 1
set protocols bgp group ebgp-v6 neighbor 2001::5 local-address 2001::6
set protocols bgp group ebgp-v6 neighbor 2001::5 peer-as 1
set protocols bgp group ebgp-v6 neighbor 2001::5 bfd-liveness-detection version 1
set protocols bgp group ebgp-v6 neighbor 2001::5 bfd-liveness-detection minimum-interval 100
set protocols bgp group ebgp-v6 neighbor 2001::5 bfd-liveness-detection multiplier 3
set protocols isis interface xe-0/2/0.1 point-to-point
set protocols isis interface xe-0/2/0.1 bfd-liveness-detection version 1
set protocols isis interface xe-0/2/0.1 bfd-liveness-detection minimum-interval 100
set protocols isis interface xe-0/2/0.1 bfd-liveness-detection multiplier 3
set protocols isis interface lo0.6
set routing-options autonomous-system 2
                

This will lead to three BFD sessions. All of the sessions are distributed. After applying this configuration, the following can be observed on Remus:

 
play@MX480-TEST:REMUS> show bfd session extensive
                                                  Detect   Transmit
Address                  State     Interface      Time     Interval  Multiplier
2.0.0.2                  Up        xe-0/3/0.1     0.300     0.100        3
 Client ISIS L3, TX interval 0.100, RX interval 0.100
 Session up time 02:01:58
 Local diagnostic None, remote diagnostic None
 Remote state Up, version 1
 Logical system 7, routing table index 36
 Min async interval 0.100, min slow interval 1.000
 Adaptive async TX interval 0.100, RX interval 0.100
 Local min TX interval 0.100, minimum RX interval 0.100, multiplier 3
 Remote min TX interval 0.100, min RX interval 0.100, multiplier 3
 Local discriminator 382, remote discriminator 383
 Echo mode disabled/inactive
 Remote is control-plane independent
  Session ID: 0x380001

                                                  Detect   Transmit
Address                  State     Interface      Time     Interval  Multiplier
1.1.1.6                  Up                       0.300     0.100        3
 Client BGP, TX interval 0.100, RX interval 0.100
 Session up time 01:42:47
 Local diagnostic None, remote diagnostic None
 Remote state Up, version 1
 Logical system 7, routing table index 36
 Min async interval 0.100, min slow interval 1.000
 Adaptive async TX interval 0.100, RX interval 0.100
 Local min TX interval 0.100, minimum RX interval 0.100, multiplier 3
 Remote min TX interval 0.100, min RX interval 0.100, multiplier 3
 Local discriminator 384, remote discriminator 385
 Echo mode disabled/inactive
 Remote is control-plane independent
 Multi-hop min-recv-TTL 255, route table 36, local-address 1.1.1.5
  Session ID: 0x380012

                                                  Detect   Transmit
Address                  State     Interface      Time     Interval  Multiplier
2001::6                  Up                       0.300     0.100        3
 Client BGP, TX interval 0.100, RX interval 0.100
 Session up time 00:07:13
 Local diagnostic None, remote diagnostic None
 Remote state Up, version 1
 Logical system 7, routing table index 36
 Min async interval 0.100, min slow interval 1.000
 Adaptive async TX interval 0.100, RX interval 0.100
 Local min TX interval 0.100, minimum RX interval 0.100, multiplier 3
 Remote min TX interval 0.100, min RX interval 0.100, multiplier 3
 Local discriminator 386, remote discriminator 387
 Echo mode disabled/inactive
 Remote is control-plane independent
 Multi-hop min-recv-TTL 255, route table 36, local-address 2001::5
  Session ID: 0x380013

3 sessions, 3 clients
Cumulative transmit rate 30.0 pps, cumulative receive rate 30.0 pps
                


BFD on a static route:

In this example, a BFD is configured for static routes. The resulting BFD session is used to monitor static route reachability:



scenario


The Sol router has a default route towards Mars. Mars has a static route for Sol’s loopback address configured. The basic configuration should seem familiar by now:

Mars:
 
set interfaces xe-2/0/0 unit 128 description SOL
set interfaces xe-2/0/0 unit 128 vlan-id 128
set interfaces xe-2/0/0 unit 128 family inet mtu 1500
set interfaces xe-2/0/0 unit 128 family inet address 4.0.0.113/30
set interfaces lo0 unit 2 family inet address 1.1.1.2/32
set routing-options static route 1.1.1.1/32 next-hop 4.0.0.114
set routing-options static route 1.1.1.1/32 bfd-liveness-detection minimum-interval 100
set routing-options static route 1.1.1.1/32 bfd-liveness-detection multiplier 3
                
Sol:
 
set interfaces xe-2/0/1 unit 128 description MARS
set interfaces xe-2/0/1 unit 128 vlan-id 128
set interfaces xe-2/0/1 unit 128 family inet mtu 1500
set interfaces xe-2/0/1 unit 128 family inet address 4.0.0.114/30
set interfaces lo0 unit 1 family inet address 1.1.1.1/32
set routing-options static route 0.0.0.0/0 next-hop 4.0.0.113
set routing-options static route 0.0.0.0/0 bfd-liveness-detection minimum-interval 100
set routing-options static route 0.0.0.0/0 bfd-liveness-detection multiplier 3
                

After applying this configuration, we can observe the following:

 
play@MX104-TEST-HB:SOL> show route 1.1.1.2

inet.0: 12 destinations, 12 routes (12 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

0.0.0.0/0          *[Static/5] 00:38:39
                    > to 4.0.0.113 via xe-2/0/1.128

play@MX104-TEST-HB:SOL> ping 1.1.1.2
PING 1.1.1.2 (1.1.1.2): 56 data bytes
64 bytes from 1.1.1.2: icmp_seq=0 ttl=64 time=0.667 ms
64 bytes from 1.1.1.2: icmp_seq=1 ttl=64 time=0.575 ms
^C
--- 1.1.1.2 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.575/0.621/0.667/0.046 ms

play@MX104-TEST-HB:SOL> show bfd session extensive
                                                  Detect   Transmit
Address                  State     Interface      Time     Interval  Multiplier
4.0.0.113                Up        xe-2/0/1.128   0.300     0.100        3
 Client Static, TX interval 0.100, RX interval 0.100
 Session up time 00:38:35
 Local diagnostic None, remote diagnostic NbrSignal
 Remote state Up, version 1
 Logical system 3, routing table index 12
 Min async interval 0.100, min slow interval 1.000
 Adaptive async TX interval 0.100, RX interval 0.100
 Local min TX interval 0.100, minimum RX interval 0.100, multiplier 3
 Remote min TX interval 0.100, min RX interval 0.100, multiplier 3
 Local discriminator 17, remote discriminator 16
 Echo mode disabled/inactive
 Remote is control-plane independent
  Session ID: 0x180001

1 sessions, 1 clients
Cumulative transmit rate 10.0 pps, cumulative receive rate 10.0 pps
                

RE filter example:

The following is an example on how you could choose to allow BFD to establish a session. In some cases, BFD may be handled in hardware, but it will need to be allowed in your lo0 input filter nevertheless. It is not a complete filter, but an example snippit. i am sure you'll get the idea:

IPv4:
                 
set policy-options prefix-list router-self apply-path "interfaces <*> unit <*> family inet address <*>"

set firewall filter accept-bfd term accept-bfd from source-prefix-list router-self
set firewall filter accept-bfd term accept-bfd from destination-prefix-list router-self
set firewall filter accept-bfd term accept-bfd from protocol udp
set firewall filter accept-bfd term accept-bfd from source-port 49152-65535
set firewall filter accept-bfd term accept-bfd from destination-port 3784-3785
set firewall filter accept-bfd term accept-bfd then accept

set firewall filter accept-protocols-v4 term accept-bfd filter accept-bfd

set interfaces lo0 unit 0 family inet filter input-list accept-protocols-v4
                
IPv6:
 
set policy-options prefix-list router-link-local-v6 fe80::/64

set firewall family inet6 filter accept-bfd-v6 term accept-bfd from source-prefix-list router-link-local-v6
set firewall family inet6 filter accept-bfd-v6 term accept-bfd from destination-prefix-list router-link-local-v6
set firewall family inet6 filter accept-bfd-v6 term accept-bfd from source-port 49152-65535
set firewall family inet6 filter accept-bfd-v6 term accept-bfd from destination-port 3784-3785
set firewall family inet6 filter accept-bfd-v6 term accept-bfd then accept

set firewall family inet6 filter accept-protocols-v6 term accept-bfd filter accept-bfd-v6                

set interfaces lo0 unit 0 family inet6 filter input-list accept-protocols-v6
                

11-1-2015