华为BFD实验_第1张图片

BFD在两台网络设备上建立会话,用来检测网络设备间的双向转发路径,为上层应用服务。BFD本身并没有邻居发现机制,而是靠被服务的上层应用通知其邻居信息以建立会话。会话建立后会周期性地快速发送BFD报文,如果在检测时间内没有收到BFD报文则认为该双向转发路径发生了故障,通知被服务的上层应用进行相应的处理。下面以OSPF与BFD联动为例,简单介绍会话工作流程。

SW2的配置
接口配置:
interface Ethernet0/0/1
port link-type access
port default vlan 10
interface Ethernet0/0/2
port link-type access
port default vlan 20
interface Ethernet0/0/3
port link-type trunk
port trunk allow-pass vlan 2 to 4094
interface Ethernet0/0/4
port link-type trunk
port trunk allow-pass vlan 2 to 4094

SW1的配置
Vlan1的地址标识的是与上层交换机连动
interface Vlanif1
ip address 192.168.1.1 255.255.255.0

interface Vlanif10
ip address 192.168.10.252 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.10.254
vrrp vrid 1 priority 120
vrrp vrid 1 track bfd-session 10 reduced 30
//指定vrrp需要发送的bfd-session 10(本端标识符)
//配置BFD快速收敛
Peer-ip// 对端的地址 自己的接口和自己的地址
bfd 1 bind peer-ip 192.168.1.2 interface Vlanif1 source-ip 192.168.1.1
discriminator local 10 //本地标识符
discriminator remote 100 //远端标识符。
commit
interface Vlanif20
ip address 192.168.20.252 255.255.255.0
vrrp vrid 2 virtual-ip 192.168.20.254

interface MEth0/0/1

interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094

SW2配置:
interface Vlanif2
ip address 192.168.2.1 255.255.255.0

interface Vlanif10
ip address 192.168.10.253 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.10.254

interface Vlanif20
ip address 192.168.20.253 255.255.255.0
vrrp vrid 2 virtual-ip 192.168.20.254
vrrp vrid 2 priority 120
vrrp vrid 2 track bfd-session 20 reduced 30
Vrrp需要发送与bfd本端端口标识符必须一致

interface MEth0/0/1

interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094

interface GigabitEthernet0/0/2
port link-type access
port default vlan 2

Peer-ip //对端的IP地址 int vlan2 //自己的接口地址与IP地址
bfd 2 bind peer-ip 192.168.2.2 interface Vlanif2 source-ip 192.168.2.1
discriminator local 20 //本端标识符
discriminator remote 101 //对端标识符
Commit

AR1配置:
interface GigabitEthernet0/0/0
ip address 192.168.1.2 255.255.255.0

interface GigabitEthernet0/0/1
ip address 192.168.2.2 255.255.255.0

双向转发检测BFD peer-ip //对端的IP地址 int G0/0/0 //自己的接口与IP地址
bfd 1 bind peer-ip 192.168.1.1 interface GigabitEthernet0/0/0 source-ip 192.168.1.2
因为双点双向,所以本端标识符是BFD对等体对端标识符 对端标识符是BFD对等体的本端标识符
discriminator local 100 //本端标识符
discriminator remote 10//对端标识符
commit

双向转发检测BFD
bfd 2 bind peer-ip 192.168.2.1 interface GigabitEthernet0/0/1 source-ip 192.168.2.1
discriminator local 101 //本端标识符
discriminator remote 20//对端标识符
commit