OSPF邻居无法建立、路由学习异常

2026-03-30发表
  • 0收藏

描述

一、OSPF邻居无法建立、路由学习异常

由于OSPF路由正确的加入到全局路由表,依赖于正确的OSPF路由计算,而OSPF计算路由依赖于正确的OSPF LSDB数据库信息,要建立正确的OSPF LSDB数据库则首先要确保邻居之间能够形成正确的邻接关系.因此OSPF路由问题的排查整体思路为:首先检查OSPF邻居关系,然后检查OSPF LSDB数据库信息,最后检查全局路由表.

二、流程相关操作说明:

1、查看OSPF邻居状态是否正确

查看两端OSPF邻居状态是否正常,正常情况下DRother之间的邻居关系应该稳定在2-way状态,非DRother之间的邻居关系应该稳定在Full状态

命令:display ospf peer x.x.x.x

例如:通过命令查看,可以确认OSPF的邻居状态是否正常。

<H3C>display ospf peer 2.2.2.2

 

                  OSPF Process 1 with Router ID 1.1.1.1

                        Neighbor Brief Information

  Area: 0.0.0.0        

 Router ID       Address         Pri Dead-Time Interface       State

 2.2.2.2         10.1.1.2        1   35        Eth0/1/0.2      Full/BDR 


2、确认接口启动OSPF及邻居两端OSPF参数相匹配

l 确认接口启动OSPF

OSPF的运行是基于设备接口的,如果OSPF没有在接口启动,那么邻居关系肯定无法形成。在接口上启用OSPF是通过Area视图下的network命令实现的,必须确保network中的网络范围包括需要启动OSPF的接口地址。

命令:display ospf interface

例如:通过命令查看接口是否启动OSPF

H3C>display ospf interface

        OSPF Process 1 with Router ID 3.3.3.3

                 Interfaces

 Area: 0.0.0.0

 IP Address      Type      State    Cost  Pri   DR          BDR

 12.1.1.1        Broadcast DR       1     1     12.1.1.1   12.1.1.2



l 确认邻居两端OSPF参数相匹配

(1)OSPF区域配置是否匹配

启动OSPF的接口属于某个区域,同时区域有多种类型,区域依靠区域ID进行标识,如果两边的区域类型或区域ID不匹配,则不会形成邻居关系。

(2)OSPF验证配置是否匹配

OSPF支持报文验证功能,验证分为简单验证和MD5验证两种类型,如果两边验证类型或密钥配置不同,则OSPF无法通过验证,邻居关系无法形成。

(3)两端OSPF接口上计时器设定值是否匹配

OSPF通过周期性的交互Hello报文维系邻居关系,Hello报文中携带了Hello报文的发送间隔计时器及邻居失效计时器,如果这些计时器的值在两边的Hello报文中不匹配,那么OSPF的邻居关系无法形成。注意dead timer的值至少应为hello timer值的4

(4)两端OSPF接口类型是否匹配

OSPF邻居关系的正常建立需要确保邻居两端接口的OSPF网络类型一致,否则将无法形成邻居关系。需要说明的是若邻居双方一端设置为P2P类型另一端设置为广播类型,那么邻居状态可以达到FULL状态,但此时无法计算出路由信息。

(5)广播网络中两端接口子网掩码是否相同

OSPF Hello报文中携带子网掩码信息。在广播网络中,如果两端接口属于不同的IP子网,那么邻居关系无法形成。

(6)NBMA网络是否指定邻居

OSPF网络类型为NBMA时必须手工指定邻居的IP地址,否则端口无法发送Hello报文,无法形成邻居关系。

命令:display current-configuration interface

display current-configuration configuration ospf

例如:通过命令查看接口下的OSPF参数设置是否一致。

<H3C>display current-configuration interface e0/1/0.1

#

interface Ethernet0/1/0.1

 vlan-type dot1q vid 100

 ip address 20.1.1.1 255.255.255.0

 ospf network-type p2p

<H3C>display current-configuration interface e0/1/0.1

#

interface Ethernet0/1/0.1

 vlan-type dot1q vid 100

 ip address 20.1.1.2 255.255.255.0

 ospf network-type p2p

 


3、确认邻接关系的两端接口没有设置为静默端口

当接口在OSPF协议视图中被设置为静默端口时,它将不能发送OSPF Hello报文,因此OSPF邻居关系无法形成

命令:display current-configuration configuration ospf

例如:通过命令查看接口正确启动OSPF并设置为非静默端口,下例中配置了静默端口

<H3C>display current-configuration configuration ospf

#

ospf 1

 silent-interface GigabitEthernet 2/0/1

 area 0.0.0.0

  network 10.1.1.1 0.0.0.0

 area 0.0.0.1

  network 20.1.1.1 0.0.0.0

  network 10.10.2.1 0.0.0.0



4、查看路由是否加入OSPF路由表

查看OSPF路由表中是否存在相应路由。

命令:display ospf routing x.x.x.x

例如:查看外部路由9.9.9.9是否加入ospf路由表

<H3C>display ospf routing 9.9.9.9

 

         OSPF Process 1 with Router ID 4.4.4.4

                  Routing Tables

Routing for ASEs

 Destination      Cost     Type    Tag         NextHop         AdvRouter

 9.9.9.9/32       1        Type2   1           10.10.5.1       3.3.3.3



5、确认路由信息正确发布

若查看OSPF路由表未发现相应路由信息,请首先确认路由信息是否在OSPF中正确发布,对于未进行发布的路由请修改配置将路由正确发布

命令:display current-configuration configuration ospf

例如:查看10.10.4.0/24的路由信息是否在OSPF中发布

<H3C>display current-configuration configuration ospf

#

ospf 1

 area 0.0.0.0

  network 10.10.1.0 0.0.0.255

  network 10.10.4.0 0.0.0.255

 area 0.0.0.1

  network 10.10.2.0 0.0.0.255



6、确认LSA信息正确

确认OSPF LSDB数据库中是否存在路由计算所需的正确LSA信息。对于区域内的路由需要检查是否存在该路由始发者的Router LSA,DR的Network LSA(广播网络);对于区域间的路由需要首先检查是否存在LS ID为该网段的Summary LSA,然后检查是否存在该Summary LSA所对应Adv Rtr的Router LSA;如果外部路由是通过区域内学习到的,需要首先检查是否存在LS ID为该网段的ASE LSA,然后检查是否存在该ASE LSA中所对应Adv Rtr的Router LSA;如果外部路由是通过区域间学到的那么首先检查对应的ASE LSA,然后检查是否存在该ASE LSA所对应Adv Rtr的Asbr Sumarry LSA,最后检查该Asbr Summary LSA所对应Adv Rtr的Router LSA。

命令:display ospf lsdb router

display ospf lsdb network

display ospf lsdb summary

display ospf lsdb asbr

display ospf lsdb ase

例如:通过命令查看外部路由9.9.9.9相关的LSA信息。


<H3C>display ospf lsdb ase 9.9.9.9

         OSPF Process 1 with Router ID 4.4.4.4

                 Link State Database

    Type      : External

    LS ID     : 9.9.9.9

    Adv Rtr   : 3.3.3.3  

    LS Age    : 841

    Len       : 36

    Options   :  E  

<H3C>display ospf lsdb asbr 3.3.3.3

         OSPF Process 1 with Router ID 4.4.4.4

                         Area: 0.0.0.2

                 Link State Database

    Type      : Sum-Asbr

    LS ID     : 3.3.3.3

    Adv Rtr   : 2.2.2.2  

    LS Age    : 1091

    Len       : 28

    Options   :  E  

<H3C>display ospf lsdb router 2.2.2.2

         OSPF Process 1 with Router ID 4.4.4.4

                         Area: 0.0.0.2

                 Link State Database

    Type      : Router

    LS ID     : 2.2.2.2

    Adv Rtr   : 2.2.2.2  

       Link Count: 1

       Link ID: 10.10.5.1    

       Data   : 10.10.5.1    

       Link Type: TransNet     

       Metric : 1

例如:通过命令查看区域内路由10.10.4.0/24相关的LSA信息


<H3C>display ospf lsdb network

 

         OSPF Process 1 with Router ID 2.2.2.2

                         Area: 0.0.0.0

                 Link State Database

    Type      : Network

    LS ID     : 10.10.1.1

    Adv Rtr   : 1.1.1.1  

    LS Age    : 934

    Len       : 32

    Options   :  E  

    Seq#      : 80000002

    Checksum  : 0xc76b

    Net Mask  : 255.255.255.0

       Attached Router    2.2.2.2

       Attached Router    1.1.1.1

<H3C>display ospf lsdb router 1.1.1.1

         OSPF Process 1 with Router ID 2.2.2.2

                         Area: 0.0.0.0

                 Link State Database

    Type      : Router

    LS ID     : 1.1.1.1

    Adv Rtr   : 1.1.1.1  

    LS Age    : 265

    Len       : 48

    Options   :  ABR  E  

    Seq#      : 80000007

    Checksum  : 0x8d61

    Link Count: 2

       Link ID: 10.10.1.1    

       Data   : 10.10.1.1    

       Link Type: TransNet     

       Metric : 1

       Link ID: 10.10.4.0    

       Data   : 255.255.255.0

       Link Type: StubNet      

       Metric : 1

例如:通过命令查看区域间路由10.10.2.0/24相关的LSA信息

<H3C>display ospf lsdb summary 10.10.2.0

         OSPF Process 1 with Router ID 2.2.2.2

                         Area: 0.0.0.0

                 Link State Database

    Type      : Sum-Net

    LS ID     : 10.10.2.0

    Adv Rtr   : 1.1.1.1  

    LS Age    : 1400

    Len       : 28

    Options   :  E  

    Seq#      : 80000001

    Checksum  : 0x46fb

    Net Mask  : 255.255.255.0

Tos 0  Metric: 1

<H3C>display ospf lsdb router 1.1.1.1

         OSPF Process 1 with Router ID 2.2.2.2

                         Area: 0.0.0.0

                 Link State Database

    Type      : Router

    LS ID     : 1.1.1.1

    Adv Rtr   : 1.1.1.1  

    LS Age    : 823

    Len       : 48

    Options   :  ABR  E  

    Seq#      : 80000007

    Checksum  : 0x8d61

    Link Count: 2

       Link ID: 10.10.1.1    

       Data   : 10.10.1.1    

       Link Type: TransNet     

       Metric : 1

       Link ID: 10.10.4.0    

       Data   : 255.255.255.0

       Link Type: StubNet      

       Metric : 1


导致OSPF数据库中LSA异常或缺失的原因主要包括如下几种情况,需要从相关的配置或规划角度进行修正

1. 骨干区域被分割,导致LSA缺失

2. 虚连接配置错误,导致LSA缺失

3. RouterID冲突,导致LSA震荡

7、若外部路由携带FA地址确认FA路由为有效路由

若外部路由携带FA地址确认FA路由为有效路由。OSPF必须能够通过区域内或区域间路由到达该FA地址,否则该外部路由不会加入OSPF路由表。

例如:外部路由9.9.9.9携带了FA地址为10.10.6.2,通过OSPF内部路由能够学习到10.10.6.2的路由,外部路由9.9.9.9正确加入路由表

<H3C>display ospf lsdb ase 9.9.9.9

         OSPF Process 1 with Router ID 4.4.4.4

                 Link State Database

    Type      : External

    LS ID     : 9.9.9.9

    Adv Rtr   : 3.3.3.3  

    LS Age    : 841

    Len       : 36

    Options   :  E  

    Seq#      : 80000005

    Checksum  : 0x4e32

    Net Mask  : 255.255.255.255

    TOS 0  Metric: 1

    E Type    : 2

    Forwarding Address : 10.10.6.2

Tag       : 1            

<H3C>display ospf routing

         OSPF Process 1 with Router ID 4.4.4.4

                  Routing Tables

 Routing for Network

 Destination        Cost     Type    NextHop        AdvRouter    Area

  10.10.6.0/24       3      Inter   10.10.5.1      2.2.2.2     0.0.0.0



8、查看路由是否加入全局路由表

查看OSPF路由是否正确加入到全局路由表内,只有加入到全局路由表的路由才能指导数据包的转发。如果相同的路由信息同时也从其他路由协议学到,为了确保OSPF学习的路由能够最终加入全局路由表,需要确保其优先级为最优

命令:display ip routing-table x.x.x.x verbose

    

<H3C>display ip routing-table 9.9.9.9 verbose

Routing Table : Public

Summary Count : 2

  Destination: 9.9.9.9/32

     Protocol: O_ASE           Process ID: 1

   Preference: 150                   Cost: 1

      NextHop: 10.10.1.1        Interface: Ethernet0/1/0

    BkNextHop: 0.0.0.0        BkInterface:

  RelyNextHop: 0.0.0.0          Neighbor : 0.0.0.0

    Tunnel ID: 0x0                  Label: NULL           

        State: Active Adv             Age: 00h52m12s

          Tag: 1              

  Destination: 9.9.9.9/32

     Protocol: Static          Process ID: 0

   Preference: 200                   Cost: 0

      NextHop: 0.0.0.0          Interface: NULL0

    BkNextHop: 0.0.0.0        BkInterface:

  RelyNextHop: 0.0.0.0          Neighbor : 0.0.0.0

    Tunnel ID: 0x0                  Label: NULL           

        State: Inactive Adv           Age: 00h00m26s

          Tag: 0              


 


提出建议

    +

亲~登录后才可以操作哦!

确定

你的邮箱还未认证,请认证邮箱或绑定手机后进行当前操作