Huawei's BFD: Bidirectional Forwarding Check
A unified detection mechanism for quickly locating faults across the entire network.
This mechanism has nothing to do with media or protocols.
BFD encapsulates UDP packets based on port number 3784
with a packet period of 1000ms.
BFD needs to establish a connection session: rely on the relationship established by the upper-layer application
@statically establish the session-manual
@dynamically establish the session-automatic
Configuration ideas:
1. Establish physical link connectivity
2. Enable BFD function globally
3. Establish BFD session connection
- configure local identifier
- configure remote identifier
4. Activate BFD configuration
5. Combine BFD and response applications
display bfd session all
============================================== =============
AR1
#Enable BFD
bfd
quit
#Create a BFD session between local IP and peer IP
bfd 1 bind peer-ip 192.168.1.253 (peer IP) source-ip 192.168. 1.252 (local IP)
discriminator local 16 //local identifier
discriminator remote 17 //peer identifier
commit //activate BFD configuration
#Use with VRRP
interface GigabitEthernet0/0/1
ip address 192.168.1.252 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.1.254
vrrp vrid 1 priority 200
vrrp vrid 1 track bfd-session 16 //Track the local identifier of the BFD session in VRRP
vrrp vrid 1 authentication-mode md5 12345
#
------- -------------------------------------------------- --
AR2
#Enable BFD
bfd
quit
#
bfd 1 bind peer-ip 192.168.1.252 source-ip 192.168.1.253
discriminator local 17
discriminator remote 16
commit
#Use with VRRP
interface GigabitEthernet0/0/1
ip address 192.168.1.253 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.1.254
vrrp vrid 1 priority 200
vrrp vrid 1 track bfd-session 17
vrrp vrid 1 authentication-mode md5 12345
#
========================================= ==================
BFD is used in combination with static routing
#Enable BFD
bfd
quit
#
bfd 1 bind peer-ip 192.168.1.252 source-ip 192.168.1.253
discriminator local 17
discriminator remote 16
commit
#
ip route-static 0.0.0.0 0.0.0.0 1.1.1.1 track bfd-session 1
CISCO's BFD: Bidirectional Forwarding Check
Function: Millisecond-level fault detection, usually combined with three-layer protocols (such as static routing, vrrp, ospf, BGP, etc.) to implement quick detection of link faults
Configuration ideas:
R1
<Huawei>system-view //进入全局模式
[Huawei]sysname R1 //改名
[R1]undo info-center enable //关闭信息告警提示
[R1]interface LoopBack 0 //进入LoopBack 0接口
[R1-LoopBack0]ip address 1.1.1.1 24 //设置IP地址
[R1-LoopBack0]interface g0/0/0 //进入接口
[R1-GigabitEthernet0/0/0]ip address 12.1.1.1 24 //设置IP地址
[R1-GigabitEthernet0/0/0]interface g0/0/1 //进入接口
[R1-GigabitEthernet0/0/1]ip address 21.1.1.1 24 //设置IP地址
[R1-GigabitEthernet0/0/1]quit //退出
[R1]ip route-static 2.2.2.0 255.255.255.0 21.1.1.2 //配置静态路由
[R1]ip route-static 2.2.2.0 255.255.255.0 12.1.1.2 preference 70 //配置静态路由及优先级(默认为60)
<Huawei>system-view //进入全局模式
[Huawei]sysname R2 //改名
[R2]undo info-center en //关闭信息告警提示
[R2]interface LoopBack 0 //进入LoopBack 0接口
[R2-LoopBack0]ip address 2.2.2.2 24 //设置IP地址
[R2-LoopBack0]interface g0/0/0 //进入接口
[R2-GigabitEthernet0/0/0]ip address 12.1.1.2 24 //设置IP地址
[R2-GigabitEthernet0/0/0]interface g0/0/1 //进入接口
[R2-GigabitEthernet0/0/1]ip address 21.1.1.2 24 //设置IP地址
[R2-GigabitEthernet0/0/1]quit //退出
[R2]ip route-static 1.1.1.0 255.255.255.0 21.1.1.1 //配置静态路由
[R2]ip route-static 1.1.1.0 255.255.255.0 12.1.1.1 preference 70 //配置静态路由以及优先级(默认为60)
R1
[R1]dis ip routing-table //查看路由表
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 16 Routes : 14
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.0/24 Direct 0 0 D 1.1.1.1 LoopBack0
1.1.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
1.1.1.255/32 Direct 0 0 D 127.0.0.1 LoopBack0
2.2.2.0/24 Static 60 0 RD 21.1.1.2 GigabitEthernet 默认优先级的线路
0/0/1
12.1.1.0/24 Direct 0 0 D 12.1.1.1 GigabitEthernet
0/0/0
12.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
12.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
21.1.1.0/24 Direct 0 0 D 21.1.1.1 GigabitEthernet
0/0/1
21.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
21.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
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
[R1]
[R1]bfd //全局使能BFD
[R1-bfd]quit //退出
[R1]bfd 1 bind peer-ip 21.1.1.2 source-ip 21.1.1.1 //配置BFD组1
[R1-bfd-session-1]discriminator local 1 //本地标识1(标识需要相互堆成)
[R1-bfd-session-1]discriminator remote 2 //对端标识2
[R1-bfd-session-1]commit //确认提交
[R1-bfd-session-1]quit //退出
[R1]ip route-static 2.2.2.0 24 21.1.1.2 track bfd-session 1 //静态路由调用BFD
[R2]bfd //全局使能BFD
[R2-bfd]quit // 退出
[R2]bfd 1 bind peer-ip 21.1.1.1 source-ip 21.1.1.2 //配置BFD组1
[R2-bfd-session-1]discriminator local 2 //本地标识2(标识需要相互堆成)
[R2-bfd-session-1]discriminator remote 1 //对端标识1
[R2-bfd-session-1]commit //确认提交
[R2-bfd-session-1]quit //退出
[R2]ip route-static 1.1.1.0 24 21.1.1.1 track bfd-session 1 //静态路由调用BFD
R1
[R1]dis ip routing-table //查看路由表
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 16 Routes : 14
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.0/24 Direct 0 0 D 1.1.1.1 LoopBack0
1.1.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
1.1.1.255/32 Direct 0 0 D 127.0.0.1 LoopBack0
2.2.2.0/24 Static 70 0 RD 12.1.1.2 GigabitEthernet //线路已切换过来
0/0/0
12.1.1.0/24 Direct 0 0 D 12.1.1.1 GigabitEthernet
0/0/0
12.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
12.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
21.1.1.0/24 Direct 0 0 D 21.1.1.1 GigabitEthernet
0/0/1
21.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
21.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
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
[R1]
[R1]dis bfd session all //查看BFD信息
--------------------------------------------------------------------------------
Local Remote PeerIpAddr State Type InterfaceName
--------------------------------------------------------------------------------
1 2 21.1.1.2 Down S_IP_PEER -
--------------------------------------------------------------------------------
Total UP/DOWN Session Number : 0/1
[R1]
[R1]dis bfd session all verbose //查看BFD详细信息
--------------------------------------------------------------------------------
Session MIndex : 256 (Multi Hop) State : Down Name : 1
--------------------------------------------------------------------------------
Local Discriminator : 1 Remote Discriminator : 2
Session Detect Mode : Asynchronous Mode Without Echo Function
BFD Bind Type : Peer IP Address
Bind Session Type : Static
Bind Peer IP Address : 21.1.1.2
Bind Interface : -
Track Interface : -
Bind Source IP Address : 21.1.1.1
FSM Board Id : 0 TOS-EXP : 7
Min Tx Interval (ms) : 1000 Min Rx Interval (ms) : 1000
Actual Tx Interval (ms): 10500 Actual Rx Interval (ms): 10500
Local Detect Multi : 3 Detect Interval (ms) : -
Echo Passive : Disable Acl Number : -
Destination Port : 3784 TTL : 254
Proc Interface Status : Disable Process PST : Disable
WTR Interval (ms) : -
Active Multi : 3
Last Local Diagnostic : Control Detection Time Expired
Bind Application : No Application Bind
Session TX TmrID : 1036 Session Detect TmrID : -
Session Init TmrID : - Session WTR TmrID : -
Session Echo Tx TmrID : -
PDT Index : FSM-0 | RCV-0 | IF-0 | TOKEN-0
Session Description : -
--------------------------------------------------------------------------------
Total UP/DOWN Session Number : 0/1
[R1]
Ruijie’s BFD: Bidirectional Forwarding Check
------------------------------------------------------------
Reference: https://wenku.baidu.com/view/c827dd840975f46526d3e11e.html