OSPF GR示例

组网需求

  1. 路由器R1、R2、R3都是双主控设备,主用板和备用板之间形成备份关系,路由器之间通过OSPF路由协议形成互联,提供GR机制
  2. 要求:当R1通过GR方式重启OSPF进程或者主备倒换时转发不中断

组网拓扑

OSPF GR配置示例

配置思路

  1. 配置路由器基本功能以及各个接口地址
  2. 配置OSPF路由协议
  3. 配置GR

配置命令

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

    • R1配置

      1
      2
      3
      4
      5
      6
      sys
      sys R1
      int g0/0/0
      ip add 10.1.12.1 30
      int g0/0/1
      ip add 10.1.13.1 30
  • R2配置

    1
    2
    3
    4
    sys
    sys R2
    int g0/0/0
    ip add 10.1.12.2 30
  • R3配置

    1
    2
    3
    4
    sys
    sys R3
    int g0/0/1
    ip add 10.1.13.2 30
  1. 配置OSPF路由协议

    • R1配置

      1
      2
      3
      4
      5
      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
  • R2配置

    1
    2
    3
    4
    sys
    ospf 1 router-id 10.2.2.2
    area 1
    network 10.1.12.0 0.0.0.3
  • R3配置

    1
    2
    3
    4
    sys
    ospf 1 router-id 10.3.3.3
    area 0
    network 10.1.13.0 0.0.0.3
  1. 配置GR

    • R1配置

      1
      2
      3
      4
      sys
      ospf 1
      opeque-capability enable
      graceful-restart
  • R2配置

    1
    2
    3
    4
    sys
    ospf 1
    opeque-capability enable
    graceful-restart
  • R3配置

    1
    2
    3
    4
    sys
    ospf 1
    opeque-capability enable
    graceful-restart

查看结果

  1. 查看路由器上OSPF GR的状态

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    display ospf 1 graceful-restart

    <R1>display ospf 1 graceful-restart

    OSPF Process 1 with Router ID 10.1.1.1
    Graceful-restart capability : enabled
    Graceful-restart support : planned and un-planned, totally
    Helper-policy support : planned and un-planned, strict lsa check
    Current GR state : normal
    Graceful-restart period : 120 seconds

    Number of neighbors under helper:
    Normal neighbors : 0
    Virtual neighbors : 0
    Sham-link neighbors : 0
    Total neighbors : 0

    Number of restarting neighbors : 0

    Last exit reason:
    On graceful restart : none
    On Helper : none
  1. R1重启OSPF进程,查看R2的邻居状态

    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
    reset ospf 1 process graceful-restart

    Jun 20 2022 15:04:46-08:00 R2 %%01OSPF/4/RECV_FIRST_GLSA(l)[6]:OSPF 256 attempte
    d to enter helper mode and received first grace LSA from neighbor 1.1.1.10, on i
    nterface 2.12.1.10.
    <R2>display ospf peer
    Jun 20 2022 15:04:46-08:00 R2 %%01OSPF/4/ENTER_HELPER_MODE(l)[7]:OSPF 256 neighb
    or 10.1.1.1 enters helper on interface 2.12.1.10.

    display ospf peer

    <R2>display ospf peer

    OSPF Process 1 with Router ID 10.2.2.2
    Neighbors

    Area 0.0.0.1 interface 10.1.12.2(GigabitEthernet0/0/0)'s neighbors
    Router ID: 10.1.1.1 Address: 10.1.12.1 GR State: Doing GR
    State: Full Mode:Nbr is Slave Priority: 1
    DR: 10.1.12.2 BDR: 10.1.12.1 MTU: 0
    Dead timer due in 27 sec
    Retrans timer interval: 5
    Neighbor is up for 00:00:02
    Authentication Sequence: [ 0 ]


    un 20 2022 15:04:53-08:00 R2 %%01OSPF/4/GR_EXIT_HLP_SU(l)[13]:OSPF 256 neighbor
    10.1.1.1 exits helper successfully on interface 2.12.1.10.
  1. 查看R1与R2的GR状态

    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
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    display ospf 1 graceful-restart

    <R1>display ospf 1 graceful-restart

    OSPF Process 1 with Router ID 10.1.1.1
    Graceful-restart capability : enabled
    Graceful-restart support : planned and un-planned, totally
    Helper-policy support : planned and un-planned, strict lsa check
    Current GR state : normal
    Graceful-restart period : 120 seconds

    Number of neighbors under helper:
    Normal neighbors : 0
    Virtual neighbors : 0
    Sham-link neighbors : 0
    Total neighbors : 0

    Number of restarting neighbors : 0

    Last exit reason:
    On graceful restart : successful exit //restarter成功退出
    On Helper : none


    <R2>dis ospf 1 graceful-restart

    OSPF Process 1 with Router ID 10.2.2.2
    Graceful-restart capability : enabled
    Graceful-restart support : planned and un-planned, totally
    Helper-policy support : planned and un-planned, strict lsa check
    Current GR state : normal
    Graceful-restart period : 120 seconds

    Number of neighbors under helper:
    Normal neighbors : 0
    Virtual neighbors : 0
    Sham-link neighbors : 0
    Total neighbors : 0

    Number of restarting neighbors : 0

    Last exit reason:
    On graceful restart : none
    On Helper : successful exit // Helper 成功退出
吴超 wechat
subscribe to my blog by scanning my public wechat account