路由器故障:OSPF配置錯誤導致網絡無法ping通
OSPF配置錯誤導致網絡無法ping通的故障的解決步驟如下:
網絡環境
如下圖的網絡配置中,PC1-RouterA-RouterB-PC2之間通過2M線路相連,運行OSPF協議,并引入直連、靜態路由。PC3-RouterA-RouterB-PC4之間模擬新增加的一條100M鏈路,運行OSPF協議,也引入直連和靜態路由。RouterA和RouterB都在area0。
OSPF組網圖
配置完成之后發現PC1與PC2之間能夠Ping通,但是PC3與PC4之間卻無法Ping通。
#p#
故障分析
步驟 1 在路由器RouterA上執行ping 30.1.1.1命令,能夠Ping通,說明路由器A和B之間的物理鏈路沒有問題。
具體RouterA為例:
- [RouterA] ping 30.1.1.1
- PING 30.1.1.1: 56 data bytes, press CTRL_C to break
- Reply from 30.1.1.1: bytes=56 Sequence=1 ttl=255 time=60 ms
- Reply from 30.1.1.1: bytes=56 Sequence=2 ttl=255 time=80 ms
- Reply from 30.1.1.1: bytes=56 Sequence=3 ttl=255 time=40 ms
- Reply from 30.1.1.1: bytes=56 Sequence=4 ttl=255 time=80 ms
- Reply from 30.1.1.1: bytes=56 Sequence=5 ttl=255 time=20 ms
- --- 30.1.1.1 ping statistics ---
- 5 packet(s) transmitted
- 5 packet(s) received
- 0.00% packet loss
- round-trip min/avg/max = 20/56/80 ms
步驟 2 在RouterA、RouterB上執行display ospf routing,發現沒有RouterB上沒有PC3所在網段的路由信息。
以RouterB的具體顯示為例。
- [RouterB] display ospf routing
- OSPF Process 1 with Router ID 100.1.1.2
- Routing Tables
- Routing for Network
- Destination Cost Type NextHop AdvRouter Area
- 30.1.1.0/24 3124 Stub 20.1.1.2 200.1.1.2 0.0.0.0
- 200.1.1.0/24 3124 Stub 20.1.1.2 200.1.1.2 0.0.0.0
- 20.1.1.0/24 1562 Stub 20.1.1.1 100.1.1.2 0.0.0.0
- 10.1.1.0/24 1562 Stub 10.1.1.2 100.1.1.2 0.0.0.0
- Routing for ASEs
- Destination Cost Type Tag NextHop AdvRouter
- 20.1.1.1/32 1 Type2 1 20.1.1.2 200.1.1.2
- 30.1.1.2/32 1 Type2 1 20.1.1.2 200.1.1.2
- 200.1.1.1/32 1 Type2 1 20.1.1.2 200.1.1.2
- Total Nets: 7
- Intra Area: 4 Inter Area: 0 ASE: 3 NSSA: 0
步驟 3 在RouterA和RouterB上執行display ospf peer命令,發現RouterA和PC3沒有建立OSPF鄰居。
RouterA具體顯示。
- [RouterA] display ospf peer
- OSPF Process 1 with Router ID 100.1.1.2
- Neighbors
- Area 0.0.0.0 interface 10.1.1.2(Gigabitethernet 1/0/0)'s neighbors
- Router ID: 10.1.1.1 Address: 10.1.1.1
- State: Full Mode:Nbr is Slave Priority: 1
- DR: None BDR: None MTU: 0
- Dead timer due in 41 sec
- Neighbor is up for 00:46:52
- Authentication Sequence: [ 0 ]
- Neighbors
- Area 0.0.0.0 interface 20.1.1.1(Gigabitethernet1/0/1)'s neighbors
- Router ID: 200.1.1.2 Address: 20.1.1.2
- State: Full Mode:Nbr is Master Priority: 1
- DR: None BDR: None MTU: 0
- Dead timer due in 36 sec
- Neighbor is up for 00:42:29
- Authentication Sequence: [ 0 ]
步驟 4 在RouterA和RouterB上分別執行display current-configuration configuration ospf命令,對比發現在RouterA上沒有用network命令將PC4所在100.1.1.0/24網段發布出去。
RouterA具體顯示。
- [RouterA] display current-configuration configuration ospf
- #
- ospf 1
- import-route direct
- import-route static
- area 0.0.0.0
- network 10.1.1.0 0.0.0.255
- network 20.1.1.0 0.0.0.255
- #
RouterB具體顯示。
- [RouterB] display current-configuration configuration ospf
- #
- ospf 1
- import-route direct
- import-route static
- area 0.0.0.0
- network 20.1.1.0 0.0.0.255
- network 30.1.1.0 0.0.0.255
- network 200.1.1.0 0.0.0.255
- #
- return
步驟 5 在RouterA上配置network 100.1.1.0 0.0.0.255,然后執行display ospf peer命令,和PC3的OSPF鄰居建立,在PC3上Ping PC4的IP地址200.1.1.1,能夠Ping通。
具體PC3的顯示。
- [RouterA] display ospf peer
- OSPF Process 1 with Router ID 100.1.1.1
- Neighbors
- Area 0.0.0.0 interface 100.1.1.1(Gigabitethernet6/0/0)'s neighbors
- Router ID: 100.1.1.2 Address: 100.1.1.2
- State: Full Mode:Nbr is Master Priority: 1
- DR: None BDR: None MTU: 0
- Dead timer due in 34 sec
- Neighbor is up for 00:09:36
- Authentication Sequence: [ 0 ]
- [PC3] ping 200.1.1.1
- PING 200.1.1.1: 56 data bytes, press CTRL_C to break
- Reply from 200.1.1.1: bytes=56 Sequence=1 ttl=253 time=70 ms
- Reply from 200.1.1.1: bytes=56 Sequence=2 ttl=253 time=40 ms
- Reply from 200.1.1.1: bytes=56 Sequence=3 ttl=253 time=100 ms
- Reply from 200.1.1.1: bytes=56 Sequence=4 ttl=253 time=70 ms
- Reply from 200.1.1.1: bytes=56 Sequence=5 ttl=253 time=100 ms
- --- 200.1.1.1 ping statistics ---
- 5 packet(s) transmitted
- 5 packet(s) received
- 0.00% packet loss
- round-trip min/avg/max = 40/76/100 ms
故障解決。
在構建OSPF網絡時,只有對鏈路的正確宣告,路由器才會建立鄰居關系,根據LSA計算得出轉發路徑。
----結束
#p#
處理步驟
在RouterA執行以下操作:
步驟 1 執行命令system-view,進入系統視圖。
步驟 2 執行命令ospf [ process-id ],進入OSPF進程視圖。
步驟 3 執行命令area area-id,進入OSPF區域視圖。
步驟 4 執行命令network ip-address wildcard-mask,配置區域所包含的網段。
步驟 5 執行命令return退回到用戶視圖,執行命令save,保存對配置的修改。
具體以RouterA的顯示為例。
- [RouterA] ospf 1
- [RouterA-ospf-1] area 0
- [RouterA-ospf-1-area-0.0.0.0] network 100.1.1.0 0.0.0.255
- [RouterA-ospf-1-area-0.0.0.0] quit
- [RouterA-ospf-1] quit
- [RouterA] display ospf peer
- OSPF Process 1 with Router ID 100.1.1.2
- Neighbors
- Area 0.0.0.0 interface 10.1.1.2(Gigabitethernet1/0/0)'s neighbors
- Router ID: 10.1.1.1 Address: 10.1.1.1
- State: Full Mode:Nbr is Slave Priority: 1
- DR: None BDR: None MTU: 0
- Dead timer due in 38 sec
- Neighbor is up for 01:05:56
- Authentication Sequence: [ 0 ]
- Neighbors
- Area 0.0.0.0 interface 20.1.1.1(Gigabitethernet1/0/1)'s neighbors
- Router ID: 200.1.1.2 Address: 20.1.1.2
- State: Full Mode:Nbr is Master Priority: 1
- DR: None BDR: None MTU: 0
- Dead timer due in 41 sec
- Neighbor is up for 01:01:33
- Authentication Sequence: [ 0 ]
- Neighbors
- Area 0.0.0.0 interface 100.1.1.2(Gigabitethernet1/0/2)'s neighbors
- Router ID: 100.1.1.1 Address: 100.1.1.1
- State: Full Mode:Nbr is Slave Priority: 1
- DR: None BDR: None MTU: 0
- Dead timer due in 31 sec
- Neighbor is up for 00:00:06
- Authentication Sequence: [ 0 ]
----結束
完成上述操作后,PC3能夠PING通PC4,故障排除。
案例總結
在構建OSPF網絡時,只有對鏈路的正確宣告,路由器才會建立鄰居關系,根據LSA計算得出轉發路徑。
直連路由的引入只能發生在網絡的末端,即葉節點,它不作為SPF計算的一部分,因此不能誤認為直連路由的引入就等同于對鏈路的宣告。
【編輯推薦】