BFD技术

BFD技术与静态路由

BFD:Bidirectional Forwarding Detection,双向转发检查
作用:毫秒级故障检查,通常结合三层协议(如静态路由、vrrp、ospf、BGP等)实现链路故障快速检查。
在这里插入图片描述

R1:
	<Huawei>sys
	Enter system view, return user view with Ctrl+Z.
	[Huawei]un in en
	Info: Information center is disabled.
	[Huawei]sysname R1
	[R1]int g0/0/1
	[R1-GigabitEthernet0/0/1]ip addr 12.1.1.1 24
	[R1-GigabitEthernet0/0/1]int g0/0/0
	[R1-GigabitEthernet0/0/0]ip addr 21.1.1.1 24
	[R1-GigabitEthernet0/0/0]int loopback 0
	[R1-LoopBack0]ip addr 1.1.1.1 24
	[R1-LoopBack0]quit
	[R1]ip route-static 2.2.2.0 24 12.1.1.2
	[R1]ip route-static 2.2.2.0 24 21.1.1.2 preference 70
	
R2:
	<Huawei>sys	
	<Huawei>system-view 
	Enter system view, return user view with Ctrl+Z.
	[Huawei]un in en
	Info: Information center is disabled.
	[Huawei]sysname R2
	[R2]int g0/0/1
	[R2-GigabitEthernet0/0/1]ip addr 12.1.1.2 24
	[R2-GigabitEthernet0/0/1]int g0/0/0
	[R2-GigabitEthernet0/0/0]ip addr 21.1.1.2 24
	[R2-GigabitEthernet0/0/0]int loopback 0
	[R2-LoopBack0]ip addr 2.2.2.2 24
	[R2-LoopBack0]quit
	[R2]ip route-static 1.1.1.0 24 12.1.1.1
	[R2]ip route-static 1.1.1.0 24 21.1.1.1 preference 70

一般来说我们的链路不是上面的样子,而是像下图这样
在这里插入图片描述
如果说我们没有配置BFD技术的话,发生了下图这样的链路错误
在这里插入图片描述
如果出现以上的链路故障的话,我们在来测试1.1.1.1与2.2.2.2的通信

[R1]
	ping -a 1.1.1.1 2.2.2.2
    PING 2.2.2.2: 56  data bytes, press CTRL_C to break
    Request time out
    Request time out
    Request time out
    Request time out
    Request time out
	--- 2.2.2.2 ping statistics ---
    5 packet(s) transmitted
    0 packet(s) received
    100.00% packet loss
    
[R1]ping -a 1.1.1.1 2.2.2.2
    PING 2.2.2.2: 56  data bytes, press CTRL_C to break
    Request time out
    Request time out
    Request time out
    Request time out
    Request time out
	--- 2.2.2.2 ping statistics ---
    5 packet(s) transmitted
    0 packet(s) received
    100.00% packet loss

这时候我们就需要配置BFD技术了

R1:
	[R1]bfd
	[R1-bfd]quit
	[R1]bfd 1 bind peer-ip 12.1.1.2 source-ip 12.1.1.1
	[R1-bfd-session-1]discriminator local 1
	[R1-bfd-session-1]discriminator remote 2
	[R1-bfd-session-1]commit 
	[R1-bfd-session-1]quit
	[R1]ip route-static 2.2.2.0 24 12.1.1.2 track bfd-session 1
	Info: Succeeded in modifying route.
	
R2:
	[R2]bfd
	[R2-bfd]quit
	[R2]bfd 1 bind peer-ip 12.1.1.1 source-ip 12.1.1.2
	[R2-bfd-session-1]discriminator local 2
	[R2-bfd-session-1]discriminator remote 1
	[R2-bfd-session-1]commit
	[R2]ip route-static 1.1.1.0 24 12.1.1.1 track bfd-session 1
	Info: Succeeded in modifying route.

此时我们再次出现链路故障的话,也是丢了几个包而已
在这里插入图片描述
此时我们再看我们的bfd检测就发现下面那条路由已经down了

[R1]display bfd session all 
--------------------------------------------------------------------------------
Local Remote     PeerIpAddr      State     Type        InterfaceName            
--------------------------------------------------------------------------------

1     2          12.1.1.2        Down      S_IP_PEER         -                  
--------------------------------------------------------------------------------
Total UP/DOWN Session Number : 0/1

通过这条命令查看bfd的详细信息

[R1]display bfd session all verbose 

以上就是关于BFD与静态路由联动的实验!

©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页