配置静态BFD for IPv6静态路由示例
需要增强IPv6网络可靠性时,利用IPv6静态路由绑定BFD会话,可以快速检测链路故障,提高路由的收敛速度。
组网需求
如图4-4所示,DeviceA通过SwithC和DeviceB相连。在DeviceA上配置静态缺省路由可以与外部进行正常通信。同时,在DeviceA和DeviceB之间配置BFD会话来快速检测链路故障。
配置思路
采用如下思路配置静态BFD for IPv6静态路由:
在DeviceA和DeviceB上配置BFD会话,检测DeviceA和DeviceB之间的链路。
配置DeviceA到外部的缺省路由并绑定BFD会话。
操作步骤
- 配置各接口IPv6地址(略)
- 配置DeviceA和DeviceB之间的BFD会话
# 在DeviceA上配置与DeviceB之间的BFD Session。
<DeviceA> system-view
[~DeviceA] bfd
[*DeviceA-bfd] quit
[*DeviceA] bfd aa bind peer-ipv6 2001:db8:1::2
[*DeviceA-bfd-session-aa] discriminator local 10
[*DeviceA-bfd-session-aa] discriminator remote 20
[*DeviceA-bfd-session-aa] commit
[~DeviceA-bfd-session-aa] quit
# 在DeviceB上配置与DeviceA之间的BFD Session。
<DeviceB> system-view
[~DeviceB] bfd
[*DeviceB-bfd] quit
[*DeviceB] bfd bb bind peer-ipv6 2001:db8:1::1
[*DeviceB-bfd-session-bb] discriminator local 20
[*DeviceB-bfd-session-bb] discriminator remote 10
[*DeviceB-bfd-session-bb] commit
[~DeviceB-bfd-session-bb] quit
- 配置静态缺省路由并绑定BFD会话
# 在DeviceA上配置到外部网络的静态缺省路由,并绑定BFD会话aa。
[~DeviceA] ipv6 route-static 0::0 0 2001:db8:1::2 track bfd-session aa
- 验证配置结果
# 配置完成后,在DeviceA和DeviceB上执行display bfd session all命令,可以看到BFD会话已经建立,且状态为Up。在系统视图下执行display current-configuration | include bfd命令,可以看到静态路由已经绑定BFD会话。
以DeviceA上的显示为例。
[~DeviceA] display bfd session all
(w): State in WTR (*): State is invalid -------------------------------------------------------------------------------- Local Remote PeerIpAddr State Type InterfaceName -------------------------------------------------------------------------------- 10 20 2001:db8:1::2 Up S_IP_PEER - -------------------------------------------------------------------------------- Total UP/DOWN Session Number : 1/0
[~DeviceA] display current-configuration | include bfd
bfd bfd aa bind peer-ipv6 2001:db8:1::2 ipv6 route-static :: 0 2001:db8:1::2 track bfd-session aa
# 在DeviceA上查看IP路由表,静态路由存在于路由表中。
[~DeviceA] display ipv6 routing-table
Routing Table : _public_ Destinations : 5 Routes : 5 Destination : :: PrefixLength : 0 NextHop : 2001:db8:1::2 Preference : 60 Cost : 0 Protocol : Static RelayNextHop : :: TunnelID : 0x0 Interface : GigabitEthernet 0/1/0 Flags : RD Destination : ::1 PrefixLength : 128 NextHop : ::1 Preference : 0 Cost : 0 Protocol : Direct RelayNextHop : :: TunnelID : 0x0 Interface : InLoopBack0 Flags : D Destination : 2001:db8:1:: PrefixLength : 64 NextHop : 2001:db8:1::1 Preference : 0 Cost : 0 Protocol : Direct RelayNextHop : :: TunnelID : 0x0 Interface : GigabitEthernet 0/1/0 Flags : D Destination : 2001:db8:1::1 PrefixLength : 128 NextHop : ::1 Preference : 0 Cost : 0 Protocol : Direct RelayNextHop : :: TunnelID : 0x0 Interface : GigabitEthernet 0/1/0 Flags : D Destination : FE80:: PrefixLength : 10 NextHop : :: Preference : 0 Cost : 0 Protocol : Direct RelayNextHop : :: TunnelID : 0x0 Interface : NULL0 Flags : D
# 对DeviceB的接口GE0/1/0执行shutdown命令模拟链路故障。
[~DeviceB] interface GigabitEthernet 0/1/0
[~DeviceB-GigabitEthernet0/1/0] shutdown
# 查看DeviceA的路由表,发现静态缺省路由0::0/0也不存在了。因为静态缺省路由绑定了BFD会话,当BFD检测到故障后,就会迅速通知所绑定的静态路由不可用。
[~DeviceA] display ipv6 routing-table
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
配置文件
DeviceA的配置文件
# sysname DeviceA # ipv6 # bfd # interface GigabitEthernet 0/1/0 undo shutdown ipv6 enable ipv6 address 2001:db8:1::1/64 # ipv6 route-static :: 0 2001:db8:1::2 track bfd-session aa # bfd aa bind peer-ipv6 2001:db8:1::2 discriminator local 10 discriminator remote 20 # return
DeviceB的配置文件
# sysname DeviceB # ipv6 # bfd # interface GigabitEthernet 0/1/0 undo shutdown ipv6 enable ipv6 address 2001:db8:1::2/64 # interface GigabitEthernet0/2/0 undo shutdown ipv6 enable ipv6 address 2001:db8:2::1/64 # bfd bb bind peer-ipv6 2001:db8:1::1 discriminator local 20 discriminator remote 10 # return