配置动态BFD检测IPv4静态路由示例
利用动态BFD检测IPv4静态路由,可以快速检测链路故障。
组网需求
如图3-4所示,DeviceA通过SwithC和DeviceB相连。在DeviceA上配置静态缺省路由可以与外部进行正常通信。在DeviceA和DeviceB之间配置BFD会话检测链路是否发生故障。
操作步骤
- 配置各接口IP地址(略)
- 配置静态路由
# 在DeviceA上配置到2.2.2.2/32的静态路由。
[~DeviceA] ip route-static 2.2.2.2 32 10.10.1.2
[*DeviceA] commit
# 在DeviceA上查看IP路由表,静态路由存在于路由表中。
[~DeviceA] display ip routing-table
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ------------------------------------------------------------------------------ Routing Table : _public_ Destinations : 10 Routes : 10 Destination/Mask Proto Pre Cost Flags NextHop Interface 1.1.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack0 2.2.2.2/32 Static 60 0 RD 10.10.1.2 GigabitEthernet0/1/0 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 127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 10.10.1.0/24 Direct 0 0 D 10.10.1.1 GigabitEthernet0/1/0 10.10.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/1/0 10.10.1.2/32 Direct 0 0 D 10.10.1.2 GigabitEthernet0/1/0 10.10.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/1/0
# 在DeviceB上配置到1.1.1.1/32的静态路由。
[~DeviceB] ip route-static 1.1.1.1 32 10.10.1.1
[*DeviceB] commit
- 配置动态BFD检测静态路由
# 在DeviceA上配置静态路由绑定BFD会话。
[~DeviceA] bfd
[*DeviceA-bfd] quit
[*DeviceA] ip route-static bfd 10.10.1.2 local-address 10.10.1.1
[*DeviceA] ip route-static 2.2.2.2 32 10.10.1.2 bfd enable
[*DeviceA] commit
# 在DeviceB上配置静态路由绑定BFD会话。
[~DeviceB] bfd
[*DeviceB-bfd] quit
[*DeviceB] ip route-static bfd 10.10.1.1 local-address 10.10.1.2
[*DeviceB] ip route-static 1.1.1.1 32 10.10.1.1 bfd enable
[*DeviceB] commit
- 验证配置结果
# 配置完成后,在DeviceA和DeviceB上可以看到BFD会话已经建立,且状态为Up,而且可以看到静态路由已经绑定BFD会话。
以DeviceA上的显示为例。
[~DeviceA] display bfd session all verbose
(w): State in WTR (*): State is invalid ------------------------------------------------------------------------------ (Multi Hop) State : Up Name : dyn_8193 ------------------------------------------------------------------------------ Local Discriminator : 8193 Remote Discriminator : 8193 Session Detect Mode : Asynchronous Mode Without Echo Function BFD Bind Type : Peer IP Address Bind Session Type : Dynamic Bind Peer IP Address : 10.10.1.2 Bind Interface : - Bind Source IP Address : 10.10.1.1 FSM Board Id : 0 TOS-EXP : 7 Min Tx Interval (ms) : 50 Min Rx Interval (ms) : 50 Actual Tx Interval (ms): 50 Actual Rx Interval (ms): 50 Local Detect Multi : 3 Detect Interval (ms) : 150 Echo Passive : Disable Acl Number : - Destination Port : 4784 TTL : 253 Proc Interface Status : Disable Process PST : Disable WTR Interval (ms) : 0 Local Demand Mode : Disable Active Multi : 3 Last Local Diagnostic : No Diagnostic Bind Application : STATICRT Session TX TmrID : 0 Session Detect TmrID : 0 Session Init TmrID : - Session WTR TmrID : - Session Echo Tx TmrID : - Session Description : - ------------------------------------------------------------------------------ Total UP/DOWN Session Number : 1/0
配置文件
DeviceA的配置文件
# sysname DeviceA # bfd # interface GigabitEthernet0/1/0 undo shutdown ip address 10.10.1.1 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown ip address 7.7.7.7 255.255.255.0 # interface LoopBack0 ip address 1.1.1.1 255.255.255.255 # ip route-static bfd 10.10.1.2 local-address 10.10.1.1 ip route-static 2.2.2.2 32 10.10.1.2 bfd enable # return
DeviceB的配置文件
# sysname DeviceB # bfd # interface GigabitEthernet0/1/0 undo shutdown ip address 10.10.1.2 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown ip address 8.8.8.8 255.255.255.0 # interface LoopBack0 ip address 2.2.2.2 255.255.255.255 # ip route-static bfd 10.10.1.1 local-address 10.10.1.2 ip route-static 1.1.1.1 32 10.10.1.1 bfd enable # return