玩转华为ENSP模拟器系列 | 配置BFD for OSPF特性示例

Posted COCOgsta

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了玩转华为ENSP模拟器系列 | 配置BFD for OSPF特性示例相关的知识,希望对你有一定的参考价值。

素材来源:华为路由器配置指南

一边学习一边整理试验笔记,并与大家分享,侵权即删,谢谢支持!

附上汇总贴:玩转华为ENSP模拟器系列 | 合集_COCOgsta的博客-CSDN博客_ensp实验大全


目标

介绍BFD for OSPF的配置过程,能够快速检测到故障并通告给OSPF协议,使业务流量使用备份链路传送。

组网需求

OSPF通过周期性的向邻居发送Hello报文来实现邻居检测,检测到故障所需时间比较长,超过1秒钟。随着科技的发展,语音、视频及其它点播业务应用广泛,而这些业务对于丢包和延时非常敏感,当数据达到吉比特速率级时,较长的检测时间会导致大量数据丢失,无法满足电信级网络高可靠性的需求。通过配置BFD for OSPF特性,可以快速检测链路的状态,故障检测时间可以达到毫秒级,提高链路状态变化时OSPF的收敛速度。

例如,如图1所示。网络部署为主/备链路,主链路为DeviceA→DeviceB,备链路为DeviceA→DeviceC→DeviceB。正常情况下,业务流量在主链路上传送。当主链路故障时,用户希望能够快速感知,及时把业务流量切换到备份链路上。

此时,可以配置BFD for OSPF功能,使用BFD检测DeviceA和DeviceB之间的OSPF邻居关系,当DeviceA和DeviceB之间的链路发生故障时,BFD能够快速检测到故障并通告给OSPF协议,使业务流量切换到备份链路上传送。

配置思路

  • 在各路由器上配置OSPF基本功能,实现互连。
  • 使能全局BFD特性。
  • 在DeviceA和DeviceB上使能OSPF BFD检测机制。

操作步骤

  1. 配置各路由器接口的IP地址(略)
  2. 配置OSPF基本功能

配置DeviceA。

DeviceA:
router id 1.1.1.1
ospf 1
 area 0.0.0.0
  network 1.1.1.0 0.0.0.255
  network 3.3.3.0 0.0.0.255

配置DeviceB。

DeviceB:
router id 2.2.2.2
ospf 1
 area 0.0.0.0
  network 2.2.2.0 0.0.0.255
  network 3.3.3.0 0.0.0.255
  network 172.16.1.0 0.0.0.255

配置DeviceC。

DeviceC:
router id 3.3.3.3
ospf 1
 area 0.0.0.0
  network 1.1.1.0 0.0.0.255
  network 2.2.2.0 0.0.0.255

配置完成后,执行display ospf peer命令,可以看到DeviceA与DeviceB、DeviceB和DeviceC之间都建立了邻居关系。以DeviceA的显示结果为例。

[~DeviceA]dis ospf peer
(M) Indicates MADJ neighbor
          OSPF Process 1 with Router ID 3.3.3.1
                Neighbors
 Area 0.0.0.0 interface 3.3.3.1 (Eth1/0/0)'s neighbors
 Router ID: 2.2.2.2              Address: 3.3.3.2          
   State: Full           Mode:Nbr is Slave      Priority: 1
   DR: 3.3.3.1           BDR: 3.3.3.2           MTU: 0
   Dead timer due in  38  sec
   Retrans timer interval: 5
   Neighbor is up for 00h01m44s
   Neighbor Up Time : 2019-12-20 14:25:31
   Authentication Sequence: [ 0 ]
 Area 0.0.0.0 interface 1.1.1.1 (Eth1/0/1)'s neighbors
 Router ID: 3.3.3.3              Address: 1.1.1.2          
   State: Full           Mode:Nbr is Master     Priority: 1
   DR: 1.1.1.1           BDR: 1.1.1.2           MTU: 0
   Dead timer due in  39  sec
   Retrans timer interval: 5
   Neighbor is up for 00h00m43s
   Neighbor Up Time : 2019-12-20 14:26:32
   Authentication Sequence: [ 0 ]
          OSPF Process 65534 with Router ID 128.1.138.137
                Neighbors
 Area 0.0.0.0 interface 128.1.138.137 (Eth1/0/1.4094)'s neighbors
 Router ID: 128.1.138.139        Address: 128.1.138.139    
   State: Full           Mode:Nbr is Master     Priority: 1
   DR: None              BDR: None              MTU: 0
   Dead timer due in  38  sec
   Retrans timer interval: 5
   Neighbor is up for 00h05m14s
   Neighbor Up Time : 2019-12-20 14:22:02
   Authentication Sequence: [ 0 ]
 Area 0.0.0.0 interface 128.1.138.137 (DCN-Serial1/0/1:0)'s neighbors
 Router ID: 128.1.138.139        Address: 128.1.138.139    
   State: Full           Mode:Nbr is Master     Priority: 1
   DR: None              BDR: None              MTU: 0
   Dead timer due in  31  sec
   Retrans timer interval: 5
   Neighbor is up for 00h05m02s
   Neighbor Up Time : 2019-12-20 14:22:14
   Authentication Sequence: [ 0 ]
 Area 0.0.0.0 interface 128.1.138.137 (DCN-Serial1/0/0:0)'s neighbors
 Router ID: 128.1.138.138        Address: 128.1.138.138    
   State: Full           Mode:Nbr is Master     Priority: 1
   DR: None              BDR: None              MTU: 0
   Dead timer due in  39  sec
   Retrans timer interval: 5
   Neighbor is up for 00h04m37s
   Neighbor Up Time : 2019-12-20 14:22:40
   Authentication Sequence: [ 0 ]
[~DeviceA] 

查看DeviceA的OSPF路由表的信息,应该有去往DeviceB和DeviceC的路由表项,去往172.16.1.0/24的路由下一跳地址为3.3.3.2,流量在主链路DeviceA→DeviceB上传输。

[~DeviceA] dis ospf routing
          OSPF Process 1 with Router ID 3.3.3.1
                   Routing Tables
 Routing for Network
 Destination        Cost     Type       NextHop         AdvRouter       Area           
 1.1.1.0/24         1        Direct     1.1.1.1         3.3.3.1         0.0.0.0        
 2.2.2.0/24         2        Transit    1.1.1.2         2.2.2.2         0.0.0.0        
 2.2.2.0/24         2        Transit    3.3.3.2         2.2.2.2         0.0.0.0        
 3.3.3.0/24         1        Direct     3.3.3.1         3.3.3.1         0.0.0.0        
 172.16.1.1/32      1        Stub       3.3.3.2         2.2.2.2         0.0.0.0        
 Total Nets: 4
 Intra Area: 4  Inter Area: 0  ASE: 0  NSSA: 0
          OSPF Process 65534 with Router ID 128.1.138.137
                   Routing Tables
 Routing for Network
 Destination        Cost     Type       NextHop         AdvRouter       Area           
 128.1.138.137/32   0        Direct     128.1.138.137   128.1.138.137   0.0.0.0        
 128.1.138.138/32   100      Stub       128.1.138.138   128.1.138.138   0.0.0.0        
 128.1.138.139/32   100      Stub       128.1.138.139   128.1.138.139   0.0.0.0        
 128.1.138.139/32   100      Stub       128.1.138.139   128.1.138.139   0.0.0.0        
 Total Nets: 3
 Intra Area: 3  Inter Area: 0  ASE: 0  NSSA: 0
[~DeviceA] 
[~DeviceA]
  1. 配置OSPF BFD

在DeviceA上使能全局BFD特性。

DeviceA:
bfd
ospf 1
 bfd all-interfaces enable

在DeviceB上使能全局BFD特性。

DeviceB:
bfd
ospf 1
 bfd all-interfaces enable

在DeviceC上使能全局BFD特性。

DeviceC:
bfd
ospf 1
 bfd all-interfaces enable

配置完成后,在DeviceA或DeviceB、DeviceC上执行display ospf bfd session all命令,可以看到BFDState的状态为Up。

以DeviceA的显示为例。

[~DeviceA]dis ospf bfd session all
          OSPF Process 1 with Router ID 3.3.3.1
  Area 0.0.0.0 interface 3.3.3.1 (Eth1/0/0)'s BFD Sessions
 NeighborId:2.2.2.2           AreaId:0.0.0.0           Interface:Eth1/0/0         
 BFDState:Up                  rx    :10                tx       :10                
 Multiplier:3                 BFD Local Dis:16385      LocalIpAdd:3.3.3.1          
 RemoteIpAdd:3.3.3.2          Diagnostic Info:No diagnostic information         
  Area 0.0.0.0 interface 1.1.1.1 (Eth1/0/1)'s BFD Sessions
 NeighborId:3.3.3.3           AreaId:0.0.0.0           Interface:Eth1/0/1         
 BFDState:Up                  rx    :10                tx       :10                
 Multiplier:3                 BFD Local Dis:16386      LocalIpAdd:1.1.1.1          
 RemoteIpAdd:1.1.1.2          Diagnostic Info:No diagnostic information         
[~DeviceA] 
  1. 配置接口的BFD特性

在DeviceA的ethe1/0/0接口上配置BFD特性,并指定最小发送和接收间隔为500ms,本地检测时间倍数为4。

DeviceA:
interface Ethernet1/0/0
 ospf bfd enable
 ospf bfd min-tx-interval 500 min-rx-interval 500 detect-multiplier 4

在DeviceB的ethe1/0/1接口上配置BFD特性,并指定最小发送和接收间隔为500ms,本地检测时间倍数为4。

DeviceB:
interface Ethernet1/0/1
 ospf bfd enable
 ospf bfd min-tx-interval 500 min-rx-interval 500 detect-multiplier 4

配置完成后,在DeviceA或DeviceB上执行display ospf bfd session all命令,最小发送和接收间隔被修改为500ms,本地检测时间倍数被修改为4。

以DeviceB的显示为例。

[~DeviceB-Ethernet1/0/1]dis ospf bfd session all
          OSPF Process 1 with Router ID 2.2.2.2
  Area 0.0.0.0 interface 2.2.2.2 (Eth1/0/0)'s BFD Sessions
 NeighborId:3.3.3.3           AreaId:0.0.0.0           Interface:Eth1/0/0         
 BFDState:Up                  rx    :10                tx       :10                
 Multiplier:3                 BFD Local Dis:16385      LocalIpAdd:2.2.2.2          
 RemoteIpAdd:2.2.2.1          Diagnostic Info:Control Detection Time Expired    
  Area 0.0.0.0 interface 3.3.3.2 (Eth1/0/1)'s BFD Sessions
 NeighborId:3.3.3.1           AreaId:0.0.0.0           Interface:Eth1/0/1         
 BFDState:Up                  rx    :500               tx       :500               
 Multiplier:4                 BFD Local Dis:16386      LocalIpAdd:3.3.3.2          
 RemoteIpAdd:3.3.3.1          Diagnostic Info:Control Detection Time Expired    
[~DeviceB-Ethernet1/0/1]
  1. 检查配置结果

对DeviceB的ethe1/0/1接口执行shutdown命令,模拟主链路故障。

[~DeviceB-Ethernet1/0/1]shut
[*DeviceB-Ethernet1/0/1]commit

在路由器DeviceA上,查看路由表。可以看出,在主链路失效后,备份链路DeviceA-DeviceC-DeviceB生效,去往172.16.1.0/24的路由下一跳地址为1.1.1.2。

[~DeviceA-Ethernet1/0/0]dis ospf routing 
          OSPF Process 1 with Router ID 3.3.3.1
                   Routing Tables
 Routing for Network
 Destination        Cost     Type       NextHop         AdvRouter       Area           
 1.1.1.0/24         1        Direct     1.1.1.1         3.3.3.1         0.0.0.0        
 2.2.2.0/24         2        Transit    1.1.1.2         3.3.3.3         0.0.0.0        
 3.3.3.0/24         1        Direct     3.3.3.1         3.3.3.1         0.0.0.0        
 172.16.1.1/32      2        Stub       1.1.1.2         2.2.2.2         0.0.0.0        
 Total Nets: 4
 Intra Area: 4  Inter Area: 0  ASE: 0  NSSA: 0
          OSPF Process 65534 with Router ID 128.1.138.137
                   Routing Tables
 Routing for Network
 Destination        Cost     Type       NextHop         AdvRouter       Area           
 128.1.138.137/32   0        Direct     128.1.138.137   128.1.138.137   0.0.0.0        
 128.1.138.138/32   200      Stub       128.1.138.139   128.1.138.138   0.0.0.0        
 128.1.138.138/32   200      Stub       128.1.138.139   128.1.138.138   0.0.0.0        
 128.1.138.139/32   100      Stub       128.1.138.139   128.1.138.139   0.0.0.0        
 128.1.138.139/32   100      Stub       128.1.138.139   128.1.138.139   0.0.0.0        
 Total Nets: 3
 Intra Area: 3  Inter Area: 0  ASE: 0  NSSA: 0
[~DeviceA-Ethernet1/0/0]

 

以上是关于玩转华为ENSP模拟器系列 | 配置BFD for OSPF特性示例的主要内容,如果未能解决你的问题,请参考以下文章

玩转华为ENSP模拟器系列 | 配置指定进程的BFD for OSPF特性

玩转华为ENSP模拟器系列 | 配置动态BFD for IS-IS特性示例

玩转华为ENSP模拟器系列 | 调整静态BFD检测时间

玩转华为ENSP模拟器系列 | 配置BFD会话进入AdminDown状态

玩转华为ENSP模拟器系列 | 配置静态BFD检测三层IP链路

玩转华为ENSP模拟器系列 | 配置静态BFD检测三层IP链路