324、双向转发检查,作用:毫秒级的故障检查,通常结合三层协议(如:静态路由、vrrp、ospf、bgp等)实现链路故障快速检查;
325、BFD实验:
实验topo:
实验步骤:
按照topo配置接口——>分别给两个路由器实现主备:
R1:
#
interface Ethernet0/0/0
ip address 12.1.1.1 255.255.255.0
#
interface Ethernet0/0/1
ip address 21.1.1.1 255.255.255.0
##
interface LoopBack0
ip address 1.1.1.1 255.255.255.0
#
ip route-static 0.0.0.0 0.0.0.0 12.1.1.2
ip route-static 0.0.0.0 0.0.0.0 21.1.1.2 preference 70
#
R2:
#
interface Ethernet0/0/0
ip address 12.1.1.2 255.255.255.0
#
interface Ethernet0/0/1
ip address 21.1.1.2 255.255.255.0
#
#
interface LoopBack0
ip address 2.2.2.2 255.255.255.0
#
ip route-static 0.0.0.0 0.0.0.0 12.1.1.1
ip route-static 0.0.0.0 0.0.0.0 21.1.1.1
#
测试两个环回口能否通信:
如果12.1.1.x段与对端路由器之间出现链路故障,那么R1的接口并没有宕掉,所以路由并不会切换至备份路由,但是链路是不通的,因此就需要配置BFD来在链路之间发送报文做链路完整性检测;
BFD配置:
R1:
#
bfd 全局使能BFD;
#
bfd 1 bind peer-ip 12.1.1.2 source-ip 12.1.1.1 配置BFD绑定,对端IP地址以及源IP地址
discriminator local 1 申明本地标识
discriminator remote 2 申明对端标识
commit 提交配置
#
R2:
#
bfd 全局使能BFD;
#
bfd 1 bind peer-ip 12.1.1.1 source-ip 12.1.1.2 配置BFD绑定,对端IP地址以及源IP地址
discriminator local 2
discriminator remote 1
commit
#
在静态路由下调用BFD:
R 1:
#
ip route-static 2.2.2.0 255.255.255.0 12.1.1.2 track bfd-session 1
#
R2:
#
ip route-static 1.1.1.0 255.255.255.0 12.1.1.1 track bfd-session 1
#
如图所示断开连接:
测试连通性:(路由已经切换)
查看BFD的会话状态:
#
dis bfd session all
#
查看BFD的明细信息:
#
dis bfd session all verbose
#
查看BFD的探测报文:
326、OSPF调用BFD加快收敛时间:
实验topo:
实验步骤:
配置基本参数,打通网络,并配置ospf路由:
R 1 :
#
ospf 1
area 0.0.0.0
network 1.1.1.0 0.0.0.255
network 12.1.1.0 0.0.0.255
#
R2:
#
ospf 1
area 0.0.0.0
network 2.2.2.0 0.0.0.255
network 12.1.1.0 0.0.0.255
#
此时,如果链路断开,路由不会立刻切换,ospf 自己的探测报文收敛时间为40s,因此不会立即切换路由,需要等一段时间过后才会知道链路断开;
查看ospf接口状态:
#
dis ospf interface E0/0/0
#
ospf 的hello报文:
在ospf中调用bfd:
R1 :
#
ospf 1
bfd all-interfaces enable
#
R2:
#
ospf 1
bfd all-interfaces enable
#
327、tips:如果想要交换机的端口收敛时间快,需要将交换机的接口加入边缘端口中:
#
stp edged-port enable
#
查看bfd 的会话状态: