此产品的文档集力求使用非歧视性语言。在本文档集中,非歧视性语言是指不隐含针对年龄、残障、性别、种族身份、族群身份、性取向、社会经济地位和交叉性的歧视的语言。由于产品软件的用户界面中使用的硬编码语言、基于 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、R和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#
目前没有针对此配置的故障排除信息。