此产品的文档集力求使用非歧视性语言。在本文档集中,非歧视性语言是指不隐含针对年龄、残障、性别、种族身份、族群身份、性取向、社会经济地位和交叉性的歧视的语言。由于产品软件的用户界面中使用的硬编码语言、基于 RFP 文档使用的语言或引用的第三方产品使用的语言,文档中可能无法确保完全使用非歧视性语言。 深入了解思科如何使用包容性语言。
思科采用人工翻译与机器翻译相结合的方式将此文档翻译成不同语言,希望全球的用户都能通过各自的语言得到支持性的内容。 请注意:即使是最好的机器翻译,其准确度也不及专业翻译人员的水平。 Cisco Systems, Inc. 对于翻译的准确性不承担任何责任,并建议您总是参考英文原始文档(已提供链接)。
本文档介绍如何在数据库中的路由不在路由信息库 (RIB) 或路由表中时修复 OSPF 问题。
本文档的读者必须了解以下主题:
开放最短路径优先(OSPF)协议基础知识
Cisco IOS®中的OSPF配置基础知识。
本文档中的信息基于以下软件和硬件版本:
Cisco IOS软件版本12及更高版本
所有Cisco路由器平台都支持此功能
本文档中的信息都是基于特定实验室环境中的设备编写的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您的网络处于活动状态,请确保您了解所有命令的潜在影响。
有关文档规则的详细信息,请参阅 Cisco 技术提示规则。
本文描述开放最短路径优先(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分析器显示潜在问题和解决方法。
以下网络图用作示例:
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 router not reachable消息。
在本示例中,R9-2500和R4-4K之间的PVC断开,R9-2500到指定路由器(DR)的链路也断开。因此,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安装到R2507上,它可以通过区域间路由10.0.0.0/8到达,因此符合RFC 2328。
修复了上述Bug后,输出如下所示:
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 |
初始版本 |