本產品的文件集力求使用無偏見用語。針對本文件集的目的,無偏見係定義為未根據年齡、身心障礙、性別、種族身分、民族身分、性別傾向、社會經濟地位及交織性表示歧視的用語。由於本產品軟體使用者介面中硬式編碼的語言、根據 RFP 文件使用的語言,或引用第三方產品的語言,因此本文件中可能會出現例外狀況。深入瞭解思科如何使用包容性用語。
思科已使用電腦和人工技術翻譯本文件,讓全世界的使用者能夠以自己的語言理解支援內容。請注意,即使是最佳機器翻譯,也不如專業譯者翻譯的內容準確。Cisco Systems, Inc. 對這些翻譯的準確度概不負責,並建議一律查看原始英文文件(提供連結)。
本文說明當資料庫中的路由不在路由資訊庫 (RIB) 或路由表中時,如何修復 OSPF 問題。
本文檔的讀者必須瞭解以下主題:
開放最短路徑優先(OSPF)協定的基本知識
Cisco IOS®中的OSPF配置基礎知識
本文中的資訊係根據以下軟體和硬體版本:
Cisco IOS軟體版本12及更新版本
所有思科路由器平台都支援此功能
本文中的資訊是根據特定實驗室環境內的裝置所建立。文中使用到的所有裝置皆從已清除(預設)的組態來啟動。如果您的網路運作中,請確保您瞭解任何指令可能造成的影響。
如需文件慣例的詳細資訊,請參閱思科技術提示慣例。
本文描述開放最短路徑優先(OSPF)的一個常見問題,即資料庫中的路由不會出現在路由資訊庫(RIB)或路由表中。在大多數情況下,OSPF會發現資料庫中的差異,因此不會在路由表中安裝路由。通常,當發生此問題時,您會在資料庫的鏈路狀態通告(LSA)上看到Adv Router is not-reachable消息(這意味著通告LSA的路由器無法通過OSPF到達)。以下是範例:
Router#
show ip ospf database router 172.16.32.2
Adv Router is not-reachableLS age: 418 Options: (No TOS-capability, DC) LS Type: Router Links Link State ID: 172.16.32.2 Advertising Router: 172.16.32.2 LS Seq Number: 80000002 Checksum: 0xFA63 Length: 60 Number of Links: 3
造成此問題的原因有多種,其中大多數的原因都是配置錯誤或拓撲斷開。更正配置後,OSPF資料庫差異消失,路由顯示在路由表中。本文檔解釋了可能導致資料庫中存在差異的一些更常見原因。
本文檔中用於驗證OSPF行為的一些命令包括show ip ospf interface、show ip ospf database router、show ip ospf neighbor和show ip ospf database external。如果您的Cisco裝置輸出了這些命令中的任意一個,則可以使用Cisco CLI Analyzer顯示潛在的問題和解決方法。
下一個網路圖用作示例:
R4-4K |
R1-7010 |
interface Loopback0 ip address 172.16.33.1 255.255.255.255 ! interface Serial2 ip address 172.16.32.1 255.255.255.0 ip ospf network broadcast ! router ospf 20 network 172.16.0.0 0.0.255.255 area 0 |
interface Loopback0 ip address 172.16.30.1 255.255.255.255 ! interface Serial1/0 ip address 172.16.32.2 255.255.255.0 clockrate 64000 ! router ospf 20 network 172.16.0.0 0.0.255.255 area 0 |
R4-4K(4)#show ip ospf interface serial 2 Serial2 is up, line protocol is up Internet Address 172.16.32.1/24, Area 0 Process ID 20, Router ID 172.16.33.1, Network Type BROADCAST, Cost: 64 Transmit Delay is 1 sec, State DR, Priority 1 Designated Router (ID) 172.16.33.1, Interface address 172.16.32.1 Backup Designated router (ID) 172.16.32.2, Interface address 172.16.32.2 Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 Hello due in 00:00:08 Neighbor Count is 1, Adjacent neighbor count is 1 Adjacent with neighbor 172.16.32.2 (Backup Designated Router) Suppress hello for 0 neighbor(s) R1-7010(5)#show ip ospf interface serial 1/0 Serial1/0 is up, line protocol is up Internet Address 172.16.32.2/24, Area 0 Process ID 20, Router ID 172.16.32.2, Network Type POINT_TO_POINT, Cost: 64 Transmit Delay is 1 sec, State POINT_TO_POINT, Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 Hello due in 00:00:02 Neighbor Count is 1, Adjacent neighbor count is 1 Adjacent with neighbor 172.16.33.1 Suppress hello for 0 neighbor(s)
如前面的輸出所示,路由器R4-4K配置為廣播,路由器R1-7010配置為點對點。這種網路型別不相符會導致廣告路由器無法連線。
R4-4K(4)#show ip ospf database router 172.16.32.2 Adv Router is not-reachable LS age: 418 Options: (No TOS-capability, DC) LS Type: Router Links Link State ID: 172.16.32.2 Advertising Router: 172.16.32.2 LS Seq Number: 80000002 Checksum: 0xFA63 Length: 60 Number of Links: 3 Link connected to: another Router (point-to-point) (Link ID) Neighboring Router ID: 172.16.33.1 (Link Data) Router Interface address: 172.16.32.2 Number of TOS metrics: 0 TOS 0 Metrics: 64 Link connected to: a Stub Network (Link ID) Network/subnet number: 172.16.32.0 (Link Data) Network Mask: 255.255.255.0 Number of TOS metrics: 0 TOS 0 Metrics: 64 R1-7010(5)#show ip ospf database router 172.16.33.1 Adv Router is not-reachable LS age: 357 Options: (No TOS-capability, DC) LS Type: Router Links Link State ID: 172.16.33.1 Advertising Router: 172.16.33.1 LS Seq Number: 8000000A Checksum: 0xD4AA Length: 48 Number of Links: 2 Link connected to: a Transit Network (Link ID) Designated Router address: 172.16.32.1 (Link Data) Router Interface address: 172.16.32.1 Number of TOS metrics: 0 TOS 0 Metrics: 64
您可以看到,對於子網172.16.32.0/24,路由器R1-7010生成一條點對點鏈路,路由器R4-4K生成一條傳輸鏈路。這會導致鏈路狀態資料庫中存在不一致,這意味著路由表中未安裝任何路由。
R1-7010(5)#show ip route 172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks C 172.16.32.0/24 is directly connected, Serial1/0 C 172.16.30.1/32 is directly connected, Loopback0
要解決此問題,請將兩台路由器配置為同一網路型別。您可以將路由器R1-7010的網路型別更改為廣播,或者將路由器R4-4K串列介面更改為點對點。
註:如果出現一端是多點介面而另一端是子介面的情況,請將網路型別更改為兩端廣播。
在本示例中,我們刪除了R4-4K上的network-type broadcast語句,因為兩端都是點對點高級資料鏈路控制(HDLC)封裝的介面。
R4-4K(4)#configure terminal R4-4K(4)(config)#interface serial 2 R4-4K(4)(config-if)#no ip ospf network broadcast R4-4K(4)(config-if)#end R4-4K(4)#show ip ospf interface serial 2 Serial2 is up, line protocol is up Internet Address 172.16.32.1/24, Area 0 Process ID 20, Router ID 172.16.33.1, Network Type POINT_TO_POINT, Cost: 64 Transmit Delay is 1 sec, State POINT_TO_POINT, Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 Hello due in 00:00:04 Neighbor Count is 1, Adjacent neighbor count is 1 Adjacent with neighbor 172.16.32.2 Suppress hello for 0 neighbor(s)
請考慮以下網路圖作為範例:
R4-4K |
R1-7010 |
interface loopback 0 ip address 172.16.35.1 255.255.255.255 ! interface Serial2 ip address 172.16.29.1 255.255.255.0 ! interface Serial3 ip address 172.16.32.1 255.255.255.0 ! router ospf 20 network 172.16.0.0 0.0.255.255 area 0 |
interface loopback 0 ip address 172.16.30.1 255.255.255.255 ! interface Serial1/0 ip address 172.16.32.2 255.255.255.0 clockrate 64000 ! interface Serial1/1 ip address 172.16.29.2 255.255.255.0 clockrate 38400 ! router ospf 20 network 172.16.0.0 0.0.255.255 area 0 |
您可以看到,IP地址在以前的配置中發生翻轉,導致OSPF資料庫中存在差異。但是,這些路由器仍然在Cisco IOS版本12.1之前形成鄰居,因為在點對點鏈路上,OSPF路由器不會驗證相鄰路由器是否位於同一子網中。
R4-4K(4)#show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 172.16.32.2 1 FULL/ - 00:00:37 172.16.32.2 Serial2 172.16.32.2 1 FULL/ - 00:00:31 172.16.29.2 Serial3
從上面的輸出中,您可以看到Serial2用於形成IP地址為172.16.32.2的鄰居,該鄰居不在同一個子網中。雖然形成了鄰居,但路由表中未安裝任何路由:
R1-7010(5)#show ip route 172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks C 172.16.32.0/24 is directly connected, Serial1/0 C 172.16.29.0/24 is directly connected, Serial1/1 C 172.16.30.1/32 is directly connected, Loopback0
要解決此問題,請正確分配IP地址或交換串列電纜。我們已更正以下IP地址:
R4-4K |
R1-7010 |
interface loopback 0 ip address 172.16.35.1 255.255.255.255 ! interface Serial2 ip address 172.16.32.1 255.255.255.0 ! interface Serial3 ip address 172.16.29.1 255.255.255.0 ! router ospf 20 network 172.16.0.0 0.0.255.255 area 0 |
interface loopback 0 ip address 172.16.30.1 255.255.255.255 ! interface Serial1/0 ip address 172.16.32.2 255.255.255.0 clockrate 64000 ! interface Serial1/1 ip address 172.16.29.2 255.255.255.0 clockrate 38400 ! router ospf 20 network 172.16.0.0 0.0.255.255 area 0 |
R4-4K(4)#show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 172.16.32.2 1 FULL/ - 00:00:36 172.16.32.2 Serial2 172.16.32.2 1 FULL/ - 00:00:39 172.16.29.2 Serial3
現在它顯示了Serial 2介面的正確鄰居地址。路由表也包含這些路由:
R1-7010(5)#show ip route 172.16.0.0/16 is variably subnetted, 4 subnets, 2 masks C 172.16.32.0/24 is directly connected, Serial1/0 O 172.16.35.1/32 [110/65] via 172.16.32.1, 00:03:12, Serial1/0 [110/65] via 172.16.29.1, 00:03:12, Serial1/1 C 172.16.29.0/24 is directly connected, Serial1/1 C 172.16.30.1/32 is directly connected, Loopback0
請考慮以下網路圖作為範例:
這種情況產生的行為與雙串列鏈路設定中的錯誤地址分配完全相同。要解決此問題,請在兩台路由器上分配同一子網中的IP地址。
請考慮下一個網路圖作為範例:
R4-4K | R1-7010 |
---|---|
interface Loopback0 ip address 172.16.35.1 255.255.255.255 ! interface Serial2 ip unnumbered Loopback0 router ospf 20 network 172.16.0.0 0.0.255.255 area 0 |
interface Loopback0 ip address 172.16.30.1 255.255.255.255 ! interface Serial1/0 ip address 172.16.32.2 255.255.255.0 clockrate 64000 ! router ospf 20 network 172.16.0.0 0.0.255.255 area 0 |
R4-4K(4)#show interface serial 2 Serial2 is up, line protocol is up Hardware is cxBus Serial Interface is unnumbered. Using address of Loopback0 (172.16.35.1) R1-7010(5)#show interface serial 1/0 Serial1/0 is up, line protocol is up Hardware is cxBus Serial Internet address is 172.16.32.2/24
先前的輸出顯示,R4-4K Serial 2介面未編號為Loopback0(使用Loopback0 172.16.35.1的地址),而R1-7010的Serial 1/0介面為編號介面。
R4-4K(4)#show ip ospf interface serial 2 Serial2 is up, line protocol is up Internet Address 0.0.0.0/24, Area 0 Process ID 20, Router ID 172.16.35.1, Network Type POINT_TO_POINT, Cost: 64 Transmit Delay is 1 sec, State POINT_TO_POINT, Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 Hello due in 00:00:02 Neighbor Count is 1, Adjacent neighbor count is 1 Adjacent with neighbor 172.16.32.2 Suppress hello for 0 neighbor(s) R1-7010(5)#show ip ospf interface serial 1/0 Serial1/0 is up, line protocol is up Internet Address 172.16.32.2/24, Area 0 Process ID 20, Router ID 172.16.32.2, Network Type POINT_TO_POINT, Cost: 64 Transmit Delay is 1 sec, State POINT_TO_POINT, Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 Hello due in 00:00:02 Neighbor Count is 1, Adjacent neighbor count is 1 Adjacent with neighbor 172.16.33.1 Suppress hello for 0 neighbor(s)
正如前面所看到的,這兩種情況中的network-type都是點對點的。問題是一端未編號,而另一端未編號,這樣會在資料庫中產生差異,如下所示。
R4-4K(4)#show ip ospf database router 172.16.30.1 OSPF Router with ID (172.16.35.1) (Process ID 20) Router Link States (Area 0) LS age: 202 Options: (No TOS-capability, DC) LS Type: Router Links Link State ID: 172.16.30.1 Advertising Router: 172.16.30.1 LS Seq Number: 80000002 Checksum: 0xC899 Length: 60 Number of Links: 3 Link connected to: another Router (point-to-point) (Link ID) Neighboring Router ID: 172.16.35.1 (Link Data) Router Interface address: 172.16.32.2 Number of TOS metrics: 0 TOS 0 Metrics: 64 Link connected to: a Stub Network (Link ID) Network/subnet number: 172.16.32.0 (Link Data) Network Mask: 255.255.255.0 Number of TOS metrics: 0 TOS 0 Metrics: 64 Link connected to: a Stub Network (Link ID) Network/subnet number: 172.16.30.1 (Link Data) Network Mask: 255.255.255.255 Number of TOS metrics: 0 TOS 0 Metrics: 1 R1-7010(5)#show ip ospf database router 172.16.35.1 OSPF Router with ID (172.16.30.1) (Process ID 20) Router Link States (Area 0) Adv Router is not-reachable LS age: 396 Options: (No TOS-capability, DC) LS Type: Router Links Link State ID: 172.16.35.1 Advertising Router: 172.16.35.1 LS Seq Number: 80000003 Checksum: 0xBEA1 Length: 48 Number of Links: 2 Link connected to: another Router (point-to-point) (Link ID) Neighboring Router ID: 172.16.30.1 (Link Data) Router Interface address: 0.0.0.3 !--- In case of an unnumbered link we use MIB-II IfIndex value which usually starts with 0. Number of TOS metrics: 0 TOS 0 Metrics: 64 Link connected to: a Stub Network (Link ID) Network/subnet number: 172.16.35.1 (Link Data) Network Mask: 255.255.255.255 Number of TOS metrics: 0 TOS 0 Metrics: 1 R1-7010(5)#
您可以看到,R1-7010使用包含其介面地址的Link Data欄位為此點對點鏈路生成LSA,而R4-4K使用包含MIB-II IfIndex值的Link Data欄位為同一鏈路生成LSA(RFC 2328)。這會導致鏈路狀態資料庫中存在不一致,這意味著路由表中未安裝任何路由。
R1-7010(5)#show ip route 172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks C 172.16.32.0/24 is directly connected, Serial1/0 C 172.16.30.1/32 is directly connected, Loopback0
要解決此問題,請將兩台路由器的串列介面配置為已編號或未編號。在本例中,我們對路由器R4-4K的串列2介面進行了編號。
R4-4K(4)#configure terminal R4-4K(4)(config)#interface serial 2 R4-4K(4)(config-if)#no ip unnumbered loopback 0 R4-4K(4)(config-if)#ip address 172.16.32.1 255.255.255.0 R4-4K(4))#show ip ospf interface serial 2 Serial2 is up, line protocol is up Internet Address 172.16.32.1/24, Area 0 Process ID 20, Router ID 172.16.33.1, Network Type POINT_TO_POINT, Cost: 64 Transmit Delay is 1 sec, State POINT_TO_POINT, Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 Hello due in 00:00:02 Neighbor Count is 1, Adjacent neighbor count is 1 Adjacent with neighbor 172.16.32.2 Suppress hello for 0 neighbor(s) R1-7010(5)#show ip route 172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks C 172.16.32.0/24 is directly connected, Serial1/0 O 172.16.33.1/32 [110/65] via 172.16.32.1, 00:03:08, Serial1/0 C 172.16.30.1/32 is directly connected, Loopback0
請考慮以下網路圖作為範例:
R9-2500 |
interface Loopback0 ip address 10.50.50.50 255.255.255.255 ! interface Serial0 ip address 10.10.10.5 255.255.255.0 encapsulation frame-relay ip ospf network broadcast frame-relay map ip 10.10.10.6 102 broadcast frame-relay map ip 10.10.10.7 101 broadcast ! router ospf 10 network 10.10.10.0 0.0.0.255 area 0 network 10.50.50.0 0.0.0.255 area 0 |
R4-4K |
interface Loopback0 ip address 10.70.70.70 255.255.255.255 ! interface Serial0 ip address 10.10.10.7 255.255.255.0 encapsulation frame-relay ip ospf network broadcast frame-relay map ip 10.10.10.5 101 broadcast frame-relay map ip 10.10.10.6 100 broadcast ! router ospf 10 network 10.10.10.0 0.0.0.255 area 0 network 10.70.70.0 0.0.0.255 area 0 |
R3-4K |
interface Loopback0 ip address 10.60.60.60 255.255.255.255 ! interface Serial0 no ip address encapsulation frame-relay ! interface Serial0.1 multipoint ip address 10.10.10.6 255.255.255.0 ip ospf network broadcast frame-relay map ip 10.10.10.5 102 broadcast frame-relay map ip 10.10.10.7 100 broadcast ! router ospf 10 network 10.10.10.0 0.0.0.255 area 0 network 10.60.60.0 0.0.0.255 area 0 |
只要幀中繼網雲是全網狀的,幀中繼上的廣播模型就可以正常工作。如果任何永久虛擬電路(PVC)損壞,它可能會在OSPF資料庫中出現問題,從而產生Adv路由器無法訪問消息。
在本示例中,R9-2500和R4-4K之間的PVC斷開,通往指定路由器(DR)的R9-2500鏈路斷開。因此,R9-2500宣告來自R3-4K(不是DR)的所有LSA不可達。您可以看到,R9-2500不會為連線到R3-4K的串列介面生成傳輸鏈路;而是生成末節鏈路,因為對於R9-2500而言,此鏈路上沒有DR。
R9-2500(3)#show ip ospf database router OSPF Router with ID (10.50.50.50) (Process ID 10) Router Link States (Area 0) LS age: 148 Options: (No TOS-capability, DC) LS Type: Router Links Link State ID: 10.50.50.50 Advertising Router: 10.50.50.50 LS Seq Number: 8000000B Checksum: 0x55A Length: 48 Number of Links: 2 Link connected to: a Stub Network (Link ID) Network/subnet number: 10.10.10.0 (Link Data) Network Mask: 255.255.255.0 Number of TOS metrics: 0 TOS 0 Metrics: 64 Link connected to: a Stub Network (Link ID) Network/subnet number: 10.50.50.50 (Link Data) Network Mask: 255.255.255.255 Number of TOS metrics: 0 TOS 0 Metrics: 1 Adv Router is not-reachable LS age: 1081 Options: (No TOS-capability, DC) LS Type: Router Links Link State ID: 10.60.60.60 Advertising Router: 10.60.60.60 LS Seq Number: 80000006 Checksum: 0x4F72 Length: 48 Number of Links: 2 Link connected to: a Stub Network (Link ID) Network/subnet number: 10.60.60.60 (Link Data) Network Mask: 255.255.255.255 Number of TOS metrics: 0 TOS 0 Metrics: 1 Link connected to: a Transit Network (Link ID) Designated Router address: 10.10.10.7 (Link Data) Router Interface address: 10.10.10.6 Number of TOS metrics: 0 TOS 0 Metrics: 64 Adv Router is not-reachable LS age: 306 Options: (No TOS-capability, DC) LS Type: Router Links Link State ID: 10.70.70.70 Advertising Router: 10.70.70.70 LS Seq Number: 80000007 Checksum: 0xC185 Length: 48 Number of Links: 2 Link connected to: a Stub Network (Link ID) Network/subnet number: 10.70.70.70 (Link Data) Network Mask: 255.255.255.255 Number of TOS metrics: 0 TOS 0 Metrics: 1 Link connected to: a Transit Network (Link ID) Designated Router address: 10.10.10.7 (Link Data) Router Interface address: 10.10.10.7 Number of TOS metrics: 0 TOS 0 Metrics: 64
有關此問題的詳細資訊,請參閱幀中繼上的NBMA和廣播模式中的OSPF問題。
請考慮以下網路圖作為範例:
R2507 |
interface GigabitEthernet0/0 ip address 10.1.1.1 255.255.255.0 ! interface GigabitEthernet0/1 ip address 10.7.7.1 255.255.255.0 ! router ospf 1 network 10.1.1.1 0.0.0.0 area 0 default-information originate metric 20 ! ip route 0.0.0.0 0.0.0.0 10.7.7.2 |
R2504 |
interface GigabitEthernet0/0 ip address 10.1.1.2 255.255.255.0 ! interface GigabitEthernet0/1 ip address 10.3.4.2 255.255.255.0 ! router ospf 1 network 10.1.1.0 0.0.0.255 area 0 network 10.0.0.0 0.255.255.255 area 1 area 1 range 10.0.0.0 255.0.0.0 |
R2515 |
interface GigabitEthernet0/0 ip address 10.3.4.3 255.255.255.0 ! interface GigabitEthernet0/2 ip address 10.44.66.3 255.255.255.0 ! interface GigabitEthernet0/3 ip address 10.22.88.3 255.255.255.0 ! router ospf 1 redistribute eigrp 1 metric 20 subnets network 0.0.0.0 255.255.255.255 area 1 ! router eigrp 1 network 10.3.4.0 0.0.0.255 |
R2513 |
interface GigabitEthernet0/0 ip address 10.3.4.4 255.255.255.0 ! interface GigabitEthernet0/1 ip address 10.200.1.4 255.255.255.0 ! router eigrp 1 network 10.3.4.0 0.0.0.255 network 10.200.1.0 0.0.0.255 |
R2507#show ip ospf database external 10.200.1.0 OSPF Router with ID (10.7.7.1) (Process ID 1) Type-5 AS External Link States LS age: 954 Options: (No TOS-capability, DC, Upward) LS Type: AS External Link Link State ID: 10.200.1.0 (External Network Number ) Advertising Router: 10.44.66.3 LS Seq Number: 80000007 Checksum: 0x46EF Length: 36 Network Mask: /24 Metric Type: 2 (Larger than any link state path) MTID: 0 Metric: 20 Forward Address: 10.3.4.4 External Route Tag: 0
R2507的資料庫中包含10.200.1.0/24,但它尚未將其安裝在路由表中,因為通過OSPF外部路由獲知10.3.4.4。
R2507#show ip route 10.3.4.4 Routing entry for 10.3.4.0/24 Known via "ospf 1", distance 110, metric 20,type extern 2, forward metric 70 Redistributing via ospf 1 Last update from 10.1.1.2 on GigabitEthernet0/0, 00:00:40 ago Routing Descriptor Blocks: * 10.1.1.2, from 10.44.66.3, 00:00:40 ago, via GigabitEthernet0/0 Route metric is 20, traffic share count is 1
注意:在此案例中,通過外部路由獲知轉發地址的原因在於下一個警告。在修復「Cisco bug ID CSCdp72526」(僅限註冊客戶)後,OSPF不會生成重疊外部網路的5類鏈路狀態通告(LSA);因此,R2507僅顯示10.0.0.0/8的區域間總結路由。然後,R2507會安裝帶有轉發地址的10.200.1.0/24,並且可以通過區域間路由10.0.0.0/8到達,因此符合RFC 2328。
修正提及的錯誤後,輸出如下所示:
R2507#show ip route 10.3.4.4 Routing entry for 10.0.0.0/8 Known via "ospf 1", distance 110, metric 2, type inter area Last update from 10.1.1.2 on GigabitEthernet0/0, 00:01:02 ago Routing Descriptor Blocks: * 10.1.1.2, from 10.3.4.2, 00:01:02 ago, via GigabitEthernet0/0 Route metric is 2, traffic share count is 1
R2507#show ip route Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP a - application route + - replicated route, % - next hop override, p - overrides from PfR Gateway of last resort is 10.7.7.2 to network 0.0.0.0 S* 0.0.0.0/0 [1/0] via 10.7.7.2 10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks O IA 10.0.0.0/8 [110/2] via 10.1.1.2, 00:01:41, GigabitEthernet0/0 C 10.1.1.0/24 is directly connected, GigabitEthernet0/0 L 10.1.1.1/32 is directly connected, GigabitEthernet0/0 C 10.7.7.0/24 is directly connected, GigabitEthernet0/1 L 10.7.7.1/32 is directly connected, GigabitEthernet0/1 O E2 10.200.1.0/24 [110/20] via 10.1.1.2, 03:30:47, GigabitEthernet0/0
如果轉發地址也通過外部路由得知,OSPF不會將該路由安裝到路由表中。有關此問題的更多詳細資訊,請參閱OSPF轉發地址的常見路由問題。
下一個網路圖用作示例:
R4-4K | R1-7010 |
---|---|
interface Loopback0 ip address 172.16.33.1 255.255.255.255 ! interface Serial2 ip address 172.16.32.1 255.255.255.0 ! router ospf 20 network 172.16.0.0 0.0.255.255 area 0 |
interface Loopback0 ip address 172.16.30.1 255.255.255.255 ! interface Serial1/0 ip address 172.16.32.2 255.255.255.0 clockrate 64000 ! router ospf 20 network 172.16.0.0 0.0.255.255 area 0 distribute-list 1 in ! access-list 1 permit 172.16.32.0. 0.0.0.255 |
如前所述,R1-7010配置了distribute-list命令,它僅允許在路由表中安裝172.16.32.0/24地址範圍。在鏈路狀態協定中,您實際上無法使用distribute-list命令篩選LSA。LSA仍存在於資料庫中;但是LSA未安裝在路由表中。
R1-7010(5)#show ip ospf database router 172.16.33.1 LS age: 357 Options: (No TOS-capability, DC) LS Type: Router Links Link State ID: 172.16.33.1 Advertising Router: 172.16.33.1 LS Seq Number: 8000000A Checksum: 0xD4AA Length: 48 Number of Links: 3 Link connected to: another Router (point-to-point) (Link ID) Neighboring Router ID: 172.16.32.2 (Link Data) Router Interface address: 172.16.32.1 Number of TOS metrics: 0 TOS 0 Metrics: 64
R1-7010上的distribute-list配置命令過濾172.16.33.1/32網路並阻止將子網安裝到路由表中。
R1-7010(5)#show ip route 172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks C 172.16.32.0/24 is directly connected, Serial1/0 C 172.16.30.1/32 is directly connected, Loopback0
要解決此問題,請在訪問控制清單(ACL)中配置R1-7010並允許172.16.33.0/24,以便將此網路安裝到路由表中。
R1-7010(5)#configure terminal R1-7010(5)(config)#access-list 1 permit 172.16.33.0 0.0.0.255 R1-7010(5)(config)#end R1-7010(5)#show ip access-list 1 Standard IP access list 1 permit 172.16.32.0, wildcard bits 0.0.0.255 permit 172.16.33.0, wildcard bits 0.0.0.255 R1-7010(5)#show ip route 172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks C 172.16.32.0/24 is directly connected, Serial1/0 O 172.16.33.1/32 [110/65] via 172.16.32.1, 00:00:08, Serial1/0 C 172.16.30.1/32 is directly connected, Loopback0
修訂 | 發佈日期 | 意見 |
---|---|---|
3.0 |
28-Aug-2023 |
重新認證 |
2.0 |
25-Jul-2022 |
初始版本 |
1.0 |
05-Nov-2001 |
初始版本 |