本產品的文件集力求使用無偏見用語。針對本文件集的目的,無偏見係定義為未根據年齡、身心障礙、性別、種族身分、民族身分、性別傾向、社會經濟地位及交織性表示歧視的用語。由於本產品軟體使用者介面中硬式編碼的語言、根據 RFP 文件使用的語言,或引用第三方產品的語言,因此本文件中可能會出現例外狀況。深入瞭解思科如何使用包容性用語。
思科已使用電腦和人工技術翻譯本文件,讓全世界的使用者能夠以自己的語言理解支援內容。請注意,即使是最佳機器翻譯,也不如專業譯者翻譯的內容準確。Cisco Systems, Inc. 對這些翻譯的準確度概不負責,並建議一律查看原始英文文件(提供連結)。
本檔案將介紹IOS®和IOS® -XE的開放最短路徑優先(OSPF)首碼抑制功能。
OSPF字首抑制是一個有用的功能,用於減少區域內泛洪的鏈路狀態通告(LSA)數量。在主機之間存在多個傳輸鏈路的OSPF區域中,實際通訊是在主機之間。無需向所有路由器通告傳輸鏈路LSA。您只能通告與終端主機相關的LSA。預設情況下,OSPF通告包括傳輸鏈路LSA的所有LSA。
OSPF字首抑制功能有助於克服此行為,並減少通告的第1類(路由器)和第2類(網路)LSA的數量。
此功能可以在路由器上全域性啟用,也可以在每個介面上全域性啟用。
由於資料庫(DB)中的字首數量較少,OSPF字首抑制有助於更快的最短路徑優先(SPF)計算。OSPF第3類、第4類、第5類或第7類LSA不會被抑制。
本文件沒有特定需求。
本文件所述內容不限於特定軟體和硬體版本。
本文中的資訊是根據特定實驗室環境內的裝置所建立。文中使用到的所有裝置皆從已清除(預設)的組態來啟動。如果您的網路運作中,請確保您瞭解任何指令可能造成的影響。
在此圖中,有2台PC、PC1和PC2通過具有4台路由器R1、R2、R3和R4的網路連線。由於此處的目標是確保端到端可達性,因此您可以在R1、R2、R4和R4的主幹鏈路上啟用OSPF字首抑制,這有助於減少許多LSA。
OSPF字首抑制可以在全域性模式或介面模式下配置:
Global mode configuration:
!
router ospf 1
prefix-suppression
!
Interface mode configuration:
R1:
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int e0/2
R1(config-if)#ip ospf prefix-suppression
R1(config-if)#int e0/3
R1(config-if)#ip ospf prefix-suppression
R1(config-if)#end
R1#
R2:
R2#
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#int e0/0
R2(config-if)#ip ospf prefix-suppression
R2(config-if)#int e0/1
R2(config-if)#ip ospf prefix-suppression
R2(config-if)#end
R2#
R2#
R3:
R3#
R3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R3(config-if)#int e0/1
R3(config-if)# ip ospf prefix-suppression
R3(config-if)#int e0/0
R3(config-if)# ip ospf prefix-suppression
R3(config-if)#end
R3#
R3#
R4:
R4#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R4(config)#int e0/2
R4(config-if)#ip ospf prefix-suppression
R4(config-if)#int e0/3
R4(config-if)#ip ospf prefix-suppression
R4(config-if)#end
R4#
R4#
附註:如果通過OSPF通告管理介面或環回介面,您可能需要將管理介面或環回介面從OSPF字首抑制中排除。
使用本節內容,確認您的組態是否正常運作。
配置字首抑制之前:
R1:
R1#sh 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
+ - replicated route, % - next hop override
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 9 subnets, 2 masks
C 10.1.1.0/24 is directly connected, Ethernet0/1
L 10.1.1.254/32 is directly connected, Ethernet0/1
C 10.1.12.0/24 is directly connected, Ethernet0/2
L 10.1.12.1/32 is directly connected, Ethernet0/2
C 10.1.13.0/24 is directly connected, Ethernet0/3
L 10.1.13.1/32 is directly connected, Ethernet0/3
O 10.1.24.0/24 [110/20] via 10.1.12.2, 00:02:29, Ethernet0/2
O 10.1.34.0/24 [110/20] via 10.1.13.3, 00:02:12, Ethernet0/3
O 10.2.2.0/24 [110/30] via 10.1.13.3, 00:04:22, Ethernet0/3
[110/30] via 10.1.12.2, 00:04:22, Ethernet0/2
R1#
R1#show ip ospf database network | i Mask|Attached Router|State ID
Link State ID: 10.1.12.2 (address of Designated Router)
Network Mask: /24
Attached Router: 10.1.24.2
Attached Router: 10.1.13.1
Link State ID: 10.1.13.3 (address of Designated Router)
Network Mask: /24
Attached Router: 10.1.34.3
Attached Router: 10.1.13.1
Link State ID: 10.1.24.4 (address of Designated Router)
Network Mask: /24
Attached Router: 10.2.2.254
Attached Router: 10.1.24.2
Link State ID: 10.1.34.4 (address of Designated Router)
Network Mask: /24
Attached Router: 10.2.2.254
Attached Router: 10.1.34.3
R1#
R4:
R4#sh 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
+ - replicated route, % - next hop override
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 9 subnets, 2 masks
O 10.1.1.0/24 [110/30] via 10.1.34.3, 00:04:59, Ethernet0/3
[110/30] via 10.1.24.2, 00:04:59, Ethernet0/2
O 10.1.12.0/24 [110/20] via 10.1.24.2, 00:04:59, Ethernet0/2
O 10.1.13.0/24 [110/20] via 10.1.34.3, 00:04:59, Ethernet0/3
C 10.1.24.0/24 is directly connected, Ethernet0/2
L 10.1.24.4/32 is directly connected, Ethernet0/2
C 10.1.34.0/24 is directly connected, Ethernet0/3
L 10.1.34.4/32 is directly connected, Ethernet0/3
C 10.2.2.0/24 is directly connected, Ethernet0/1
L 10.2.2.254/32 is directly connected, Ethernet0/1
R4#
R4#show ip ospf database network | i Mask|Attached Router|State ID
Link State ID: 10.1.12.2 (address of Designated Router)
Network Mask: /24
Attached Router: 10.1.24.2
Attached Router: 10.1.13.1
Link State ID: 10.1.13.3 (address of Designated Router)
Network Mask: /24
Attached Router: 10.1.34.3
Attached Router: 10.1.13.1
Link State ID: 10.1.24.4 (address of Designated Router)
Network Mask: /24
Attached Router: 10.2.2.254
Attached Router: 10.1.24.2
Link State ID: 10.1.34.4 (address of Designated Router)
Network Mask: /24
Attached Router: 10.2.2.254
Attached Router: 10.1.34.3
R4#
設定首碼抑制後:
Please note that now we see only one OSPF route on Router1 and Router4.
R1:
[110/30] via 10.1.12.2, 00:04:22, Ethernet0/2
R1#sh 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
+ - replicated route, % - next hop override
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 7 subnets, 2 masks
C 10.1.1.0/24 is directly connected, Ethernet0/1
L 10.1.1.254/32 is directly connected, Ethernet0/1
C 10.1.12.0/24 is directly connected, Ethernet0/2
L 10.1.12.1/32 is directly connected, Ethernet0/2
C 10.1.13.0/24 is directly connected, Ethernet0/3
L 10.1.13.1/32 is directly connected, Ethernet0/3
O 10.2.2.0/24 [110/30] via 10.1.13.3, 00:07:38, Ethernet0/3
[110/30] via 10.1.12.2, 00:07:38, Ethernet0/2
R1#
R1#show ip ospf database network | i Mask|Attached Router|State ID
Link State ID: 10.1.12.1 (address of Designated Router)
Network Mask: /32
Attached Router: 10.1.13.1
Attached Router: 10.1.24.2
Link State ID: 10.1.13.1 (address of Designated Router)
Network Mask: /32
Attached Router: 10.1.13.1
Attached Router: 10.1.34.3
Link State ID: 10.1.24.2 (address of Designated Router)
Network Mask: /32
Attached Router: 10.1.24.2
Attached Router: 10.2.2.254
Link State ID: 10.1.34.4 (address of Designated Router)
Network Mask: /32
Attached Router: 10.2.2.254
Attached Router: 10.1.34.3
R1#
R4:
R4#sh 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
+ - replicated route, % - next hop override
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 7 subnets, 2 masks
O 10.1.1.0/24 [110/30] via 10.1.34.3, 01:15:37, Ethernet0/3
[110/30] via 10.1.24.2, 01:15:47, Ethernet0/2
C 10.1.24.0/24 is directly connected, Ethernet0/2
L 10.1.24.4/32 is directly connected, Ethernet0/2
C 10.1.34.0/24 is directly connected, Ethernet0/3
L 10.1.34.4/32 is directly connected, Ethernet0/3
C 10.2.2.0/24 is directly connected, Ethernet0/1
L 10.2.2.254/32 is directly connected, Ethernet0/1
R4#
R4#show ip ospf database network | i Mask|Attached Router|State ID
Link State ID: 10.1.12.1 (address of Designated Router)
Network Mask: /32
Attached Router: 10.1.13.1
Attached Router: 10.1.24.2
Link State ID: 10.1.13.1 (address of Designated Router)
Network Mask: /32
Attached Router: 10.1.13.1
Attached Router: 10.1.34.3
Link State ID: 10.1.24.2 (address of Designated Router)
Network Mask: /32
Attached Router: 10.1.24.2
Attached Router: 10.2.2.254
Link State ID: 10.1.34.4 (address of Designated Router)
Network Mask: /32
Attached Router: 10.2.2.254
Attached Router: 10.1.34.3
R4#
目前尚無適用於此組態的具體疑難排解資訊。