从Device A到Device B有两条转发路径,下一跳分别为Device B和Device C。由于Device A和Device B之间物理距离较远,通过一个二层交换机L2 Switch作为中继。假设Device B不支持BFD,要求在Device A上使用静态路由与BFD联动技术,实现当Device B与二层交换机L2 Switch之间的链路出现故障(如链路down)时,Device A能快速感知,并将流量切换到Device C的链路上。
由于需要两端设备均支持BFD,才能够使用控制报文方式,本例中Device B不支持BFD,在Device A上配置的BFD功能仅能使用echo报文方式。
echo报文方式下必须配置echo报文的源IP地址。IP地址可以任意指定,不需要与实际接口地址对应。建议不要将echo报文的源IP地址配置为属于该设备任何一个接口所在网段,避免对端发送大量的ICMP重定向报文造成网络拥塞。
(1) 配置Device A各接口的IP地址
system-view
[DeviceA] interface ten-gigabitethernet 3/0/1
[DeviceA-Ten-GigabitEthernet3/0/1] ip address 192.168.10.101 24
[DeviceA-Ten-GigabitEthernet3/0/1] quit
(2) 请参考以上方法配置如图中其它接口的IP地址,配置步骤这里省略
1.1.2 配置静态路由
(1) 配置Device A
# 配置Device A到192.168.50.0/24网段的静态路由,Device A到Device B的流量优先走Device A –> L2 Switch–> Device B链路,当此链路发生故障时,流量切换到Device A –> Device C–> Device B链路上。
[DeviceA] ip route-static 192.168.50.0 24 ten-gigabitethernet 3/0/1 192.168.10.102 bfd echo-packet
[DeviceA] ip route-static 192.168.50.0 24 ten-gigabitethernet 3/0/2 192.168.20.102 preference 65
(2) 配置Device B
# 配置Device B到192.168.40.0/24网段的静态路由,Device B到Device A的流量优先走Device B –> L2 Switch–> Device A链路,当此链路发生故障时,流量切换到Device B –> Device C–> Device A链路上。
[DeviceB] ip route-static 192.168.40.0 24 ten-gigabitethernet 3/0/1 192.168.10.101
[DeviceB] ip route-static 192.168.40.0 24 ten-gigabitethernet 3/0/2 192.168.30.102 preference 65
(3) 配置Device C
# 配置Device C到192.168.40.0/24和192.168.50.0/24网段的静态路由。
[DeviceC] ip route-static 192.168.40.0 24 ten-gigabitethernet 3/0/1 192.168.20.101
[DeviceC] ip route-static 192.168.50.0 24 ten-gigabitethernet 3/0/2 192.168.30.101
1.1.3 配置Device A的BFD功能
# 静态路由支持的BFD会话方式为echo报文方式,该方式下必须配置BFD echo报文的源IP地址。IP地址可以任意指定,不需要与实际接口地址对应。建议不要将BFD echo报文的源IP地址配置为属于该设备任何一个接口所在网段。
[DeviceA] bfd echo-source-ip 10.10.10.10
# 配置接口接收BFD echo报文的最小时间间隔为100ms,单跳BFD检测时间倍数为3。
[DeviceA] interface ten-gigabitethernet 3/0/1
[DeviceA-Ten-GigabitEthernet3/0/1] bfd min-echo-receive-interval 100
[DeviceA-Ten-GigabitEthernet3/0/1] bfd detect-multiplier 3
[DeviceA-Ten-GigabitEthernet3/0/1] quit
1.2 验证配置
(1) Device A和Device B设备及之间的链路均正常工作时
# 在Device A查看静态路由信息。
[DeviceA] display ip routing-table protocol static
Summary Count : 1
Static Routing table Status :
Summary Count : 1
Destination/Mask Proto Pre Cost NextHop Interface
Static Routing table Status :
Summary Count : 0
以上显示信息表示Device A经过L2 Swich到达Device B。
# 查看BFD会话。
[DeviceA] display bfd session
Total Session Num: 1 Up Session Num: 1 Init Mode: Active
IPv4 Session Working Under Echo Mode:
LD/RD SourceAddr DestAddr State Holdtime Interface
67 192.168.10.101 192.168.10.102 Up 2000ms XGE3/0/1
以上显示信息表示BFD会话已经创建。
(2) Device B与L2 Switch之间的链路出现故障时
# 查看静态路由。
[DeviceA] display ip routing-table protocol static
Summary Count : 1
Static Routing table Status :
Summary Count : 1
Destination/Mask Proto Pre Cost NextHop Interface
192.168.50.0/24 Static 65 0 192.168.20.102 XGE3/0/2
Static Routing table Status :
Summary Count : 0
以上显示信息表示Device A经过Device C到达Device B。