Example for Configuring Static BFD for IPv6 Static Routes
Networking Requirements
As shown in Figure 2-12, SwitchA and SwitchB connect to each other and have static routes configured between them. Customers require that a link fault between SwitchA and SwitchB be detected within milliseconds and SwitchA and SwitchB dynamically update their routing tables.
Configuration Roadmap
To meet the preceding requirement, configure static BFD for IPv6 static routes. The configuration roadmap is as follows:
Configure a BFD session between SwitchA and SwitchB to implement millisecond-level fault detection.
Configure a static route from SwitchA to SwitchB and bind the static route to the BFD session so that SwitchA and SwitchB can update their routing tables after a fault is detected.
Procedure
- Configure IPv6 addresses for interfaces. The configuration details are not provided here.
- Configure a BFD session between SwitchA and SwitchB.
# On SwitchA, create a BFD session with SwitchB.
<SwitchA> system-view
[~SwitchA] bfd
[*SwitchA-bfd] quit
[*SwitchA] bfd aa bind peer-ipv6 fc00:0:0:2001::2
[*SwitchA-bfd-session-aa] discriminator local 10
[*SwitchA-bfd-session-aa] discriminator remote 20
[*SwitchA-bfd-session-aa] commit
[~SwitchA-bfd-session-aa] quit
# On SwitchB, create a BFD session with SwitchA.
<SwitchB> system-view
[~SwitchB] bfd
[*SwitchB-bfd] quit
[*SwitchB] bfd bb bind peer-ipv6 fc00:0:0:2001::1
[*SwitchB-bfd-session-bb] discriminator local 20
[*SwitchB-bfd-session-bb] discriminator remote 10
[*SwitchB-bfd-session-bb] commit
[~SwitchB-bfd-session-bb] quit
- Configure a default static route and bind the route to
the BFD session.
# On SwitchA, configure a default static route to SwitchB and bind the route to the BFD session named aa.
[~SwitchA] ipv6 route-static 0::0 0 fc00:0:0:2001::2 track bfd-session aa
[*SwitchA] commit
[~SwitchA] quit
- Verify the configuration.
# After the configurations are complete, run the display bfd session all command on SwitchA or SwitchB. You can view that the BFD session has been established and in Up state. Run the display current-configuration | include bfd command in the system view. You can view that the default static route has already been bound to the BFD session.
Take the display on SwitchA as an example:
<SwitchA> display bfd session all
S: Static session D: Dynamic session IP: IP session IF: Single-hop session PEER: Multi-hop session LDP: LDP session LSP: Label switched path TE: Traffic Engineering AUTO: Automatically negotiated session VXLAN: VXLAN session VSI: VSI PW session (w): State in WTR (*): State is invalid Total UP/DOWN Session Number : 1/0 -------------------------------------------------------------------------------- Local Remote PeerIpAddr State Type InterfaceName -------------------------------------------------------------------------------- 10 20 FC00:0:0:2004::2 Up S/IP-PEER - --------------------------------------------------------------------------------
<SwitchA> display current-configuration | include bfd
bfd bfd aa bind peer-ipv6 FC00:0:0:2001::2 ipv6 route-static :: 0 FC00:0:0:2001::2 track bfd-session aa
# Check the IPv6 routing table on SwitchA. You can view that the default static route exists in the routing table.
<SwitchA> display ipv6 routing-table
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ---------------------------------------------------------------------------- Routing Table : _public_ Destinations : 5 Routes : 5 Destination : :: PrefixLength : 0 NextHop : FC00:0:0:2001::2 Preference : 60 Cost : 0 Protocol : Static RelayNextHop : :: TunnelID : 0x0 Interface : 10GE1/0/1 Flags : RD Destination : ::1 PrefixLength : 128 NextHop : ::1 Preference : 0 Cost : 0 Protocol : Direct RelayNextHop : :: TunnelID : 0x0 Interface : InLoopBack0 Flags : D Destination : FC00:0:0:2001:: PrefixLength : 64 NextHop : FC00:0:0:2001::1 Preference : 0 Cost : 0 Protocol : Direct RelayNextHop : :: TunnelID : 0x0 Interface : 10GE1/0/1 Flags : D Destination : FC00:0:0:2001::1 PrefixLength : 128 NextHop : ::1 Preference : 0 Cost : 0 Protocol : Direct RelayNextHop : :: TunnelID : 0x0 Interface : 10GE1/0/1 Flags : D Destination : FE80:: PrefixLength : 10 NextHop : :: Preference : 0 Cost : 0 Protocol : Direct RelayNextHop : :: TunnelID : 0x0 Interface : NULL0 Flags : D
# Run the shutdown command on 10GE1/0/1 of SwitchB to simulate a link fault.
[~SwitchB] interface 10ge1/0/1
[~SwitchB-10GE1/0/1] shutdown
[*SwitchB-10GE1/0/1] commit
# Check the routing table on SwitchA. You can view that the default static route 0::0/0 does not exist. This is because the default static route is bound to the BFD session. After BFD detects a link fault, BFD rapidly notifies SwitchA that the static route is unavailable.
<SwitchA> display ipv6 routing-table
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ---------------------------------------------------------------------------- Routing Table : _public_ Destinations : 1 Routes : 1 Destination : ::1 PrefixLength : 128 NextHop : ::1 Preference : 0 Cost : 0 Protocol : Direct RelayNextHop : :: TunnelID : 0x0 Interface : InLoopBack0 Flags : D
Configuration Files
Configuration file of SwitchA
# sysname SwitchA # bfd # interface 10GE1/0/1 undo portswitch ipv6 enable ipv6 address FC00:0:0:2001::1/64 # bfd aa bind peer-ipv6 FC00:0:0:2001::2 discriminator local 10 discriminator remote 20 # ipv6 route-static :: 0 FC00:0:0:2001::2 track bfd-session aa # return
Configuration file of SwitchB
# sysname SwitchB # bfd # interface 10GE1/0/1 undo portswitch ipv6 enable ipv6 address FC00:0:0:2001::2/64 # interface 10GE1/0/2 undo portswitch ipv6 enable ipv6 address FC00:0:0:2002::1/64 # bfd bb bind peer-ipv6 FC00:0:0:2001::1 discriminator local 20 discriminator remote 10 # return