萬盛學電腦網

您现在的位置: 萬盛學電腦網 >> 網路安全 >  >> 路由器知識 >> 路由器設定 >> Cisco 思科路由器

Cisco 路由器 OSPF 故障排除全攻略:參數不匹配、鄰居狀態卡住、MTU/ID 衝突

OSPF (Open Shortest Path First) 作為企業級鏈路狀態協議,常因參數不匹配導致鄰居關係無法建立。本文系統歸納四大參數不匹配類型、四種鄰居狀態卡住現象與對應排查指令,並提供 MTU、Router ID 衝突、單播連通性斷裂的解決方案。

一、參數不匹配 — 以 debug ip ospf adj 觀察

不匹配項目現象/錯誤訊息解決方式
Area IDHello 封包中 Area ID 不同雙端 network x.x.x.x mask area Y 確認 Area 編號一致
認證類型一端啟用 MD5、另一端無/Simple統一 area X authentication message-digest、ip ospf message-digest-key 1 md5 PASS
Hello/Dead 間隔Hello 10/40 vs 5/20 秒雙端 ip ospf hello-interval 10 ip ospf dead-interval 40 對齊
Stub/NSSA 選項一端 area X stub、另一端無雙端同步啟用 area X stub 或 area X nssa

二、OSPF 鄰居狀態卡住分析

使用 show ip ospf neighbor 觀察 State 欄位:

1. ATTEMPT (僅 NBMA)

  • 原因:neighbor 指令配置錯誤、NBMA 單播連通性中斷 (DLCI/映射錯誤)。
  • 對策:檢查 neighbor IP 正確性、show frame-relay map 驗證 PVC 狀態。

2. INIT

  • 原因:單向收到 Hello (對方 ACL 擋 Hello、交換機端口故障、單邊啟用認證)。
  • 對策:debug ip ospf hello 確認雙向 Hello、檢查 ACL、關閉單邊認證測試。

3. 2WAY (雙向) — 非 DR/BDR 正常

  • 廣播/多點網路中非 DR/BDR 鄰居停留 2WAY 為正常。
  • 若需強制建立 Full:確保至少一端 ip ospf priority 1 (預設 1),Priority 0 永不當選 DR。

4. EXSTART / EXCHANGE

  • 原因:
     - 介面 MTU 不匹配 (最常見,如一端 1500、另一端 1400/9000)。
     - 鄰居 Router ID 重複。
     - 無法傳送超過特定 MTU 封包 (Ping 大封包測試失敗)。
     - 單播連通性斷裂 (錯誤 DLCI、ACL 擋 OSPF 協議 89、NAT 破壞單播)。
  • 對策:
     - show interface 核對 MTU,統一設定 ip mtu 1500。
     - show ip ospf 確認 Router ID 唯一,衝突時 router-id A.B.C.D 手動指定。
     - ping IP size 1500 df-bit 測試大封包通達。
     - 檢查 ACL/NAT/FR map 確保單播 224.0.0.5/6 及單播鄰居 IP 通達。

三、核心排查指令清單

show ip ospf neighbor [detail]
show ip ospf interface [IF]
show ip ospf database
debug ip ospf adj
debug ip ospf hello
debug ip ospf packet
ping  size 1500 df-bit
mtu 1500 / ip mtu 1500
router-id A.B.C.D

依序驗證:參數一致 → Hello 雙向 → MTU/ID/單播通達 → Full Adjacency 建立 → LSDB 同步 → SPF 計算收斂。

copyright © 萬盛學電腦網 all rights reserved