OSPF FRR BFD联动示例

组网需求

  1. 快速感知OSPF的链路中断
  2. 快速将路由切换到备份链路

组网拓扑

OSPF  FRR BFD联动拓扑图

配置思路

  1. 配置路由器基本功能以及各个接口IP地址
  2. 配置OSPF协议,宣告路由,设置各个接口Cost值
  3. 在R1上使能OSPF IP FRR功能
  4. 在R1与R3的链路之间配置BFD

配置命令

  1. 配置路由器基本功能以及各个接口IP地址

    • R1配置

      1
      2
      3
      4
      5
      6
      7
      sys
      sys R1

      int g0/0/0
      ip add 10.1.13.1 30
      int g0/0/1
      ip add 10.1.12.1 30
  • R2配置

    1
    2
    3
    4
    5
    6
    7
    sys
    sys R2

    int g0/0/1
    ip add 10.1.12.2 30
    int g0/0/2
    ip add 10.1.23.2 30
  • R3配置

    1
    2
    3
    4
    5
    6
    7
    8
    9
    sys
    sys R3

    int g0/0/0
    ip add 10.1.13.2 30
    int g0/0/1
    ip add 10.1.34.1 30
    int g0/0/2
    ip add 10.1.23.1 30
  • R4配置

    1
    2
    3
    4
    5
    sys
    sys R4

    int g0/0/1
    ip add 10.1.34.2 30
  1. 配置OSPF协议,宣告路由,设置各个接口Cost值

    • R1配置

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      sys
      ospf 1 router-id 10.1.1.1
      area 0
      network 10.1.13.0 0.0.0.3
      network 10.1.12.0 0.0.0.3

      int g0/0/0
      ospf cost 10
      int g0/0/1
      ospf cost 10
  • R2配置

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    sys
    ospf 1 router-id 10.1.2.2
    area 0
    network 10.1.23.0 0.0.0.3
    network 10.1.12.0 0.0.0.3

    int g0/0/1
    ospf cost 10
    int g0/0/2
    ospf cost 5
  • R3配置

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    sys
    ospf 1 router-id 10.1.3.3
    area 0
    network 10.1.13.0 0.0.0.3
    network 10.1.23.0 0.0.0.3
    network 10.1.34.0 0.0.0.3

    int g0/0/0
    ospf cost 10
    int g0/0/1
    ospf cost 5
    int g0/0/2
    ospf cost 5
  • R4配置

    1
    2
    3
    4
    5
    6
    7
    sys
    ospf 1 router-id 10.1.4.4
    area 0
    network 10.1.34.0 0.0.0.3

    int g0/0/1
    ospf cost 5
  1. 配置OSPF IP FRR

    • R1配置

      1
      2
      3
      4
      sys
      ospf 1
      frr
      loop-free-alternate
  2. 配置OSPF与BFD联动

    • R1配置

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      sys
      bfd
      q

      ospf 1
      bfd all-interfaces enable
      bfd all-interfaces min-rx-interaval 100 min-tx-interval 100 detect-multicast 4

      int g0/0/0
      ospf bfd enable
  • R3配置

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    sys
    bfd
    q

    ospf 1
    bfd all-interfaces enable
    bfd all-interfaces min-rx-interaval 100 min-tx-interval 100 detect-multicast 4

    int g0/0/0
    ospf bfd enable

查看命令

  1. 查看BFD会话状态

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    display bfd session all

    <R1>dis bfd session all
    --------------------------------------------------------------------------------
    Local Remote PeerIpAddr State Type InterfaceName
    --------------------------------------------------------------------------------

    8193 0 10.1.12.2 Down D_IP_IF GigabitEthernet0/0/1
    8196 8196 10.1.13.2 Up D_IP_IF GigabitEthernet0/0/0
    --------------------------------------------------------------------------------
    Total UP/DOWN Session Number : 1/1
  1. 查看OSPF与BFD联动的会话状态

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    display ospf bfd session all

    <R1>dis ospf bfd session all

    OSPF Process 1 with Router ID 10.1.1.1
    Area 0.0.0.0 interface 10.1.13.1(GigabitEthernet0/0/0)'s BFD Sessions

    NeighborId:10.1.3.3 AreaId:0.0.0.0 Interface:GigabitEthernet0/
    0/0
    BFDState:up rx :1000 tx :1000
    Multiplier:3 BFD Local Dis:8196 LocalIpAdd:10.1.13.1
    RemoteIpAdd:10.1.13.2 Diagnostic Info:No diagnostic information

    Area 0.0.0.0 interface 10.1.12.1(GigabitEthernet0/0/1)'s BFD Sessions

    NeighborId:10.1.2.2 AreaId:0.0.0.0 Interface:GigabitEthernet0/
    0/1
    BFDState:down rx :11999 tx :11999
    Multiplier:0 BFD Local Dis:8193 LocalIpAdd:10.1.12.1
    RemoteIpAdd:10.1.12.2 Diagnostic Info:No diagnostic information
  1. 当链路中断,BFD快速感知,并由FRR切换到备用链路

    • 中断前,路由使用主链路

      1
      2
      3
      4
      5
      6
      7
      8
      <R1>tracert 10.1.34.2

      traceroute to 10.1.34.2(10.1.34.2), max hops: 30 ,packet length: 40,press CTRL
      _C to break

      1 10.1.13.2 20 ms 30 ms 10 ms

      2 10.1.34.2 20 ms 30 ms 20 ms
  • 链路中断,BFD快速感知,FRR切换到备用链路

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34

    May 13 2022 10:37:09-08:00 R1 %%01BFD/4/STACHG_TODWN(l)[0]:BFD session changed t
    o Down. (SlotNumber=0, Discriminator=69206016, Diagnostic=DetectDown, Applicatio
    ns=OSPF, ProcessPST=False, BindInterfaceName=GigabitEthernet0/0/0, InterfacePhys
    icalState=Up, InterfaceProtocolState=Up)
    <R1>
    May 13 2022 10:37:09-08:00 R1 %%01OSPF/3/NBR_CHG_DOWN(l)[1]:Neighbor event:neigh
    bor state changed to Down. (ProcessId=256, NeighborAddress=3.3.1.10, NeighborEve
    nt=KillNbr, NeighborPreviousState=Full, NeighborCurrentState=Down)
    <R1>
    May 13 2022 10:37:09-08:00 R1 %%01OSPF/3/NBR_DOWN_REASON(l)[2]:Neighbor state le
    aves full or changed to Down. (ProcessId=256, NeighborRouterId=3.3.1.10, Neighbo
    rAreaId=0, NeighborInterface=GigabitEthernet0/0/0,NeighborDownImmediate reason=N
    eighbor Down Due to Kill Neighbor, NeighborDownPrimeReason=BFD Session Down, Nei
    ghborChangeTime=2022-05-13 10:37:09-08:00)
    <R1>
    May 13 2022 10:37:11-08:00 R1 %%01IFPDT/4/IF_STATE(l)[3]:Interface GigabitEthern
    et0/0/0 has turned into DOWN state.
    <R1>
    May 13 2022 10:37:11-08:00 R1 %%01IFNET/4/LINK_STATE(l)[4]:The line protocol IP
    on the interface GigabitEthernet0/0/0 has entered the DOWN state.


    // 链路切换到备用
    <R1>tracert 10.1.34.2

    traceroute to 10.1.34.2(10.1.34.2), max hops: 30 ,packet length: 40,press CTRL
    _C to break

    1 10.1.12.2 20 ms 20 ms 30 ms

    2 10.1.23.1 40 ms 20 ms 20 ms

    3 10.1.34.2 40 ms 40 ms 40 ms
吴超 wechat
subscribe to my blog by scanning my public wechat account