Back to Blog

TNSR

Using Bidirectional Forwarding Detection (BFD) to Quickly Detect Outages

Using Bidirectional Forwarding Detection (BFD) to Quickly Detect Outages

Introduction

TNSR is a software virtual router that runs on commodity bare metal hardware, AWS, Azure, or your own data center virtualization. It is able to achieve extremely high performance, surpassing what would normally be found in traditional hardware ASIC based routers, but at a fraction of the cost. Because of its feature complete design, and ability to route large amounts of network traffic at extremely high speeds, TNSR is a perfect choice for Service Providers and Enterprises who have the need for reliability and performance across their networks.  

An important function of network routers is the ability to detect outages and begin the mitigation process as quickly as possible. In most environments, this means the need for near instantaneous detection of the event. This month’s Tech Tip will explain how to use BFD to detect a network outage much faster than would be possible using only an Interior Gateway Protocol like OSPF. This will allow OSPF to begin the process of recomputing available paths through the network, routing around and mitigating the problem much sooner.

Consider a simplified network that looks like this:

 

 

In the diagram above, we have three TNSR routers, connected in a “ring” topology. Each router has two paths to reach any other router. Obviously in most cases, the routers will take the most direct path to reach each other - unless there is an outage along the ring.

In the event of an outage, OSPF will recalculate the available paths, but this outage takes time to first detect. By default, OSPF sends and receives “Hello” messages between routers every 10 seconds, and will wait for up to a default of 40 seconds of silence before declaring a given path down. In today’s demanding network environments, that is a very long time.  

 

 

Of course these values may be tuned lower, but at the cost of system resources and performance. Instead, BFD is used to detect faults between two routers across a link, even if the physical link does not support failure detection. Even in cases where physical link issues occur and are detected, BFD can coordinate reaction to these failures rather than each component relying on its own failure detection methods. This results in faster convergence than relying on the OSPF alone.

Determining Our Design

As above, our test network will be comprised of 3 TNSR routers in a ring topology. We will already have OSPF configured around the ring, and we will be adding BFD to each segment.  The completed network will look like this:

 

 

Setting Up BFD Sessions

We must first configure a BFD session on the interface of each router that we will be monitoring. Each session will have a name, and it is a good idea to make that session name something descriptive. In our case, the session names will be TNSR-A_B, TNSR-B_C, and TNSR-A_C

In this example, BFD will be configured for a “Hello” transmit and receive interval of 1000000 microseconds (1 second), and a detect multiplier of 3. This means that an outage will be detected and acted upon within 3 seconds. Configure BFD sessions on each interface like this:

TNSR-A
tnsr-a tnsr(config)# bfd session TNSR-A_B
tnsr-a tnsr(config-bfd)# interface GigabitEthernet0/13/0
tnsr-a tnsr(config-bfd)# local address 198.51.100.1
tnsr-a tnsr(config-bfd)# peer address 198.51.100.2
tnsr-a tnsr(config-bfd)# desired-min-tx 1000000
tnsr-a tnsr(config-bfd)# required-min-rx 1000000
tnsr-a tnsr(config-bfd)# detect-multiplier 3
tnsr-a tnsr(config-bfd)# enable true
tnsr-a tnsr(config-bfd)# exit
tnsr-a tnsr(config)# bfd session TNSR-A_C
tnsr-a tnsr(config-bfd)# interface GigabitEthernet0/14/0
tnsr-a tnsr(config-bfd)# local address 198.51.100.9
tnsr-a tnsr(config-bfd)# peer address 198.51.100.10
tnsr-a tnsr(config-bfd)# desired-min-tx 1000000
tnsr-a tnsr(config-bfd)# required-min-rx 1000000
tnsr-a tnsr(config-bfd)# detect-multiplier 3
tnsr-a tnsr(config-bfd)# enable true
tnsr-a tnsr(config-bfd)# exit
tnsr-a tnsr(config)#
TNSR-B
tnsr-b tnsr(config)# bfd session TNSR-A_B
tnsr-b tnsr(config-bfd)# interface GigabitEthernet0/13/0
tnsr-b tnsr(config-bfd)# local address 198.51.100.2
tnsr-b tnsr(config-bfd)# peer address 198.51.100.1
tnsr-b tnsr(config-bfd)# desired-min-tx 1000000
tnsr-b tnsr(config-bfd)# required-min-rx 1000000
tnsr-b tnsr(config-bfd)# detect-multiplier 3
tnsr-b tnsr(config-bfd)# enable true
tnsr-b tnsr(config-bfd)# exit
tnsr-b tnsr(config)# bfd session TNSR-B_C
tnsr-b tnsr(config-bfd)# interface GigabitEthernet0/14/0
tnsr-b tnsr(config-bfd)# local address 198.51.100.5
tnsr-b tnsr(config-bfd)# peer address 198.51.100.6
tnsr-b tnsr(config-bfd)# desired-min-tx 1000000
tnsr-b tnsr(config-bfd)# required-min-rx 1000000
tnsr-b tnsr(config-bfd)# detect-multiplier 3
tnsr-b tnsr(config-bfd)# enable true
tnsr-b tnsr(config-bfd)# exit
tnsr-b tnsr(config)#
TNSR-C
tnsr-c tnsr(config)# bfd session TNSR-A_C
tnsr-c tnsr(config-bfd)# interface GigabitEthernet0/13/0
tnsr-c tnsr(config-bfd)# local address 198.51.100.10
tnsr-c tnsr(config-bfd)# peer address 198.51.100.9
tnsr-c tnsr(config-bfd)# desired-min-tx 1000000
tnsr-c tnsr(config-bfd)# required-min-rx 1000000
tnsr-c tnsr(config-bfd)# detect-multiplier 3
tnsr-c tnsr(config-bfd)# enable true
tnsr-c tnsr(config-bfd)# exit
tnsr-c tnsr(config)# bfd session TNSR-B_C
tnsr-c tnsr(config-bfd)# interface GigabitEthernet0/14/0
tnsr-c tnsr(config-bfd)# local address 198.51.100.6
tnsr-c tnsr(config-bfd)# peer address 198.51.100.5
tnsr-c tnsr(config-bfd)# desired-min-tx 1000000
tnsr-c tnsr(config-bfd)# required-min-rx 1000000
tnsr-c tnsr(config-bfd)# detect-multiplier 3
tnsr-c tnsr(config-bfd)# enable true
tnsr-c tnsr(config-bfd)# exit
tnsr-c tnsr(config)#

 

Checking BFD Status

We can check if BFD is configured correctly and operational on each router’s links, by issuing the show bfd sessions command on each router. For example, TNSR-A should look like this:

TNSR-A
tnsr-a tnsr(config)# show bfd sessions
Session Name: TNSR-A_B
    Interface: GigabitEthernet0/13/0
    Local IP Addr: 198.51.100.1
    Peer  IP Addr: 198.51.100.2
    State: up
    Required Min Rx Interval: 1000000 usec
    Desired Min Tx Interval: 1000000 usec
    Detect Multiplier: 3
    BFD Key Id: 0
    Configuration Key Id: 0
    Authenticated: false

Session Name: TNSR-A_C
    Interface: GigabitEthernet0/14/0
    Local IP Addr: 198.51.100.9
    Peer  IP Addr: 198.51.100.10
    State: up
    Required Min Rx Interval: 1000000 usec
    Desired Min Tx Interval: 1000000 usec
    Detect Multiplier: 3
    BFD Key Id: 0
    Configuration Key Id: 0
    Authenticated: false

Notice that the status is UP on both links. Now we can go on to use these BFD sessions to detect outages on our ring running OSPF.

Using BFD

Enabling BFD in OSPF is quite simple. In this example, the OSPF configuration on each router looks similar to this:

tnsr-a tnsr(config)# show run ospf
route dynamic ospf
    enable
    interface GigabitEthernet0/13/0
        ip address * area 0.0.0.0
        ip address * cost 5
        ip network point-to-point
    exit
    interface GigabitEthernet0/14/0
        ip address * area 0.0.0.0
        ip address * cost 5
        ip network point-to-point
    exit
    server vrf default
        ospf router-id 198.51.100.1
    exit
exit

We can tell OSPF to use BFD on a per-interface basis, by adding the following to each OSPF interface configuration on every router:

tnsr-a tnsr(config)# route dynamic ospf
tnsr-a tnsr(config-frr-ospf)# interface GigabitEthernet0/13/0
tnsr-a tnsr(config-ospf-if)# ip bfd enabled true
tnsr-a tnsr(config-ospf-if)# exit
tnsr-a tnsr(config-frr-ospf)# interface GigabitEthernet0/14/0
tnsr-a tnsr(config-ospf-if)# ip bfd enabled true
tnsr-a tnsr(config-ospf-if)# exit
tnsr-a tnsr(config-frr-ospf)# exit
tnsr-a tnsr(config)#

With this configured on every router, outages can be detected and acted upon within a 3 second timeframe.

Conclusion

BFD is a very useful and efficient method of detecting network faults, allowing your routing protocol to begin the work of mitigation much faster than relying on the protocol alone. In addition to OSPF, BFD can also be used with BGP sessions. Being a full-featured high-performance class router, TNSR provides all the tools necessary for Service Providers and Enterprises to perform at their best.

Visit our online documentation for more information about BFD, and all the other features found in TNSR.