zoukankan      html  css  js  c++  java
  • 配置OSPF与BFD联动

    组网图形

        

    OSPF与BFD联动简介

    • 双向转发检测BFD(Bidirectional Forwarding Detection)是一种用于检测转发引擎之间通信故障的检测机制。BFD对两个系统间的、同一路径上的同一种数据协议的连通性进行检测,这条路径可以是物理链路或逻辑链路。OSPF与BFD联动就是将BFD和OSPF协议关联起来,将BFD对链路故障的快速感应通知OSPF协议,从而加快OSPF协议对于网络拓扑变化的响应。
    • 网络上的链路故障或拓扑变化都会导致设备重新进行路由计算,如果仅依靠OSPF协议本身的检测机制,那么路由的重新计算时间就是协议本身收敛的时间,这种情况下协议感知到故障所需时间为秒级。然而对于高速数据传输,例如吉比特速率级,超过1秒的检测时间将导致大量数据丢失;对于时延敏感的业务,例如语音业务,超过1秒的延迟是不能接受的。当OSPF网络对可靠性要求较高,或者所承载的业务对时延比较敏感时,可以考虑配置OSPF与BFD联动,这样一旦邻居之间的链路出现故障,BFD的快速性能够加快OSPF的收敛速度,达到毫秒级的故障检测。

     组网需求

    • 如图1所示,SwitchA、SwitchB和SwitchC之间运行OSPF,SwitchA和SwitchB之间的交换机仅作透传功能。现在需要SwitchA和SwitchB能快速感应它们之间的链路状态,当链路SwitchA-SwitchB发生故障时,业务能快速切换到备份链路SwitchA-SwitchC-SwitchB上。
    说明:
        BFD报文双向检测,需要建立OSPF邻居的两端设备均进行BFD配置。
        创建BFD会话的通信双方必须处于同一个OSPF区域的同一网段。
        ospf bfd enable命令和ospf bfd block命令是两条互斥命令,不能同时使能。
    

    配置思路

    • 1.在SwitchA、SwitchB和SwitchC上配置OSPF基本功能,实现整个OSPF网络的互通。
    • 2.在SwitchA、SwitchB和SwitchC上配置OSPF与BFD联动功能,实现当SwitchA和SwitchB之间的链路出现故障时快速的切换到备份链路。

    操作步骤

    • 1.配置各接口所属的VLAN

      # 配置SwitchA。SwitchB和SwitchC的配置与SwitchA类似,不再赘述。

    <HUAWEI> system-view
    [HUAWEI] sysname SwitchA
    [SwitchA] vlan batch 10 30
    [SwitchA] interface gigabitethernet 1/0/1
    [SwitchA-GigabitEthernet1/0/1] port link-type trunk
    [SwitchA-GigabitEthernet1/0/1] port trunk allow-pass vlan 10
    [SwitchA-GigabitEthernet1/0/1] quit
    [SwitchA] interface gigabitethernet 1/0/2
    [SwitchA-GigabitEthernet1/0/2] port link-type trunk
    [SwitchA-GigabitEthernet1/0/2] port trunk allow-pass vlan 30
    [SwitchA-GigabitEthernet1/0/2] quit
    
    •  2.配置各VLANIF接口的IP地址

      # 配置SwitchA。SwitchB和SwitchC的配置与SwitchA类似,不再赘述。

    [SwitchA] interface vlanif 10
    [SwitchA-Vlanif10] ip address 10.1.1.1 24
    [SwitchA-Vlanif10] quit
    [SwitchA] interface vlanif 30
    [SwitchA-Vlanif30] ip address 10.3.3.1 24
    [SwitchA-Vlanif30] quit
    
    •  3.配置OSPF基本功能

      # 配置SwitchA。

    [SwitchA] ospf 1 router-id 10.10.10.1
    [SwitchA-ospf-1] area 0
    [SwitchA-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
    [SwitchA-ospf-1-area-0.0.0.0] network 10.3.3.0 0.0.0.255
    [SwitchA-ospf-1-area-0.0.0.0] quit
    [SwitchA-ospf-1] quit
    

       # 配置SwitchB。

    [SwitchB] ospf 1 router-id 10.10.10.2
    [SwitchB-ospf-1] area 0
    [SwitchB-ospf-1-area-0.0.0.0] network 10.2.2.0 0.0.0.255
    [SwitchB-ospf-1-area-0.0.0.0] network 10.3.3.0 0.0.0.255
    [SwitchB-ospf-1-area-0.0.0.0] network 172.16.1.0 0.0.0.255
    [SwitchB-ospf-1-area-0.0.0.0] quit
    [SwitchB-ospf-1] quit
    

       # 配置SwitchC。

    [SwitchC] ospf 1 router-id 10.10.10.3
    [SwitchC-ospf-1] area 0
    [SwitchC-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
    [SwitchC-ospf-1-area-0.0.0.0] network 10.2.2.0 0.0.0.255
    [SwitchC-ospf-1-area-0.0.0.0] quit
    [SwitchC-ospf-1] quit
    

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

    [SwitchA] 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.2  BDR: 10.1.1.1  MTU: 0
       Dead timer due in 38  sec
       Retrans timer interval: 5
       Neighbor is up for 00:00:15
       Authentication Sequence: [ 0 ]
    
                      Neighbors
    
     Area 0.0.0.0 interface 10.3.3.1(Vlanif30)'s neighbors
     Router ID: 10.10.10.2       Address: 10.3.3.2
       State: Full  Mode:Nbr is   Master  Priority: 1
       DR: 10.3.3.2  BDR: 10.3.3.1  MTU: 0
       Dead timer due in 25  sec
       Retrans timer interval: 5
       Neighbor is up for 00:00:59
       Authentication Sequence: [ 0 ]
    

       # 查看SwitchA的OSPF路由表的信息,可以看到去往SwitchB和SwitchC的路由表项。而去往目的网段172.16.1.0/24的路由下一跳地址为10.3.3.2,说明流量在链路SwitchA→SwitchB上传输。

    [SwitchA] display ospf routing
    
              OSPF Process 1 with Router ID 10.10.10.1
                       Routing Tables
    
     Routing for Network
     Destination        Cost  Type       NextHop         AdvRouter       Area
     10.1.1.0/24        1     Transit    10.1.1.1        10.10.10.1      0.0.0.0
     10.3.3.0/24        1     Transit    10.3.3.1        10.10.10.1      0.0.0.0
     10.2.2.0/24        2     Transit    10.1.1.2        10.10.10.3      0.0.0.0
     10.2.2.0/24        2     Transit    10.3.3.2        10.10.10.3      0.0.0.0
     172.16.1.0/24      2     Stub       10.3.3.2        10.10.10.2      0.0.0.0
    
     Total Nets: 5
     Intra Area: 5  Inter Area: 0  ASE: 0  NSSA: 0
    
    •  4.配置OSPF与BFD联动

      # 在SwitchA上配置OSPF与BFD联动功能。

    [SwitchA] bfd   //全局使能BFD功能
    [SwitchA-bfd] quit
    [SwitchA] ospf 1
    [SwitchA-ospf-1] bfd all-interfaces enable   //在OSPF进程下使能BFD特性
    [SwitchA-ospf-1] quit
    

       # 在SwitchB上配置OSPF与BFD联动功能。

    [SwitchB] bfd   //全局使能BFD功能
    [SwitchB-bfd] quit
    [SwitchB] ospf 1
    [SwitchB-ospf-1] bfd all-interfaces enable   //在OSPF进程下使能BFD特性
    [SwitchB-ospf-1] quit
    

       # 在SwitchC上配置OSPF与BFD联动功能。

    [SwitchC] bfd   //全局使能BFD功能
    [SwitchC-bfd] quit
    [SwitchC] ospf 1
    [SwitchC-ospf-1] bfd all-interfaces enable   //在OSPF进程下使能BFD特性
    [SwitchC-ospf-1] quit
    

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

    [SwitchA] 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:8195      LocalIpAdd:10.1.1.1
     RemoteIpAdd:10.1.1.2        Diagnostic Info:No diagnostic information
    
      Area 0.0.0.0 interface 10.3.3.1(Vlanif30)'s BFD Sessions
    
     NeighborId:10.10.10.2       AreaId:0.0.0.0          Interface:Vlanif30
     BFDState:up                 rx    :1000             tx       :1000
     Multiplier:3                BFD Local Dis:8194      LocalIpAdd:10.3.3.1
     RemoteIpAdd:10.3.3.2         Diagnostic Info:No diagnostic information
    
    •  5.检查配置结果

      # 对SwitchB的GE1/0/1接口执行shutdown命令,模拟链路故障。

    [SwitchB] interface gigabitethernet 1/0/1
    [SwitchB-GigabitEthernet1/0/1] shutdown
    

       # 在SwitchA上查看OSPF路由表。

    [SwitchA] display ospf routing
    
              OSPF Process 1 with Router ID 10.10.10.1
                       Routing Tables
    
     Routing for Network
     Destination        Cost  Type       NextHop         AdvRouter       Area
     10.1.1.0/24        1     Transit    10.1.1.1        10.10.10.1      0.0.0.0
     10.2.2.0/24        2     Transit    10.1.1.2        10.10.10.3      0.0.0.0
     172.16.1.0/24      3     Stub       10.1.1.2        10.10.10.2      0.0.0.0
    
     Total Nets: 3
     Intra Area: 3  Inter Area: 0  ASE: 0  NSSA: 0
    

       可以看出在链路SwitchA-SwitchB出现故障后,备份链路SwitchA-SwitchC-SwitchB开始生效,即去往目的网段172.16.1.0/24的路由下一跳地址变成了10.1.1.2。

  • 相关阅读:
    支持向量机SVM知识点概括
    决策树知识点概括
    HDU 3081 Marriage Match II
    HDU 3572 Task Schedule
    HDU 4888 Redraw Beautiful Drawings
    Poj 2728 Desert King
    HDU 3926 Hand in Hand
    HDU 1598 find the most comfortable road
    HDU 4393 Throw nails
    POJ 1486 Sorting Slides
  • 原文地址:https://www.cnblogs.com/zhangwencheng/p/14153409.html
Copyright © 2011-2022 走看看