配置静态BFD for IPv6静态路由示例
组网需求
如图2-12所示,SwitchA和SwitchB相连。在SwitchA和SwitchB间配置了静态路由。客户希望在SwitchA和SwitchB之间的链路进行毫秒级故障检测,并及时刷新路由表。
配置思路
用户可以考虑配置静态BFD for IPv6静态路由来实现以上需求。采用如下思路配置静态BFD for IPv6静态路由:
在SwitchA和SwitchB上配置BFD会话,实现SwitchA和SwitchB之间的链路的毫秒级检测。
配置SwitchA到SwitchB的静态路由并绑定BFD会话,实现在检测出故障后及时刷新路由表。
操作步骤
- 配置各接口IPv6地址(略)
- 配置SwitchA和SwitchB之间的BFD会话
# 在SwitchA上配置与SwitchB之间的BFD会话。
<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
# 在SwitchB上配置与SwitchA之间的BFD Session。
<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
- 配置静态缺省路由并绑定BFD会话
# 在SwitchA上配置到SwitchB的静态缺省路由,并绑定BFD会话aa。
[~SwitchA] ipv6 route-static 0::0 0 fc00:0:0:2001::2 track bfd-session aa
[*SwitchA] commit
[~SwitchA] quit
- 验证配置结果
# 配置完成后,在SwitchA和SwitchB上执行display bfd session all命令,可以看到BFD会话已经建立,且状态为Up。在系统视图下执行display current-configuration | include bfd命令,可以看到静态路由已经绑定BFD会话。
以SwitchA上的显示为例。
<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
# 在SwitchA上查看IPv6路由表,缺省静态路由存在于路由表中。
<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
# 对SwitchB的接口10GE1/0/1执行shutdown命令模拟链路故障。
[~SwitchB] interface 10ge1/0/1
[~SwitchB-10GE1/0/1] shutdown
[*SwitchB-10GE1/0/1] commit
# 查看SwitchA的路由表,发现静态缺省路由0::0/0也不存在了。因为静态缺省路由绑定了BFD会话,当BFD检测到故障后,就会迅速通知所绑定的静态路由不可用。
<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
配置文件
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
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