OSPF (Open Shortest Path First) 作為企業級鏈路狀態協議,常因參數不匹配導致鄰居關係無法建立。本文系統歸納四大參數不匹配類型、四種鄰居狀態卡住現象與對應排查指令,並提供 MTU、Router ID 衝突、單播連通性斷裂的解決方案。
debug ip ospf adj 觀察| 不匹配項目 | 現象/錯誤訊息 | 解決方式 |
|---|---|---|
| Area ID | Hello 封包中 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 |
使用 show ip ospf neighbor 觀察 State 欄位:
neighbor 指令配置錯誤、NBMA 單播連通性中斷 (DLCI/映射錯誤)。neighbor IP 正確性、show frame-relay map 驗證 PVC 狀態。debug ip ospf hello 確認雙向 Hello、檢查 ACL、關閉單邊認證測試。ip ospf priority 1 (預設 1),Priority 0 永不當選 DR。show interface 核對 MTU,統一設定 ip mtu 1500。show ip ospf 確認 Router ID 唯一,衝突時 router-id A.B.C.D 手動指定。ping IP size 1500 df-bit 測試大封包通達。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 計算收斂。