操作步骤

  1. 执行命令display ospf peer,查看OSPF中各区域邻居的信息。
<Huawei> display ospf peerOSPF Process 1 with Router ID 1.1.1.1 Neighbors  Area 0.0.0.0 interface 10.1.1.1(GigabitEthernet0/0/0)'s neighbors Router ID: 2.2.2.2          Address: 10.1.1.2    State: Full  Mode:Nbr is  Master  Priority: 1 DR: 10.1.1.2  BDR: None   MTU: 0     Dead timer due in 34  sec  Retrans timer interval: 5  Neighbor is up for 00:00:03      Authentication Sequence: [ 0 ]
  1. 如果没有任何OSPF邻居信息显示,检查邻居两端的接口物理状态和协议状态是否UP,状态是否稳定,接口是否有错包、丢包。
    若物理接口不Up或是不稳定(有振荡现象),请排查物理链路和链路层协议,确保物理和协议状态都是Up,并且接口无错误计数。
    执行ping命令确认建立邻居的两个设备是否可以互相Ping通,长Ping测试是否存在丢包现象。
<Huawei> ping 10.1.1.2PING 10.1.1.2: 56  data bytes, press CTRL_C to break Reply from 10.1.1.2: bytes=56 Sequence=1 ttl=255 time=2 ms Reply from 10.1.1.2: bytes=56 Sequence=2 ttl=255 time=2 ms Reply from 10.1.1.2: bytes=56 Sequence=3 ttl=255 time=1 ms Reply from 10.1.1.2: bytes=56 Sequence=4 ttl=255 time=1 ms Reply from 10.1.1.2: bytes=56 Sequence=5 ttl=255 time=2 ms --- 10.1.1.2 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 1/3/13 ms
  1. 如果能够Ping通对端地址,但是没有OSPF邻居信息显示,检查接口是否正常运行OSPF协议。
  1. 检查接口的主IP地址是否在network命令指定的网段范围之内。
    执行命令display ospf [ process-id ] interface [ all | interface-type interface-number ]检查接口是否将主IP地址宣告到OSPF。
     说明:

设备不支持基于接口从IP地址形成OSPF邻居关系,请确保接口主IP地址宣告到OSPF。如果此主接口只有从IP地址在network(OSPF)命令指定的网段范围内,则该主接口不运行OSPF协议。

<Huawei> display ospf 1 interfaceOSPF Process 1 with Router ID 1.1.1.1 Interfaces  Area: 0.0.0.0          (MPLS TE not enabled) IP Address      Type         State    Cost    Pri   DR              BDR  10.1.1.1        Broadcast    DROther  1       1     10.1.1.4        10.1.1.3

如果对应接口的主IP地址未包含在OSPF的network范围内,可以在OSPF进程下执行network network-address wildcard-mask命令宣告该接口IP地址。

<Huawei> system-view
[Huawei] ospf 1
[Huawei-ospf-1] area 1
[Huawei-ospf-1-area-0.0.0.1] network 10.1.1.1 0.0.0.0
[Huawei-ospf-1-area-0.0.0.1] return
<Huawei>

或者在接口下执行ospf enable process-id area area-id使接口运行OSPF。

<Huawei> system-view
[Huawei] interface GigabitEthernet 0/0/0
[Huawei-GigabitEthernet0/0/0] ospf enable 1 area 1
[Huawei-GigabitEthernet0/0/0] return
<Huawei>
  1. 检查接口是否被配置为静默接口。
    静默接口将禁止接口接收和发送OSPF报文,导致接口上无法建立邻居关系。
<Huawei> display current-configuration configuration ospf 
[V200R007C00SPC900]
#
ospf 1 router-id 1.1.1.1 silent-interface GigabitEthernet0/0/0 area 0.0.0.0 network 12.1.1.1 0.0.0.0 area 0.0.0.1 network 10.1.1.1 0.0.0.0
#
return
<Huawei>

如果接口被配置为静默接口,请进入OSPF进程修改。

<Huawei> system-view
[Huawei] ospf 1
[Huawei-ospf-1] undo silent-interface GigabitEthernet 0/0/0
[Huawei-ospf-1] return
<Huawei>
  1. 检查两端OSPF参数配置是否正确。
    可以通过多次执行display ospf [ process-id ] error interfaceinterface-type interface-number命令,查看邻居建立过程中的相关参数错误计数。每10秒执行一次,多次执行进行对比,计数持续增长的参数需要两端进行对比排查,保证参数正确。
    针对相关参数的排查方法可参考下述说明。
  1. 检查两端OSPF进程的Router ID是否冲突。
    OSPF进程的Router ID需保证全网唯一,否则会导致邻居不能正常建立、路由信息不正确。
    # 查看OSPF进程的Router ID。
<Huawei> display ospf 1 briefOSPF Process 1 with Router ID 1.1.1.1 OSPF Protocol Information RouterID: 1.1.1.1          Border Router:  Multi-VPN-Instance is not enabled Global DS-TE Mode: Non-Standard IETF Mode Graceful-restart capability: disabled

如果链路两端OSPF进程的Router ID不唯一,请修改Router ID以保证两端不冲突。 修改后,在用户视图下重启OSPF进程后,新配置的Router ID才会生效。

<Huawei> system-view
[Huawei] ospf 1 router-id 1.1.1.1
[Huawei-ospf-1] return
<Huawei> reset ospf 1 process
Warning: The OSPF process will be reset. Continue? [Y/N]:y
  1. 检查两端OSPF区域ID、区域类型是否一致。
    两端设备互连接口的区域ID和区域类型(NSSA、STUB、普通区域)需保持一致,否则无法建立邻居关系。执行命令display ospf [ process-id ] brief,查看接口所在区域的ID和类型。
<Huawei> display ospf 1 briefOSPF Process 1 with Router ID 1.1.1.1 OSPF Protocol Information RouterID: 1.1.1.1          Border Router:  AREA  AS  …… Area: 0.0.0.1          (MPLS TE not enabled) Authtype: None   Area flag: Stub  SPF scheduled Count: 4      ExChange/Loading Neighbors: 0 Router ID conflict state: Normal Area interface up count: 1 Interface: 10.1.1.1 (GigabitEthernet0/0/0) Cost: 1       State: Waiting    Type: Broadcast    MTU: 1500   ……

如果链路两端OSPF区域ID不一致,请修改配置,保持两端一致。

# 10.1.1.1/32原宣告在area 1,现修改至area 0。

<Huawei> display current-configuration configuration ospf 
[V200R007C00SPC900] 
#
ospf 1 router-id 1.1.1.1 area 0.0.0.0 network 12.1.1.1 0.0.0.0 area 0.0.0.1 network 10.1.1.1 0.0.0.0 
#
return
<Huawei> system-view
[Huawei] ospf 1
[Huawei-ospf-1] area 1
[Huawei-ospf-1-area-0.0.0.1] undo network 10.1.1.1 0.0.0.0
[Huawei-ospf-1-area-0.0.0.1] quit
[Huawei-ospf-1] area 0
[Huawei-ospf-1-area-0.0.0.0] network 10.1.1.1 0.0.0.0
[Huawei-ospf-1-area-0.0.0.0] return
<Huawei>

如果链路两端OSPF区域类型不一致,请修改配置,保证两端一致。缺省情况下,OSPF区域类型为Normal。

# 修改area 1区域类型为Stub。

<Huawei> system-view
[Huawei] ospf 1
[Huawei-ospf-1] area 1
[Huawei-ospf-1-area-0.0.0.1] stub
[Huawei-ospf-1-area-0.0.0.1] return
<Huawei>
  1. 检查两端OSPF验证模式和验证口令是否一致。
    如果配置了OSPF验证,两端的验证类型和验证口令需保持一致,否则邻居关系无法建立。
    # 查看接口GE0/0/0是否配置了OSPF验证。
<Huawei> display current-configuration interface GigabitEthernet0/0/0
[V200R007C00SPC900]
#
interface GigabitEthernet0/0/0 ip address 10.1.1.1 255.255.255.0 ip address 10.2.1.1 255.255.255.0 sub ospf authentication-mode md5 1 cipher %@%@z#UE)ok^"*^=IMJ36>$41FVP%@%@ 
#
return

# 查看OSPF区域是否配置了OSPF验证。

<Huawei> display current-configuration configuration ospf
[V200R007C00SPC900]
#
ospf 1 router-id 1.1.1.1 area 0.0.0.0 authentication-mode md5 1 cipher %@%@N^O.C,IYy$d=sTMMlXYU1@n.%@%@     network 10.1.1.1 0.0.0.0 network 12.1.1.1 0.0.0.0 area 0.0.0.1
#
return

如果链路两端的OSPF验证模式或验证口令不匹配,请根据所配置的验证方式(接口验证、区域验证)在相应视图进行修改。

# 在Area 0区域配置OSPF区域验证,验证模式为MD5,验证字标识符为1,密码为huawei(整个Area 0中设备的OSPF验证模式、验证字标识符,密码均需一致)。

<Huawei> system-view
[Huawei] ospf 1
[Huawei-ospf-1] area 0
[Huawei-ospf-1-area-0.0.0.0] authentication-mode md5 1 cipher huawei 
[Huawei-ospf-1-area-0.0.0.0] return
<Huawei>
  1. 检查两端OSPF接口的网络类型、发送Hello报文时间间隔和邻居失效时间配置是否一致。
    一般情况下,链路两端OSPF接口的网络类型、发送Hello报文时间间隔和邻居失效时间需保持一致,否则会导致邻居关系无法正常建立、路由信息不正确。
    # 执行display ospf interface verbose查看网络类型、发送Hello报文时间间隔和邻居失效时间等信息。
<Huawei> display ospf interface verbose OSPF Process 1 with Router ID 1.1.1.1 Interfaces  Area: 0.0.0.0          (MPLS TE not enabled) Interface: 10.1.1.1 (GigabitEthernet0/0/0) Cost: 1       State: Down      Type: Broadcast    MTU: 1500   Priority: 1 Designated Router: 0.0.0.0 Backup Designated Router: 0.0.0.0 Timers: Hello 10 , Dead 40 , Poll  120 , Retransmit 5 , Transmit Delay 1  IO Statistics ……

如果两端OSPF接口的网络类型不一致,请修改接口的OSPF网络类型,保持两端一致。

# 配置接口GE0/0/0的OSPF网络类型为Broadcast。

<Huawei> system-view
[Huawei] interface GigabitEthernet 0/0/0
[Huawei-GigabitEthernet0/0/0] ospf network-type broadcast 
[Huawei-GigabitEthernet0/0/0] return
<Huawei>

如果两端发送Hello报文时间间隔和邻居失效时间不一致,请修改相应配置,保持两端一致。

# 配置接口GE0/0/0发送Hello报文的时间间隔为10秒,邻居失效时间为40秒。

<Huawei> system-view
[Huawei] interface GigabitEthernet 0/0/0
[Huawei-GigabitEthernet0/0/0] ospf timer hello 10 
[Huawei-GigabitEthernet0/0/0] ospf timer dead 40
[Huawei-GigabitEthernet0/0/0] return
<Huawei>
  1. 检查两端OSPF互连接口IP地址的掩码是否一致。
    一般情况下,链路两端OSPF互连接口IP地址的掩码必须一致,否则双方不能正常建立OSPF邻居关系。
<Huawei> display current-configuration interface GigabitEthernet 0/0/0
[V200R007C00SPC900]
#
interface GigabitEthernet0/0/0 ip address 10.1.1.1 255.255.255.0 
#
return

如果链路两端OSPF接口IP地址的掩码不一致,请修改配置,保证两端一致。

<Huawei> system-view
[Huawei] interface GigabitEthernet 0/0/0
[Huawei-GigabitEthernet0/0/0] ip address 10.1.1.1 24
[Huawei-GigabitEthernet0/0/0] return
<Huawei>