华为配置OSPF与BFD联动示例

组网需求

如图1所示,SwitchA、SwitchB和SwitchC之间运行OSPF,SwitchA和SwitchB之间的交换机仅作透传功能。现在需要SwitchA和SwitchB能快速感应它们之间的链路状态,当链路SwitchA-SwitchB发生故障时,业务能快速切换到备份链路SwitchA-SwitchC-SwitchB上

说明

请确保该场景下互联接口的STP处于未使能状态。因为在使能STP的环形网络中,如果用交换机的VLANIF接口构建三层网络,会导致某个端口被阻塞,从而导致三层业务不能正常运行

配置思路

采用如下思路配置OSPF与BFD联动:

  1. 在各交换机上配置OSPF基本功能,实现整个OSPF网络的互通。

  2. 在各交换机上配置OSPF与BFD联动功能,实现当SwitchA和SwitchB之间的链路出现故障时快速的切换到备份链路。

操作步骤

配置各接口所属的VLAN

配置SwitchA。SwitchB和SwitchC的配置与SwitchA类似。

复制代码
[zhongwanzhi]vlan batch 10 30
[zhongwanzhi]interface GigabitEthernet 0/0/1
[zhongwanzhi-GigabitEthernet0/0/1]port link-type trunk 
[zhongwanzhi-GigabitEthernet0/0/1]port trunk allow-pass vlan 10
[zhongwanzhi-GigabitEthernet0/0/1]quit
[zhongwanzhi]interface GigabitEthernet 0/0/2
[zhongwanzhi-GigabitEthernet0/0/2]port link-type tr	
[zhongwanzhi-GigabitEthernet0/0/2]port link-type trunk 
[zhongwanzhi-GigabitEthernet0/0/2]port trunk allow-pass vlan 30
[zhongwanzhi-GigabitEthernet0/0/2]quit

配置各VLANIF接口的IP地址

配置SwitchA。SwitchB和SwitchC的配置与SwitchA类似

复制代码
[zhongwanzhi]interface Vlanif 30
[zhongwanzhi-Vlanif30]ip address 10.3.3.1 24
[zhongwanzhi-Vlanif30]quit
[zhongwanzhi]interface Vlanif 10
[zhongwanzhi-Vlanif10]ip address 10.1.1.1 24
[zhongwanzhi-Vlanif10]quit

配置OSPF基本功能

配置SwitchA、SwitchB和SwitchC的配置与SwitchA类似

复制代码
[zhongwanzhi]ospf 1 router-id 10.10.10.1
[zhongwanzhi-ospf-1]area 0
[zhongwanzhi-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255
[zhongwanzhi-ospf-1-area-0.0.0.0]network 10.3.3.0 0.0.0.255
[zhongwanzhi-ospf-1-area-0.0.0.0]quit
[zhongwanzhi-ospf-1]quit

配置完成后,执行命令display ospf peer,可以看到SwitchA,SwitchB和SwitchC之间互相建立了邻接关系。以SwitchA的显示结果为例

复制代码
[zhongwanzhi]display ospf peer 

	 OSPF Process 1 with Router ID 10.10.10.1
		 Neighbors 

 Area 0.0.0.0 interface 10.1.1.1(Vlanif10)'s neighbors
 Router ID: 10.10.10.3       Address: 10.1.1.2        
   State: Full  Mode:Nbr is  Master  Priority: 1
   DR: 10.1.1.1  BDR: 10.1.1.2  MTU: 0    
   Dead timer due in 34  sec 
   Retrans timer interval: 5 
   Neighbor is up for 00:00:20     
   Authentication Sequence: [ 0 ] 

[zhongwanzhi]display ospf peer

	 OSPF Process 1 with Router ID 10.10.10.1
		 Neighbors 

 Area 0.0.0.0 interface 10.1.1.1(Vlanif10)'s neighbors
 Router ID: 10.10.10.3       Address: 10.1.1.2        
   State: Full  Mode:Nbr is  Master  Priority: 1
   DR: 10.1.1.1  BDR: 10.1.1.2  MTU: 0    
   Dead timer due in 34  sec 
   Retrans timer interval: 5 
   Neighbor is up for 00:00:47     
   Authentication Sequence: [ 0 ] 

配置OSPF与BFD联动

在SwitchA上配置OSPF与BFD联动功能。SwitchB和SwitchC的配置与SwitchA类似。

复制代码
[zhongwanzhi]bfd	
[zhongwanzhi-bfd]quit
[zhongwanzhi]ospf 1
[zhongwanzhi-ospf-1]bfd all-interfaces enable 
[zhongwanzhi-ospf-1]quit

配置完成后,在SwitchA或SwitchB、SwitchC上执行display ospf bfd session all 命令,可以看到BFD会话的状态为Up。以SwitchA的显示为例。

复制代码
[zhongwanzhi]display ospf bfd session all 

	 OSPF Process 1 with Router ID 10.10.10.1
  Area 0.0.0.0 interface 10.1.1.1(Vlanif10)'s BFD Sessions

 NeighborId:10.10.10.3       AreaId:0.0.0.0          Interface:Vlanif10      
 BFDState:up                 rx    :1000             tx       :1000          
 Multiplier:3                BFD Local Dis:8192      LocalIpAdd:10.1.1.1
 RemoteIpAdd:10.1.1.2        Diagnostic Info:No diagnostic information
相关推荐
z2023050818 分钟前
Linux之vmlinux文件段布局和arm64 的链接脚本vmlinux.lds.S分析
linux·运维·服务器
百锦再44 分钟前
第11章 泛型、trait与生命周期
android·网络·人工智能·python·golang·rust·go
濊繵1 小时前
Linux网络-Socket 编程 UDP
linux·网络·udp
北京阿法龙科技有限公司3 小时前
AR眼镜基于上下文智能识别:电力运维高效规范操作应用方案|阿法龙XR云平台
运维·ar·xr
RisunJan3 小时前
docker一键部署项目
运维·docker·容器
luyun0202024 小时前
Windows 11操作更丝滑,绝了
java·运维·figma
wanhengidc5 小时前
全面了解云手机的安全性
运维·服务器·游戏·智能手机·云计算
00后程序员张6 小时前
HTTP抓包工具推荐,Fiddler配置方法、代理设置与使用教程详解(开发者必学网络调试技巧)
网络·http·ios·小程序·fiddler·uni-app·webview
menge23336 小时前
Linux DNS域名解析服务器练习
linux·运维·服务器
努力成为一个程序猿.6 小时前
Clickhouse数据副本和分片
运维·clickhouse·debian