Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation
Guide That Contains This Content
[+] Expand All
[-] Collapse All

    Example: Configuring BFD on Internal BGP Peer Sessions

    This example shows how to configure internal BGP (IBGP) peer sessions with the Bidirectional Forwarding Detection (BFD) protocol to detect failures in a network.

    Requirements

    No special configuration beyond device initialization is required before you configure this example.

    Overview

    The minimum configuration to enable BFD on IBGP sessions is to include the bfd-liveness-detection minimum-interval statement in the BGP configuration of all neighbors participating in the BFD session. The minimum-interval statement specifies the minimum transmit and receive intervals for failure detection. Specifically, this value represents the minimum interval after which the local routing device transmits hello packets as well as the minimum interval that the routing device expects to receive a reply from a neighbor with which it has established a BFD session. You can configure a value from 1 through 255,000 milliseconds.

    Optionally, you can specify the minimum transmit and receive intervals separately using the transmit-interval minimum-interval and minimum-receive-interval statements. For information about these and other optional BFD configuration statements, see bfd-liveness-detection.

    Note: BFD is an intensive protocol that consumes system resources. Specifying a minimum interval for BFD less than 100 ms for Routing Engine-based sessions and less than 10 ms for distributed BFD sessions can cause undesired BFD flapping.

    Depending on your network environment, these additional recommendations might apply:

    • For large-scale network deployments with a large number of BFD sessions, specify a minimum interval of 300 ms for Routing Engine-based sessions and 100 ms for distributed BFD sessions.
    • For very large-scale network deployments with a large number of BFD sessions, contact Juniper Networks customer support for more information.
    • For BFD sessions to remain up during a Routing Engine switchover event when nonstop active routing (NSR) is configured, specify a minimum interval of 2500 ms for Routing Engine-based sessions. For distributed BFD sessions with NSR configured, the minimum interval recommendations are unchanged and depend only on your network deployment.

    BFD is supported on the default routing instance (the main router), routing instances, and logical systems. This example shows BFD on logical systems.

    Figure 1 shows a typical network with internal peer sessions.

    Figure 1: Typical Network with IBGP Sessions

    Typical Network with IBGP Sessions

    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 A

    set logical-systems A interfaces lt-1/2/0 unit 1 description to-B set logical-systems A interfaces lt-1/2/0 unit 1 encapsulation ethernet set logical-systems A interfaces lt-1/2/0 unit 1 peer-unit 2 set logical-systems A interfaces lt-1/2/0 unit 1 family inet address 10.10.10.1/30 set logical-systems A interfaces lo0 unit 1 family inet address 192.168.6.5/32 set logical-systems A protocols bgp group internal-peers type internal set logical-systems A protocols bgp group internal-peers traceoptions file bgp-bfd set logical-systems A protocols bgp group internal-peers traceoptions flag bfd detail set logical-systems A protocols bgp group internal-peers local-address 192.168.6.5 set logical-systems A protocols bgp group internal-peers export send-direct set logical-systems A protocols bgp group internal-peers bfd-liveness-detection minimum-interval 1000 set logical-systems A protocols bgp group internal-peers neighbor 192.163.6.4 set logical-systems A protocols bgp group internal-peers neighbor 192.168.40.4 set logical-systems A protocols ospf area 0.0.0.0 interface lo0.1 passive set logical-systems A protocols ospf area 0.0.0.0 interface lt-1/2/0.1 set logical-systems A policy-options policy-statement send-direct term 2 from protocol direct set logical-systems A policy-options policy-statement send-direct term 2 then accept set logical-systems A routing-options router-id 192.168.6.5 set logical-systems A routing-options autonomous-system 17

    Device B

    set logical-systems B interfaces lt-1/2/0 unit 2 description to-Aset logical-systems B interfaces lt-1/2/0 unit 2 encapsulation ethernetset logical-systems B interfaces lt-1/2/0 unit 2 peer-unit 1set logical-systems B interfaces lt-1/2/0 unit 2 family inet address 10.10.10.2/30set logical-systems B interfaces lt-1/2/0 unit 5 description to-Cset logical-systems B interfaces lt-1/2/0 unit 5 encapsulation ethernetset logical-systems B interfaces lt-1/2/0 unit 5 peer-unit 6set logical-systems B interfaces lt-1/2/0 unit 5 family inet address 10.10.10.5/30set logical-systems B interfaces lo0 unit 2 family inet address 192.163.6.4/32set logical-systems B protocols bgp group internal-peers type internalset logical-systems B protocols bgp group internal-peers local-address 192.163.6.4set logical-systems B protocols bgp group internal-peers export send-directset logical-systems B protocols bgp group internal-peers bfd-liveness-detection minimum-interval 1000set logical-systems B protocols bgp group internal-peers neighbor 192.168.40.4set logical-systems B protocols bgp group internal-peers neighbor 192.168.6.5set logical-systems B protocols ospf area 0.0.0.0 interface lo0.2 passiveset logical-systems B protocols ospf area 0.0.0.0 interface lt-1/2/0.2set logical-systems B protocols ospf area 0.0.0.0 interface lt-1/2/0.5set logical-systems B policy-options policy-statement send-direct term 2 from protocol directset logical-systems B policy-options policy-statement send-direct term 2 then acceptset logical-systems B routing-options router-id 192.163.6.4set logical-systems B routing-options autonomous-system 17

    Device C

    set logical-systems C interfaces lt-1/2/0 unit 6 description to-Bset logical-systems C interfaces lt-1/2/0 unit 6 encapsulation ethernetset logical-systems C interfaces lt-1/2/0 unit 6 peer-unit 5set logical-systems C interfaces lt-1/2/0 unit 6 family inet address 10.10.10.6/30set logical-systems C interfaces lo0 unit 3 family inet address 192.168.40.4/32set logical-systems C protocols bgp group internal-peers type internalset logical-systems C protocols bgp group internal-peers local-address 192.168.40.4set logical-systems C protocols bgp group internal-peers export send-directset logical-systems C protocols bgp group internal-peers bfd-liveness-detection minimum-interval 1000set logical-systems C protocols bgp group internal-peers neighbor 192.163.6.4set logical-systems C protocols bgp group internal-peers neighbor 192.168.6.5set logical-systems C protocols ospf area 0.0.0.0 interface lo0.3 passiveset logical-systems C protocols ospf area 0.0.0.0 interface lt-1/2/0.6set logical-systems C policy-options policy-statement send-direct term 2 from protocol directset logical-systems C policy-options policy-statement send-direct term 2 then acceptset logical-systems C routing-options router-id 192.168.40.4set logical-systems C routing-options autonomous-system 17

    Configuring Device A

    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 Device A:

    1. Set the CLI to Logical System A.
      user@host> set cli logical-system A
    2. Configure the interfaces.
      [edit interfaces lt-1/2/0 unit 1]user@host:A# set description to-B user@host:A# set encapsulation ethernet user@host:A# set peer-unit 2 user@host:A# set family inet address 10.10.10.1/30
      [edit interfaces lo0 unit 1]user@host:A# set family inet address 192.168.6.5/32
    3. Configure BGP.

      The neighbor statements are included for both Device B and Device C, even though Device A is not directly connected to Device C.

      [edit protocols bgp group internal-peers]user@host:A# set type internal user@host:A# set local-address 192.168.6.5 user@host:A# set export send-direct user@host:A# set neighbor 192.163.6.4 user@host:A# set neighbor 192.168.40.4
    4. Configure BFD.
      [edit protocols bgp group internal-peers]user@host:A# set bfd-liveness-detection minimum-interval 1000

      You must configure the same minimum interval on the connecting peer.

    5. (Optional) Configure BFD tracing.
      [edit protocols bgp group internal-peers]user@host:A# set traceoptions file bgp-bfd user@host:A# set traceoptions flag bfd detail
    6. Configure OSPF.
      [edit protocols ospf area 0.0.0.0]user@host:A# set interface lo0.1 passive user@host:A# set interface lt-1/2/0.1
    7. Configure a policy that accepts direct routes.

      Other useful options for this scenario might be to accept routes learned through OSPF or local routes.

      [edit policy-options policy-statement send-direct term 2]user@host:A# set from protocol direct user@host:A# set then accept
    8. Configure the router ID and the autonomous system (AS) number.
      [edit routing-options]user@host:A# set router-id 192.168.6.5 user@host:A# set autonomous-system 17
    9. If you are done configuring the device, enter commit from configuration mode.
      Repeat these steps to configure Device B and Device C.

    Results

    From configuration mode, confirm your configuration by entering the show interfaces, show policy-options, 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.

    user@host:A# show interfaces
    lt-1/2/0 {unit 1 {description to-B;encapsulation ethernet;peer-unit 2;family inet {address 10.10.10.1/30;}}}
    lo0 {unit 1 {family inet {address 192.168.6.5/32;}}}
    user@host:A# show policy-options
    policy-statement send-direct {term 2 {from protocol direct;then accept;}}
    user@host:A# show protocols
    bgp {group internal-peers {type internal;traceoptions {file bgp-bfd;flag bfd detail;}local-address 192.168.6.5;export send-direct;bfd-liveness-detection {minimum-interval 1000;}neighbor 192.163.6.4;neighbor 192.168.40.4;}}
    ospf {area 0.0.0.0 {interface lo0.1 {passive;}interface lt-1/2/0.1;}}
    user@host:A# show routing-optionsrouter-id 192.168.6.5;autonomous-system 17;

    Verification

    Confirm that the configuration is working properly.

    Verifying That BFD Is Enabled

    Purpose

    Verify that BFD is enabled between the IBGP peers.

    Action

    From operational mode, enter the show bgp neighbor command. You can use the | match bfd filter to narrow the output.

    user@host:A> show bgp neighbor | match bfd
    Options: <BfdEnabled>
      BFD: enabled, up
      Trace file: /var/log/A/bgp-bfd size 131072 files 10
      Options: <BfdEnabled>
      BFD: enabled, up
      Trace file: /var/log/A/bgp-bfd size 131072 files 10
    

    Meaning

    The output shows that Logical System A has two neighbors with BFD enabled. When BFD is not enabled, the output displays BFD: disabled, down, and the <BfdEnabled> option is absent. If BFD is enabled and the session is down, the output displays BFD: enabled, down. The output also shows that BFD-related events are being written to a log file because trace operations are configured.

    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@host:A> show bfd session extensive
                                                      Detect   Transmit
    Address                  State     Interface      Time     Interval  Multiplier
    192.163.6.4              Up                       3.000     1.000        3   
     Client BGP, TX interval 1.000, RX interval 1.000
     Session up time 00:54:40
     Local diagnostic None, remote diagnostic None
     Remote state Up, version 1
     Logical system 12, routing table index 25
     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 10, remote discriminator 9
     Echo mode disabled/inactive
     Multi-hop route table 25, local-address 192.168.6.5
    
                                                      Detect   Transmit
    Address                  State     Interface      Time     Interval  Multiplier
    192.168.40.4             Up                       3.000     1.000        3   
     Client BGP, TX interval 1.000, RX interval 1.000
     Session up time 00:48:03
     Local diagnostic None, remote diagnostic None
     Remote state Up, version 1
     Logical system 12, routing table index 25
     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 14, remote discriminator 13
     Echo mode disabled/inactive
     Multi-hop route table 25, local-address 192.168.6.5
    
    2 sessions, 2 clients
    Cumulative transmit rate 2.0 pps, cumulative receive rate 2.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/A/bgp-bfd command.

    user@host:A> file show /var/log/A/bgp-bfd
    Aug 15 17:07:25 trace_on: Tracing to "/var/log/A/bgp-bfd" started
    Aug 15 17:07:26.492190 bgp_peer_init: BGP peer 192.163.6.4 (Internal AS 17) local address 192.168.6.5 not found.  Leaving peer idled
    Aug 15 17:07:26.493176 bgp_peer_init: BGP peer 192.168.40.4 (Internal AS 17) local address 192.168.6.5 not found.  Leaving peer idled
    Aug 15 17:07:32.597979 task_connect: task BGP_17.192.163.6.4+179 addr 192.163.6.4+179: No route to host
    Aug 15 17:07:32.599623 bgp_connect_start: connect 192.163.6.4 (Internal AS 17): No route to host
    Aug 15 17:07:36.869394 task_connect: task BGP_17.192.168.40.4+179 addr 192.168.40.4+179: No route to host
    Aug 15 17:07:36.870624 bgp_connect_start: connect 192.168.40.4 (Internal AS 17): No route to host
    Aug 15 17:08:04.599220 task_connect: task BGP_17.192.163.6.4+179 addr 192.163.6.4+179: No route to host
    Aug 15 17:08:04.601135 bgp_connect_start: connect 192.163.6.4 (Internal AS 17): No route to host
    Aug 15 17:08:08.869717 task_connect: task BGP_17.192.168.40.4+179 addr 192.168.40.4+179: No route to host
    Aug 15 17:08:08.869934 bgp_connect_start: connect 192.168.40.4 (Internal AS 17): No route to host
    Aug 15 17:08:36.603544 advertising receiving-speaker only capabilty to neighbor 192.163.6.4 (Internal AS 17)
    Aug 15 17:08:36.606726 bgp_read_message: 192.163.6.4 (Internal AS 17): 0 bytes buffered
    Aug 15 17:08:36.609119 Initiated BFD session to peer 192.163.6.4 (Internal AS 17): address=192.163.6.4 ifindex=0 ifname=(none) txivl=1000 rxivl=1000 mult=3 ver=255
    Aug 15 17:08:36.734033 advertising receiving-speaker only capabilty to neighbor 192.168.40.4 (Internal AS 17)
    Aug 15 17:08:36.738436 Initiated BFD session to peer 192.168.40.4 (Internal AS 17): address=192.168.40.4 ifindex=0 ifname=(none) txivl=1000 rxivl=1000 mult=3 ver=255
    Aug 15 17:08:40.537552 BFD session to peer 192.163.6.4 (Internal AS 17) up
    Aug 15 17:08:40.694410 BFD session to peer 192.168.40.4 (Internal AS 17) up

    Meaning

    Before the routes are established, the No route to host message appears in the output. After the routes are established, the last two lines show that both BFD sessions come up.

    Viewing Detailed BFD Events After Deactivating and Reactivating a Loopback Interface

    Purpose

    Check to see what happens after bringing down a router or switch and then bringing it back up. To simulate bringing down a router or switch, deactivate the loopback interface on Logical System B.

    Action

    1. From configuration mode, enter the deactivate logical-systems B interfaces lo0 unit 2 family inet command.
      user@host:A# deactivate logical-systems B interfaces lo0 unit 2 family inet
      user@host:A# commit
    2. From operational mode, enter the file show /var/log/A/bgp-bfd command.
      user@host:A> file show /var/log/A/bgp-bfd
      ...
      Aug 15 17:20:55.995648 bgp_read_v4_message:9747: NOTIFICATION received from 192.163.6.4 (Internal AS 17): code 6 (Cease) subcode 6 (Other Configuration Change)
      Aug 15 17:20:56.004508 Terminated BFD session to peer 192.163.6.4 (Internal AS 17)
      Aug 15 17:21:28.007755 task_connect: task BGP_17.192.163.6.4+179 addr 192.163.6.4+179: No route to host
      Aug 15 17:21:28.008597 bgp_connect_start: connect 192.163.6.4 (Internal AS 17): No route to host
    3. From configuration mode, enter the activate logical-systems B interfaces lo0 unit 2 family inet command.
      user@host:A# activate logical-systems B interfaces lo0 unit 2 family inet
      user@host:A# commit
    4. From operational mode, enter the file show /var/log/A/bgp-bfd command.
      user@host:A> file show /var/log/A/bgp-bfd
      ...
      Aug 15 17:25:53.623743 advertising receiving-speaker only capabilty to neighbor 192.163.6.4 (Internal AS 17)
      Aug 15 17:25:53.631314 Initiated BFD session to peer 192.163.6.4 (Internal AS 17): address=192.163.6.4 ifindex=0 ifname=(none) txivl=1000 rxivl=1000 mult=3 ver=255
      Aug 15 17:25:57.570932 BFD session to peer 192.163.6.4 (Internal AS 17) up

    Modified: 2016-05-20