BFD In BGP

With BFD usage in BGP, the failover mechanism is greatly improved by detecting the loss of remote BGP speaker in a few seconds, instead of generally 20/30 seconds. To get more information on BFD, please see BFD.

BFD Configuration And Monitoring In BGP

A BFD peer session context is created, along with BGP peering session. The session inherits from BGP settings. For instance, if ebgp-multihop is used, then a BFD session multi-hop is created. Also, if update-source is used, the local-address parameter is set.

vrf customer1
   routing bgp
      as 65555
      router-id 192.168.1.1
      neighbor 192.168.1.2 remote-as 65100
      neighbor 192.168.1.2 ebgp-multihop 5
      neighbor 192.168.1.2 update-source 192.168.1.1
      neighbor 192.168.1.2 track bfd

Then you can continue the configuration as usual. For timer settings, the default emission and reception settings are set to 300000 microseconds, which may not be what is wished. In that case, it is possible to override default timers, by configuring general timer settings. More information is given in Configuring general BFD settings.

vrouter> show bfd vrf customer1 sessions
BFD Peers:
peer 192.168.1.2 multihop local-address 192.168.1.1
  ID: 3581662458
  Remote ID: 4190161000
  Status: up
  Uptime: 1 minute(s), 48 second(s)
  Diagnostics: ok
  Remote diagnostics: ok
  Local timers:
  Receive interval: 600ms
  Transmission interval: 600ms
  Echo transmission interval: 50ms
  Remote timers:
  Receive interval: 300ms
  Transmission interval: 300ms
  Echo transmission interval: 50ms

vrouter> show bgp vrf customer1 neighbors
BGP neighbor is 192.168.1.2, remote AS 65100, local AS 65555, external link
Hostname: rt1
  BGP version 4, remote router ID 10.254.254.3, local router ID 10.254.254.1
  BGP state = Established, up for 00:04:37
  Last read 00:00:05, Last write 00:00:05
  Hold time is 24, keepalive interval is 8 seconds
  [..]
  BFD: Type: multi hop
    Detect Multiplier: 3, Min Rx interval: 300, Min Tx interval: 300
    Status: Up, Last

BGP Graceful Restart With BFD

There are cases where the non stop forwarding mechanisms configured in BGP may have to prevent BFD to trigger the neighbouring peer session to go down. BFD provides such feature by embedding in BFD control packet a bit that reflects the relationship between control-plane and dataplane. This bit is called the control bit. By default, that bit is set to 1, and means that if a BFD event happens, then the associated control-plane routing context may go down too.

BGP graceful restart informs remote peer that the local speaker is able to keep BGP routing entries in stale mode, during the non availability of that remote speaker. When leaving, remote BFD peer leaves too. Then, the local BFD triggers a notification to BGP quicker than if the local BGP was detecting that the remote BGP speaker left without saying anything (usually TCP error). When keeping BFD posted with specific BGP constraint, the incoming BFD control packet has the C-BIT unset, which means that the control-plane and dataplane should be independent to each other. Consequently, BGP is notified that the remote BGP speaker went down, but as the incoming C-BIT is unset, the event is ignored, thus letting the BGP graceful restart mechanism taking the hand, and thus keeping the routing entries.

Following configuration should be applied if the control-plane decision should be done independently of the incoming BFD notification. Reversely, that configuration will also unset the C-BIT for outgoing BFD control packets.

vrf customer1
   routing bgp
      as 65555
      router-id 192.168.1.1
      graceful-restart
        ..
      neighbor 192.168.1.2 remote-as 65100
      neighbor 192.168.1.2 track bfd
      neighbor 192.168.1.2 check-control-plane-failure true

BFD Configuration And Monitoring In BGP Using Trackers

It’s also possible to configure a BFD or ICMP tracker manually. This enables using the same tracker in different services. The example below uses the same BFD tracker in a BGP neighbor and a static route. If the link becomes unrechable, the BGP neighbor and the static route will be removed from the configuration.

tracker bfd my-bfd-tracker
   type multi-hop
   address 192.168.1.2
   source 192.168.1.1
   vrf customer1
   required-receive-interval 600000
   desired-transmission-interval 600000
   /
vrf customer1
   routing
      static ipv4-route 192.168.1.0/24 next-hop 192.168.1.2 track my-bfd-tracker
      bgp
         as 65555
         router-id 192.168.1.1
         neighbor 64.120.3.24 remote-as 65100
         neighbor 64.120.3.24 update-source 192.168.1.1
         neighbor 64.120.3.24 track my-bfd-tracker
         /
commit