BFD----双向链路检测机制
实现毫秒级切换线路
是一种全网统一的测试机制,用于快速检测、监控网络中链路或者IP路由的转发联通状况
BFD本质上是为了测试链路的连通性,发送与ping类似的报文,即BFD报文,会有个目的IP,若失联则断。
在静态路由中使用
配置IP地址:
R1:
int g0/0/0
ip address 10.1.12.2 24
int g0/0/1
ip ad 10.1.23.2 24
R2:
int g0/0/0
ip ad 10.1.12.1 24
int g0/0/1
ip address 10.1.134.1 24
R3:
int g0/0/0
ip ad 10.1.23.1 24
int g0/0/1
ip address 10.1.134.2 24
R4:
int g0/0/0
ip ad 10.1.134.3 24
int l0
ip ad 10.9.9.1 24
配置静态路由
R1:
ip route-static 10.9.9.0 24 10.1.12.1
ip route-static 10.9.9.0 24 10.1.23.1 preference 80
R2:
ip route-static 0.0.0.0 0 10.1.134.3
R3:
ip route-static 0.0.0.0 0 10.1.134.3
R4:
ip route-static 10.1.12.0 24 10.1.134.1
ip route-static 10.1.23.0 24 10.1.134.2
查看R1路由表
可以看到去往10.9.9.0网关为10.1.12.1,即从左边走
进入交换机 将于R相连的端口关闭
SW1:
int g0/0/1
shutdown
再查看R1路由表
发现去往10.9.9.0 24的网关变成10.1.23.1,即走右边
再次来到SW1,将SW1的G0/0/2接口关掉,与路由器直连的端口打开
SW1:
int g0/0/1
undo shutdown
int g0/0/2
shutdown
来到R1查看路由表
发现并没有切换,但10.1.12.1不通
为了使路由器感知到,需要使用BFD
BFD应用:需要一个标识符来判断是不是要回包
local:本地 remote:远端
盒式交换机,框式交换机
R1:
bfd
q
bfd aa bind peer-ip 10.1.12.1
discriminator local 10
discriminator remote 20
commit
R2:
bfd
q
bfd bb bind peer-ip 10.1.12.2
discriminator remote 10
discriminator local 20
commit
来到R1 发现启动成功
在R1上写静态路由
ip route-static 10.9.9.0 24 10.1.12.1 track bfd-session aa
配置完成
进入SW1将G0/0/2 shutdown
SW1:
int g0/0/2
shutdown
回到R1发现BFD状态变为Down
同时R1的网关也切换过来了