思科BFD配置&详细解释


前言

BFD(Bidirectional Forwarding Detection,双向转发检测)协议提供一种轻负载、快速检测两台邻接路由器之间转发路径连通状态的方法。协议邻居通过该方式可以快速检测到转发路径的连通故障,加快启用备份转发路径,提升现有网络性能。
通过cisco路由器能使BFD特性使得路由切换达到毫秒级
《参考白皮书》-来自思科官方文档

一、静态路由&关联BFD

书中关于BFD关联静态路由"Example: Configuring BFD Support for Static Routing提及到:BFD必须双向配置
" In the following example, the network consists of Device A and Device B. Serial interface 2/0 on Device A is connected to the same network as serial interface 2/0 on Device B. In order for the BFD session to come up, Device B must be configured.

#BRD配置命令
router(config-if)#bfd interval {50-9999 in milliseconds} min_rx {50-9999 in millicseconds} multiplier {3-50}
router(config)#ip route static bfd {interface type}  {Interface number}  {gateway address}
router(config)#ip route {network address} {network mask} {interface(which bfd enabled)} {next-hop address}
-----------------------------------
©著作权归作者所有:来自51CTO博客作者起司网络狗的原创作品,如需转载,请与作者联系,否则将追究法律责任
双向链路检测(BFD)之静态路由篇
https://blog.51cto.com/u_14851874/2506259

1.图示

图中使用Serial线路连接,为什么使用Serial 线路连接?

因为Serial线路不像MSTP、以太网线路,一端down,另一端也会down
在这里插入图片描述

2.BFD&静态路由配置

R1
interface Serial 1/1
ip address 10.201.201.1 255.255.255.0
bfd interval 500 min_rx 500 multiplier 5#接口下调用bfd参数,bfd 消失。接口down
ip route static bfd Serial 1/1 10.201.201.2# bfd track 路由,当bfd down 时,此路由消失,建立bfd 邻居关系
ip route 10.201.201.2 255.255.255.255 Serial1/1 10.201.201.2#路由配置
R2
interface Serial 1/1
ip address 10.201.201.2 255.255.255.0
bfd interval 500 min_rx 500 multiplier 5#接口下调用bfd参数
ip route static bfd Serial 1/1 10.201.201.1# 关联探测
ip route 10.201.201.1 255.255.255.255 Serial1/1 10.201.201.1#路由配置

3.使用BFD协议达到双出口冗余

在这里插入图片描述
R1,R2,R4之间运行OSPF路由协议,R3配置8.8.8.8的路由

R3
interface Ethernet0/0
 ip address 13.1.1.3 255.255.255.0
 bfd interval 500 min_rx 500 multiplier 3
end
interface Ethernet0/1
 ip address 23.2.2.3 255.255.255.0
 bfd interval 500 min_rx 500 multiplier 3
end
ip route static bfd Ethernet0/0 13.1.1.1#探测
ip route static bfd Ethernet0/1 23.2.2.2#探测
ip route 0.0.0.0 0.0.0.0 Ethernet0/0 13.1.1.1#路由
ip route 0.0.0.0 0.0.0.0 Ethernet0/1 23.2.2.2#路由
R1
!
interface Ethernet0/0
 ip address 13.1.1.1 255.255.255.0
 bfd interval 500 min_rx 500 multiplier 3
end
ip route static bfd Ethernet0/0 13.1.1.3 unassociate
##这里说明一下unassociate这个参数,在正常情况下需要有一条静态路由的关联到接口上时才能生效,但是有了这个参数就可以在没有任何路由的情况下生效。这里只做了互联网连接运营商无法知道也不能知道任何内部的路由,因此需要做这条参数

双向链路检测(BFD)之静态路由篇-51CTO博客

二、OSPF路由&关联BFD

1.图示

在这里插入图片描述

2.配置说明

图中配置为ospf 全互联状态,在整个ospf 1 area 0 中,使用接口加入ospf的配置方式

R2
interface Loopback0
 ip address 2.2.2.2 255.255.255.255
 ip ospf 1 area 0
interface Ethernet0/0
 ip address 23.1.1.2 255.255.255.0
 ip ospf 1 area 0
interface Ethernet0/1
 ip address 28.1.1.2 255.255.255.0
 ip ospf 1 area 0
R3
interface Loopback0
 ip address 3.3.3.3 255.255.255.255
 ip ospf 1 area 0
interface Ethernet0/0
 ip address 23.1.1.3 255.255.255.0
 ip ospf 1 area 0
interface Ethernet0/1
 ip address 37.1.1.3 255.255.255.0
 ip ospf 1 area 0
 bfd interval 50 min_rx 50 multiplier 3
interface Ethernet0/2
R7
interface Loopback0
 ip address 7.7.7.7 255.255.255.255
 ip ospf 1 area 0
interface Ethernet0/0
 ip address 37.1.1.7 255.255.255.0
 ip ospf 1 area 0
 bfd interval 50 min_rx 50 multiplier 3
interface Ethernet0/1
 ip address 78.1.1.7 255.255.255.0
 ip ospf 1 area 0
 bfd interval 50 min_rx 50 multiplier 3
interface Ethernet0/2
 no ip address
 shutdown
interface Ethernet0/3
 no ip address
 shutdown
 bfd all-interfaces
R8
interface Loopback0
 ip address 8.8.8.8 255.255.255.255
 ip ospf 1 area 0
interface Ethernet0/0
 ip address 28.1.1.8 255.255.255.0
 ip ospf 1 area 0
interface Ethernet0/1
 ip address 78.1.1.8 255.255.255.0
 ip ospf 1 area 0
 bfd interval 50 min_rx 50 multiplier 3
interface Ethernet0/2
 no ip address
 shutdown
interface Ethernet0/3
 no ip address
 shutdown
 bfd all-interfaces

现在R7trace R2(2.2.2.2)发现走的是负载的状态
在这里插入图片描述
为达到实验效果:先配置R7使其走一边

R7
interface  ethernet 0/0
ip ospf cost 200#增大cost 、使其次优
#cost更改方法:数据的出方向和路由的入方向

更改cost发现,R7去往2.2.2.2 走eth0/1
在这里插入图片描述现在在R7,R3,R8上查看bfd neighbor
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
现在我们将R8eth0/1断掉,查看路径是否更改、bfd是否down 、邻居是否down、以及R7接口是否、现在可以R7长pingR2,来检验BFD检测速度。

此时发现,R8的 BFD neighbor down 接口down,与R7的邻居也down
在这里插入图片描述

在这里插入图片描述
我们来看R7 bfd down ,接口未down。并且邻居消失
在这里插入图片描述

接口未down 与静态路由不大一样。我记得静态路由的话接口会down。可能是因为协议的处理逻辑不一样,静态路由要消失的话,需要接口消失。而动态路由消失邻居消失就可以了

在这里插入图片描述
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Y13yrzFG-1667303110359)(https://img-youblog.csdnimg.cn/abfa82d0c40e416b8ba99fcb6289dd04.png)]
此时,R7长ping R2产生了路径切换,仅仅丢3个包,可以说是无感知了,不愧是高级协议,真棒!恢复R8eth0/1,R7选路又恢复eth0/1.,侧面验证了cost越小越优先。在这里插入图片描述

总结

ospf 与bfd关联,需要在接口下配置bfd 时间参数,还要在进程下启用该接口的bfd

int eth0/1
bfd interval 500 min_rx 500 multiplier 3
ip ospf bfd 或者router ospf 进程下 bfd all-interfaces

在这里插入图片描述

  • 3
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
思科BGP配置中,可以使用BFD(Bidirectional Forwarding Detection)来改善BGP会话的快速检测和恢复。BFD是一种快速检测链路故障的机制,能够在毫秒级别检测到故障并通知BGP进程进行相应的处理。 要配置BFD,首先需要确保BFD的支持和激活。在BGP配置中,可以使用以下命令来配置BFD: ``` router bgp <AS号> bfd all-interfaces ``` 以上命令将在BGP进程中启用BFD,并对所有接口进行BFD检测。这样,当BFD检测到链路故障时,BGP会话将被迅速中断,并触发相应的恢复操作。 另外,在BGP邻居的配置中,你还可以指定使用BFD进行邻居关系的检测。例如,使用以下命令配置BGP邻居并启用BFD检测: ``` router bgp <AS号> neighbor <邻居IP地址> remote-as <对方AS号> neighbor <邻居IP地址> fall-over bfd ``` 以上命令将配置一个BGP邻居,并指定使用BFD进行邻居关系的检测。当BFD检测到邻居故障时,BGP会话将被迅速中断,***和调整。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [迈普路由器配置BGP与BFD联动](https://blog.csdn.net/qq_39577379/article/details/126053862)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值