组网需求
如图1所示,SwitchA通过SwitchB和NMS跨网段相连。在SwitchA上通过静态路由与NMS进行正常通信。在SwitchA和SwitchB之间实现毫秒级故障感知,提高收敛速度
配置思路
采用如下思路配置IPv4静态路由与静态BFD联动:
-
在SwitchA和SwitchB上配置BFD Session,在SwitchA和SwitchB之间实现毫秒级故障感知,提高收敛速度。
-
配置SwitchA到NMS的静态路由并绑定BFD Session,实现毫秒级故障感知,提高收敛速度。
操作步骤
配置各接口所属的VLAN
# 配置SwitchA。SwitchB的配置与SwitchA类似
[zhongwanzhiA]vlan 10
[zhongwanzhiA]interface GigabitEthernet 0/0/1
[zhongwanzhiA-GigabitEthernet0/0/1]port link-type trunk
[zhongwanzhiA-GigabitEthernet0/0/1]port trunk allow-pass vlan 10
[zhongwanzhiA-GigabitEthernet0/0/1]quit
配置各VLANIF接口的IP地址
# 配置SwitchA。SwitchB的配置与SwitchA类似
[zhongwanzhiA]interface Vlanif 10
[zhongwanzhiA-Vlanif10]ip add
[zhongwanzhiA-Vlanif10]ip address 10.1.1.1 24
[zhongwanzhiA-Vlanif10]quit
配置SwitchA和SwitchB间的BFD会话
# 在SwitchA配置与SwitchB间的BFD Session。
[zhongwanzhiA]bfd
[zhongwanzhiA-bfd]quit
[zhongwanzhiA]bfd aa bind peer-ip 10.1.1.2
[zhongwanzhiA-bfd-session-aa]discriminator local 10
[zhongwanzhiA-bfd-session-aa]discriminator remote 20
[zhongwanzhiA-bfd-session-aa]commit
[zhongwanzhiA-bfd-session-aa]quit
# 在SwitchB配置与SwitchA之间的BFD Session。
[zhongwanzhiB]bfd
[zhongwanzhiB-bfd]quit
[zhongwanzhiB]bfd bb bind peer-ip 10.1.1.1
[zhongwanzhiB-bfd-session-bb]discriminator local 20
[zhongwanzhiB-bfd-session-bb]discriminator remote 10
[zhongwanzhiB-bfd-session-bb]commit
[zhongwanzhiB-bfd-session-bb]quit
配置静态路由并绑定BFD会话
# 在SwitchA配置到外部网络的静态路由,并绑定BFD会话aa
[zhongwanzhiA]ip route-static 10.2.2.0 24 10.1.1.2 track bfd-session aa
验证配置结果
# 配置完成后,在SwitchA和SwitchB上执行display bfd session all命令,可以看到BFD会话已经建立,且状态为Up。SwitchA上的显示为例。
[zhongwanzhiA]display bfd session all
--------------------------------------------------------------------------------
Local Remote PeerIpAddr State Type InterfaceName
--------------------------------------------------------------------------------
10 20 10.1.1.2 Up S_IP_PEER -
--------------------------------------------------------------------------------
Total UP/DOWN Session Number : 1/0
# 在SwitchA查看IP路由表,静态路由存在于路由表中
[zhongwanzhiA]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 5 Routes : 5
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.1.1.0/24 Direct 0 0 D 10.1.1.1 Vlanif10
10.1.1.1/32 Direct 0 0 D 127.0.0.1 Vlanif10
10.2.2.0/24 Static 60 0 RD 10.1.1.2 Vlanif10
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[zhongwanzhiA]
为什么要做BDF会话服 :因为当BFD检测到链路恢复正常后,就会迅速通知所绑定的静态路由重新生效