Example for Configuring BFD for BGP4+
Networking Requirements
As shown in Figure 9-34, SwitchA belongs to AS 100, and SwitchB and SwitchC belong to AS 200. SwitchA establishes EBGP connections with both SwitchB and SwitchC.
Service traffic is forwarded along the primary link SwitchA→SwitchB. The link SwitchA→SwitchC→SwitchB is used as a backup. Customers require that a fault on the primary link be detected in milliseconds so that service traffic can be fast switched to the backup link if the primary link fails.
Configuration Roadmap
The configuration roadmap is as follows:
Configure basic BGP4+ functions on all switches so that they can establish BGP peer relationships with each other.
Configure MED-based route selection on SwitchA and SwitchB to forward traffic on the primary link between SwitchA and SwitchB.
Enable BFD on SwitchA and SwitchB to detect faults in milliseconds so that service traffic can be fast switched to the backup link if the primary link fails.
Procedure
- Configure IPv6 addresses for interfaces of all switches. The configuration details are not provided here.
- Configure basic BGP4+ functions, establish EBGP connections between SwitchA and SwitchB and between SwitchA and SwitchC, and establish an IBGP connection between SwitchB and SwitchC.
# Configure SwitchA.
[~SwitchA] bgp 100
[*SwitchA-bgp] router-id 10.1.1.1
[*SwitchA-bgp] peer fc00:0:0:8::2 as-number 200
[*SwitchA-bgp] peer fc00:0:0:10::2 as-number 200
[*SwitchA-bgp] ipv6-family unicast
[*SwitchA-bgp-af-ipv6] peer fc00:0:0:8::2 enable
[*SwitchA-bgp-af-ipv6] peer fc00:0:0:10::2 enable
[*SwitchA-bgp-af-ipv6] commit
[~SwitchA-bgp-af-ipv6] quit
[~SwitchA-bgp] quit
# Configure SwitchB.
[~SwitchB] bgp 200
[*SwitchB-bgp] router-id 10.2.2.2
[*SwitchB-bgp] peer fc00:0:0:8::1 as-number 100
[*SwitchB-bgp] peer fc00:0:0:9::1:2 as-number 200
[*SwitchB-bgp] ipv6-family unicast
[*SwitchB-bgp-af-ipv6] peer fc00:0:0:8::1 enable
[*SwitchB-bgp-af-ipv6] peer fc00:0:0:9::1:2 enable
[*SwitchB-bgp-af-ipv6] network fc00:0:0:7:: 64
[*SwitchB-bgp-af-ipv6] commit
[~SwitchB-bgp-af-ipv6] quit
[~SwitchB-bgp] quit
# Configure SwitchC.
[~SwitchC] bgp 200
[*SwitchC-bgp] router-id 10.3.3.3
[*SwitchC-bgp] peer fc00:0:0:10::1 as-number 100
[*SwitchC-bgp] peer fc00:0:0:9::1:1 as-number 200
[*SwitchC-bgp] ipv6-family unicast
[*SwitchC-bgp-af-ipv6] peer fc00:0:0:10::1 enable
[*SwitchC-bgp-af-ipv6] peer fc00:0:0:9::1:1 enable
[*SwitchC-bgp-af-ipv6] commit
[~SwitchC-bgp-af-ipv6] quit
[~SwitchC-bgp] quit
# Run the display bgp ipv6 peer command on SwitchA. The command output shows that BGP peer relationships have been established.
[SwitchA] display bgp ipv6 peer
BGP local router ID : 10.1.1.1 Local AS number : 100 Total number of peers : 2 Peers in established state : 2 Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv FC00:0:0:8::2 4 200 5 6 0 00:01:28 Established 1 FC00:0:0:10::2 4 200 4 5 0 00:00:04 Established 1
- Configure the MED attribute.
Set the MED values of routes sent from SwitchB and SwitchC to SwitchA through routing policies.
# Configure SwitchB.
[~SwitchB] route-policy 10 permit node 10
[*SwitchB-route-policy] apply cost 100
[*SwitchB-route-policy] quit
[*SwitchB] bgp 200
[*SwitchB-bgp] ipv6-family unicast
[*SwitchB-bgp-af-ipv6] peer fc00:0:0:8::1 route-policy 10 export
[*SwitchB-bgp-af-ipv6] quit
[*SwitchB-bgp] quit
[*SwitchB] commit
# Configure SwitchC.
[~SwitchC] route-policy 10 permit node 10
[*SwitchC-route-policy] apply cost 150
[*SwitchC-route-policy] quit
[*SwitchC] bgp 200
[*SwitchC-bgp] ipv6-family unicast
[*SwitchC-bgp-af-ipv6] peer fc00:0:0:10::1 route-policy 10 export
[*SwitchC-bgp-af-ipv6] quit
[*SwitchC-bgp] quit
[*SwitchC] commit
# Check the BGP routing table on SwitchA.
[SwitchA] display bgp ipv6 routing-table
BGP Local router ID is 10.1.1.1 Status codes: * - valid, > - best, d - damped, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete Total Number of Routes: 2 *> Network : FC00:0:0:7:: PrefixLen : 64 NextHop : FC00:0:0:8::2 LocPrf : MED : 100 PrefVal : 0 Label : Path/Ogn : 200i * NextHop : FC00:0:0:10::2 LocPrf : MED : 150 PrefVal : 0 Label : Path/Ogn : 200i
In the BGP routing table, you can view that the next-hop address of the route to FC00:0:0:7::1/64 is FC00:0:0:8::2, and traffic is transmitted on the primary link SwitchA→SwitchB.
- Configure BFD, and set the intervals at which BFD packets are sent and received and the local detection multiplier.
# Configure BFD on SwitchA, and set the minimum intervals for sending and receiving BFD packets to both 300 ms and the local detection multiplier to 5.
[~SwitchA] bfd
[*SwitchA-bfd] quit
[*SwitchA] bgp 100
[*SwitchA-bgp] peer fc00:0:0:8::2 bfd enable
[*SwitchA-bgp] peer fc00:0:0:8::2 bfd min-tx-interval 300 min-rx-interval 300 detect-multiplier 5
[*SwitchA-bgp] quit
[*SwitchA] commit
# Configure BFD on SwitchB, and set the minimum intervals for sending and receiving BFD packets to both 300 ms and the local detection multiplier to 5.
[~SwitchB] bfd
[*SwitchB-bfd] quit
[*SwitchB] bgp 200
[*SwitchB-bgp] peer fc00:0:0:8::1 bfd enable
[*SwitchB-bgp] peer fc00:0:0:8::1 bfd min-tx-interval 300 min-rx-interval 300 detect-multiplier 5
[*SwitchB-bgp] commit
[~SwitchB-bgp] quit
# Check all BFD sessions on SwitchA.
[SwitchA] display bgp ipv6 bfd session all
-------------------------------------------------------------------------------- Local_Address : FC00:0:0:8::1 Peer_Address : FC00:0:0:8::2 Tx-interval(ms): 300 Rx-interval(ms): 300 Multiplier : 5 Interface : 10GE1/0/1 Session-State : Up Wtr-interval(m): 0 --------------------------------------------------------------------------------
- Verify the configuration.
# Run the shutdown command on 10GE1/0/2 of SwitchB to simulate a primary link fault.
[~SwitchB] interface 10ge 1/0/2
[~SwitchB-10GE1/0/2] shutdown
[*SwitchB-10GE1/0/2] commit
# Check the BGP routing table on SwitchA.
[SwitchA] display bgp ipv6 routing-table
BGP Local router ID is 10.1.1.1 Status codes: * - valid, > - best, d - damped, h - history, i - internal, s - suppressed, S - Stale Origin : i - IGP, e - EGP, ? - incomplete Total Number of Routes: 1 *> Network : FC00:0:0:7:: PrefixLen : 64 NextHop : FC00:0:0:10::2 LocPrf : MED : 150 PrefVal : 0 Label : Path/Ogn : 200i
In the BGP routing table, you can view that the backup link SwitchA-SwitchC-SwitchB transmits traffic after the primary link fails, and the next-hop address of the route to FC00:0:0:7::1/64 becomes FC00:0:0:10::2.
Configuration Files
Configuration file of SwitchA
# sysname SwitchA # bfd # interface 10GE1/0/1 undo portswitch ipv6 enable ipv6 address FC00:0:0:8::1/64 # interface 10GE1/0/2 undo portswitch ipv6 enable ipv6 address FC00:0:0:10::1/64 # bgp 100 router-id 10.1.1.1 peer FC00:0:0:8::2 as-number 200 peer FC00:0:0:8::2 bfd min-tx-interval 300 min-rx-interval 300 detect-multiplier 5 peer FC00:0:0:8::2 bfd enable peer FC00:0:0:10::2 as-number 200 # ipv4-family unicast # ipv6-family unicast peer FC00:0:0:8::2 enable peer FC00:0:0:10::2 enable # return
Configuration file of SwitchB
# sysname SwitchB # bfd # interface 10GE1/0/1 undo portswitch ipv6 enable ipv6 address FC00:0:0:9::1:1/64 # interface 10GE1/0/2 undo portswitch ipv6 enable ipv6 address FC00:0:0:8::2/64 # interface 10GE1/0/3 undo portswitch ipv6 enable ipv6 address FC00:0:0:7::1/64 # bgp 200 router-id 10.2.2.2 peer FC00:0:0:8::1 as-number 100 peer FC00:0:0:8::1 bfd min-tx-interval 300 min-rx-interval 300 detect-multiplier 5 peer FC00:0:0:8::1 bfd enable peer FC00:0:0:9::1:2 as-number 200 # ipv4-family unicast # ipv6-family unicast network FC00:0:0:7:: 64 peer FC00:0:0:8::1 enable peer FC00:0:0:8::1 route-policy 10 export peer FC00:0:0:9::1:2 enable # route-policy 10 permit node 10 apply cost 100 # return
Configuration file of SwitchC
# sysname SwitchC # interface 10GE1/0/1 undo portswitch ipv6 enable ipv6 address FC00:0:0:9::1:2/64 # interface 10GE1/0/2 undo portswitch ipv6 enable ipv6 address FC00:0:0:10::2/64 # bgp 200 router-id 10.3.3.3 peer FC00:0:0:9::1:1 as-number 200 peer FC00:0:0:10::1 as-number 100 # ipv4-family unicast # ipv6-family unicast peer FC00:0:0:9::1:1 enable peer FC00:0:0:10::1 enable peer FC00:0:0:10::1 route-policy 10 export # route-policy 10 permit node 10 apply cost 150 # return