当前位置: 首页 > ai >正文

BFD与VRRP联动

一、概述

        在前面的文章我们学习了VRRP与BFD协议,VRRP(虚拟路由冗余协议)的主要特点是当Master(主)设备出现故障时,Backup(备用)设备能够快速接替Master的转发工作,尽量缩短数据流的中断时间。

        在没有采用BFD与VRRP联动机制前,当Master出现故障时,VRRP依靠Backup设置的超时时间来判断是否应该抢占,切换速度在1s以上。将BFD应用于Backup对Master的检测后,可以实现对Master故障的快速检测,如果通信不正常,可在50ms以内自动升级成Master,实现快速的主、备切换,缩短用户流量的中断时间。

        如下图所示,RouterA和RouterB之间配置VRRP备份组建立主备关系,RouterA为主用设备,RouterB为备用设备,用户过来的流量从RouterA出去。当在RouterA和RouterB之间建立BFD会话后,VRRP备份组监视该BFD会话,当BFD会话状态变为Down时,系统会自动通过修改备份组优先级实现主备快速切换。

        例如,当BFD检测到RouterA和RouterB之间的链路故障时,上报给VRRP一个BFD检测Down事件,RouterB上VRRP备份组的优先级增加,增加后的优先级大于RouterA上的VRRP备份组的优先级,于是RouterB立即升为Master,后继的用户流量就会通过RouterB转发,从而实现VRRP的主备快速切换。

二、实验

拓扑

1、基本配置思路分析

        本拓扑要监控的是RouterA和RouterB之间的下行链路状态,故可采用VRRP和BFD联动实现主备网关间的快速切换。其配置思路如下。

  • 配置各设备接口的IP地址及路由协议(假设为OSPF),使网络层路由可达。
  • 在RouterA和RouterB上配置VRRP备份组,其中RouterA的优先级为120,抢占延时为20s,作为Master设备;RouterB的优先级为缺省值,作为Backup设备。
  • 在RouterA和RouterB上配置静态BFD会话,监测备份组之间的链路。
  • 在RouterB上配置VRRP与BFD联动,实现链路故障时VRRP备份组的快速切换。

基础配置

RouterA
system
sysname RouterA
int g 0/0/0
ip add 10.1.1.1 24RouterB
system
sysname RouterB
int g 0/0/0
ip add 10.1.1.2 24

路由配置

RouterA
ospf 1 router-id 1.1.1.1
area 0
netw 10.1.1.1 0.0.0.0RouterB
ospf 1 router-id 2.2.2.2
area 0
netw 10.1.1.2 0.0.0.0

查看OSPF邻居状态

[RouterA-ospf-1]dis ospf peer briefOSPF Process 1 with Router ID 1.1.1.1Peer Statistic Information----------------------------------------------------------------------------Area Id          Interface                        Neighbor id      State    0.0.0.0          GigabitEthernet0/0/0             2.2.2.2          Full        ----------------------------------------------------------------------------
[RouterB]dis ospf peer brief OSPF Process 1 with Router ID 2.2.2.2Peer Statistic Information----------------------------------------------------------------------------Area Id          Interface                        Neighbor id      State    0.0.0.0          GigabitEthernet0/0/0             1.1.1.1          Full        ----------------------------------------------------------------------------

VRRP配置

RouterA
int g 0/0/0
vrrp vrid 1 vir 10.1.1.3
vrrp vrid 1 pri 120
vrrp vrid 1 preempt-mode timer delay 0RouterB
int g 0/0/0
vrrp vrid 1 vir 10.1.1.3

查看VRRP状态

[RouterA]dis vrrp GigabitEthernet0/0/0 | Virtual Router 1State : MasterVirtual IP : 10.1.1.3Master IP : 10.1.1.1PriorityRun : 120PriorityConfig : 120MasterPriority : 120Preempt : YES   Delay Time : 0 sTimerRun : 1 sTimerConfig : 1 sAuth type : NONEVirtual MAC : 0000-5e00-0101Check TTL : YESConfig type : normal-vrrpBackup-forward : disabledCreate time : 2025-05-15 15:53:17 UTC-08:00Last change time : 2025-05-15 15:53:20 UTC-08:00
[RouterB]dis vrrpGigabitEthernet0/0/0 | Virtual Router 1State : BackupVirtual IP : 10.1.1.3Master IP : 10.1.1.1PriorityRun : 100PriorityConfig : 100MasterPriority : 120Preempt : YES   Delay Time : 0 sTimerRun : 1 sTimerConfig : 1 sAuth type : NONEVirtual MAC : 0000-5e00-0101Check TTL : YESConfig type : normal-vrrpBackup-forward : disabledCreate time : 2025-05-15 15:53:35 UTC-08:00Last change time : 2025-05-15 15:53:35 UTC-08:00

BFD配置

RouterA
bfd
q
bfd 1 bind  peer-ip 10.1.1.2 interface GigabitEthernet 0/0/0
discriminator local 1
discriminator remote 2
commitRouterB
bfd
q
bfd 1 bind  peer-ip 10.1.1.1 interface GigabitEthernet 0/0/0
discriminator local 2
discriminator remote 1
commit

查看BFD状态

[RouterA]dis bfd ses all
--------------------------------------------------------------------------------
Local Remote     PeerIpAddr      State     Type        InterfaceName            
--------------------------------------------------------------------------------1     2          10.1.1.2        Up        S_IP_IF     GigabitEthernet0/0/0     
--------------------------------------------------------------------------------Total UP/DOWN Session Number : 1/0
[RouterB]dis bfd session all 
--------------------------------------------------------------------------------
Local Remote     PeerIpAddr      State     Type        InterfaceName            
--------------------------------------------------------------------------------2     1          10.1.1.1        Up        S_IP_IF     GigabitEthernet0/0/0     
--------------------------------------------------------------------------------Total UP/DOWN Session Number : 1/0

配置VRRP与BFD联动

RouterB
int g 0/0/0
vrrp vrid 1 track bfd 2 increased 40

 此时我们将RouterA的下行接口down掉

[RouterB]dis vrrpGigabitEthernet0/0/0 | Virtual Router 1State : MasterVirtual IP : 10.1.1.3Master IP : 10.1.1.2PriorityRun : 140PriorityConfig : 100MasterPriority : 140Preempt : YES   Delay Time : 0 sTimerRun : 1 sTimerConfig : 1 sAuth type : NONEVirtual MAC : 0000-5e00-0101Check TTL : YESConfig type : normal-vrrpBackup-forward : disabledTrack BFD : 2  Priority increased : 40BFD-session state : DOWNCreate time : 2025-05-15 15:53:35 UTC-08:00Last change time : 2025-05-15 16:03:20 UTC-08:00

可以看到RouterB很快就会切换至Master设备并开始传输数据。

以上就是本章的全部内容了,感谢大家的浏览观看!文章若有错误或疑问可联系博主删除更改。

http://www.xdnf.cn/news/6323.html

相关文章:

  • 高云FPGA-新增输出管脚约束
  • STM32 SD卡拔插后FatFs挂载失败可能原因
  • ACI Fabric 中的各种地址
  • L - Strange Mirroring (思维)
  • Datawhale 5月llm-universe 第2次笔记
  • ⭐️⭐️⭐️【课时 7:如何创建智能体编排应用】学习总结 ⭐️⭐️⭐️ for《大模型Clouder认证:基于百炼平台构建智能体应用》认证
  • Excel在每行下面插入数量不等的空行
  • PyTorch LSTM练习案例:股票成交量趋势预测
  • web第四次课后作业--页面操作实现数据库的增删查改
  • 高精度降压稳压技术在现代工业自动化中的应用
  • 鸿蒙OSUniApp开发的商品详情展示页面(鸿蒙系统适配版)#三方框架 #Uniapp
  • 校园网规划与设计方案
  • 西门子 Teamcenter13 Eclipse RCP 开发 1 工具栏
  • 双目立体视觉
  • MCP本地高效与云端实时:stdio 与 HTTP+SSE 传输机制深度对比
  • 工业场景轮式巡检机器人纯视觉识别导航的优势剖析与前景展望
  • 医院网络安全托管服务(MSS)深度解读与实践路径
  • Vue 3 实现后端 Excel 文件流导出功能(Blob 下载详解)
  • Day 21 训练
  • [Harmony]获取资源文件中.txt文件中的字符串
  • U-Mail邮件系统的安全性和可扩展性
  • 【python】字典:: a list of dictionaries
  • 硬盘坏了电脑会出现哪些明显现象?机械和固态可不一样
  • 【C/C++】深度解析C++ Allocator:优化内存管理的关键
  • 对心理幸福感含义的探索 | 幸福就是一切吗?
  • ArcGIS Pro调用多期历史影像
  • 桃芯ingchips——windows HID键盘例程无法同时连接两个,但是安卓手机可以的问题
  • K8S Gateway AB测试、蓝绿发布、金丝雀(灰度)发布
  • ubuntu服务器版启动卡在start job is running for wait for...to be Configured
  • leetcode0767. 重构字符串-medium