本文档探讨 Open Shortest Path First (OSPF) 跨两个区域运行时的 OSPF 数据库和路由表。
本文档没有任何特定的要求。
本文档不限于特定的软件和硬件版本。
有关文档规则的详细信息,请参阅 Cisco 技术提示规则。
本部分提供有关如何配置本文档所述功能的信息。
注:要查找有关本文档中所用命令的其他信息,请使用命令查找工具(仅限注册用户)(仅限注册客户)。
本文档使用下图所示的网络设置。
本文档使用以下配置。
路由器 1.1.1.1 |
---|
Current configuration: hostname r1.1.1.1 interface Loopback0 ip address 1.1.1.1 255.0.0.0 interface Ethernet2/0/0 ip address 4.0.0.1 255.0.0.0 interface Serial2/1/0 ip unnumbered Ethernet2/0/0 router ospf 1 network 4.0.0.0 0.255.255.255 area 0 end |
路由器 2.2.2.2 |
---|
Current configuration: hostname r2.2.2.2 interface Loopback0 ip address 2.2.2.2 255.0.0.0 interface Ethernet0/0/4 ip address 6.0.0.2 255.0.0.0 interface Serial0/1/0 ip unnumbered Ethernet0/0/4 interface ATM1/0.20 point-to-point ip address 200.0.0.2 255.255.255.0 router ospf 2 network 6.0.0.0 0.255.255.255 area 0 network 200.0.0.0 0.255.255.255 area 1 end |
路由器 3.3.3.3 |
---|
Current configuration: hostname r3.3.3.3 interface Loopback0 ip address 3.3.3.3 255.0.0.0 interface ATM2/0.20 point-to-point ip address 200.0.0.3 255.255.255.0 router ospf 2 network 200.0.0.0 0.255.255.255 area 1 end |
本部分所提供的信息可用于确认您的配置是否正常工作。
命令输出解释程序工具(仅限注册用户)支持某些 show 命令,使用此工具可以查看对 show 命令输出的分析。
show ip ospf database — 显示在链路状态数据库中的Link State Advertisement (LSA)列表。此列表仅显示 LSA 报头中的信息。
show ip ospf database [router] [link-state-id] -显示数据库中路由器LSA (类型1 LSA)的内容。每个路由器都会产生路由器 LSA,这些基本 LSA 会列出路由器的所有链路或接口以及链路的状态和传出开销。他们应只在产生的区内被泛洪。
show ip ospf database summary <link state id> -显示区域边界路由器(ABR)汇总链路。
由于路由器 2.2.2.2 是 ABR,因此它具有用于所连接的两个区域的数据库。这使得该路由器成为使用 show ip ospf database 命令查看 OSPF 数据库的最佳位置。
r2.2.2.2#show ip ospf database OSPF Router with ID (2.2.2.2) (Process ID 2) Router Link States (Area 0) Link ID ADV Router Age Seq# Checksum Link count 1.1.1.1 1.1.1.1 697 0x80000040 0x5A21 2 2.2.2.2 2.2.2.2 696 0x80000045 0xEE82 2 Summary Net Link States (Area 0) Link ID ADV Router Age Seq# Checksum 200.0.0.0 2.2.2.2 352 0x80000001 0x2546 Router Link States (Area 1) Link ID ADV Router Age Seq# Checksum Link count 2.2.2.2 2.2.2.2 351 0x8000000B 0xCA9D 2 3.3.3.3 3.3.3.3 354 0x80000006 0x71F7 2 Summary Net Link States (Area 1) Link ID ADV Router Age Seq# Checksum 4.0.0.0 2.2.2.2 689 0x80000001 0xFFE6 6.0.0.0 2.2.2.2 700 0x80000001 0x63C1 r2.2.2.2#show ip ospf database router 1.1.1.1 OSPF Router with ID (2.2.2.2) (Process ID 2) Router Link States (Area 0) LS age: 773 Options: (No TOS-capability, DC) LS Type: Router Links Link State ID: 1.1.1.1 !--- For router links, Link State Id is always the same as the !--- Advertising Router (next line). Advertising Router: 1.1.1.1 !--- This is the router ID of the router that created this LSA. LS Seq Number: 80000040 Checksum: 0x5A21 Length: 48 Number of Links: 2 Link connected to: another Router (point-to-point) !--- This line shows that Router 1.1.1.1 is a neighbor !--- with Router 2.2.2.2. (Link ID) Neighboring Router ID: 2.2.2.2 (Link Data) Router Interface address: 0.0.0.12 !--- The link is unnumbered, so the address starts with !--- zero. In the case of unnumbered links, the interface address !--- displays the MIB II IfIndex value that usually starts with 0. Number of TOS metrics: 0 TOS 0 Metrics: 64 !--- This is the OSPF cost of the link that connects !--- the two routers. Link connected to: a Stub Network !--- This line represents the Ethernet segment 4.0.0.0/8. (Link ID) Network/subnet number: 4.0.0.0 (Link Data) Network Mask: 255.0.0.0 Number of TOS metrics: 0 TOS 0 Metrics: 10 r2.2.2.2#show ip ospf database router 2.2.2.2 OSPF Router with ID (2.2.2.2) (Process ID 2) Router Link States (Area 0) !--- This is the router LSA for 2.2.2.2 in area 0. LS age: 789 Options: (No TOS-capability, DC) LS Type: Router Links Link State ID: 2.2.2.2 Advertising Router: 2.2.2.2 LS Seq Number: 80000045 Checksum: 0xEE82 Length: 48 Area Border Router !--- Bit B is set in the router LSA. !--- It indicates that this router is an ABR. Number of Links: 2 !--- There are two links in area 0. Link connected to: another Router (point-to-point) (Link ID) Neighboring Router ID: 1.1.1.1 (Link Data) Router Interface address: 0.0.0.10 Number of TOS metrics: 0 TOS 0 Metrics: 64 Link connected to: a Stub Network (Link ID) Network/subnet number: 6.0.0.0 (Link Data) Network Mask: 255.0.0.0 Number of TOS metrics: 0 TOS 0 Metrics: 10 Router Link States (Area 1) !--- This is the router LSA for !--- Router 2.2.2.2 in area 1. LS age: 445 Options: (No TOS-capability, DC) LS Type: Router Links Link State ID: 2.2.2.2 Advertising Router: 2.2.2.2 LS Seq Number: 8000000B Checksum: 0xCA9D Length: 48 Area Border Router Number of Links: 2 Link connected to: another Router (point-to-point) (Link ID) Neighboring Router ID: 3.3.3.3 (Link Data) Router Interface address: 200.0.0.2 Number of TOS metrics: 0 TOS 0 Metrics: 1 Link connected to: a Stub Network (Link ID) Network/subnet number: 200.0.0.0 (Link Data) Network Mask: 255.255.255.0 Number of TOS metrics: 0 TOS 0 Metrics: 1 r2.2.2.2#show ip ospf database router 3.3.3.3 OSPF Router with ID (2.2.2.2) (Process ID 2) Router Link States (Area 1) LS age: 465 Options: (No TOS-capability, DC) LS Type: Router Links Link State ID: 3.3.3.3 Advertising Router: 3.3.3.3 LS Seq Number: 80000006 Checksum: 0x71F7 Length: 48 Number of Links: 2 Link connected to: another Router (point-to-point) (Link ID) Neighboring Router ID: 2.2.2.2 (Link Data) Router Interface address: 200.0.0.3 Number of TOS metrics: 0 TOS 0 Metrics: 1 Link connected to: a Stub Network (Link ID) Network/subnet number: 200.0.0.0 (Link Data) Network Mask: 255.255.255.0 Number of TOS metrics: 0 TOS 0 Metrics: 1
为了将一个区域中的路由通告给另一个区域,ABR 将创建汇总链路,您可以使用 show ip ospf database summary <link-state id> 命令来查看此类链路。
r2.2.2.2#show ip ospf database summary 200.0.0.0 OSPF Router with ID (2.2.2.2) (Process ID 2) Summary Net Link States (Area 0) LS age: 487 Options: (No TOS-capability, DC, Upward) !--- The Upward keyword indicates that this is not an LSA imported !--- from a VPN backbone (from a PE to a CE). LS Type: Summary Links(Network) Link State ID: 200.0.0.0 (summary Network Number) !--- 200.0.0.0/24 is advertised into area 0 by the !--- ABR (Router 2.2.2.2). Advertising Router: 2.2.2.2 LS Seq Number: 80000001 Checksum: 0x2546 Length: 28 Network Mask: /24 TOS: 0 Metric: 1 r2.2.2.2#show ip ospf database summary 4.0.0.0 OSPF Router with ID (2.2.2.2) (Process ID 2) Summary Net Link States (Area 1) LS age: 840 Options: (No TOS-capability, DC, Upward) LS Type: Summary Links(Network) Link State ID: 4.0.0.0 (summary Network Number) !--- 4.0.0.0/8 is advertised into area 1 by !--- the ABR (Router 2.2.2.2). Advertising Router: 2.2.2.2 LS Seq Number: 80000001 Checksum: 0xFFE6 Length: 28 Network Mask: /8 TOS: 0 Metric: 74 r2.2.2.2#show ip ospf database summary 6.0.0.0 OSPF Router with ID (2.2.2.2) (Process ID 2) Summary Net Link States (Area 1) LS age: 861 Options: (No TOS-capability, DC, Upward) LS Type: Summary Links(Network) Link State ID: 6.0.0.0 (summary Network Number) !--- 6.0.0.0/8 is advertised into area 1 by the !--- ABR (Router 2.2.2.2). Advertising Router: 2.2.2.2 LS Seq Number: 80000001 Checksum: 0x63C1 Length: 28 Network Mask: /8 TOS: 0 Metric: 10
本部分将从路由器 3.3.3.3 的角度来计算最短路径。
路由器 3.3.3.3 会在其自己的 LSA 中进行查找,并发现路由器 2.2.2.2 是邻居。然后,路由器 3.3.3.3 会查看路由器 2.2.2.2 的 LSA 以验证路由器 2.2.2.2 是否将路由器 3.3.3.3 视为邻居。如果这两个路由器彼此视为邻居,则我们认为它们是可访问的。
每个路由器还会检查自己的本地邻居表(可使用 show ip ospf neighbor 命令查看),以验证自身接口与邻居的接口是否位于公用 IP 子网上。
注意:未对未编号接口执行此检查。
如果这些接口位于一个公用子网上,则路由器将安装各自邻居的 LSA 中列出的所有末节网络的路由。在本示例中,200.0.0.0/24 是路由器 2.2.2.2 的 LSA 中列出的唯一末节网络,路由器 3.3.3.3 已经与其直接相连。
检查区域 1 中所有可访问路由器的 LSA 之后,路由器 3.3.3.3 会查看数据库中的汇总 LSA。它查找4.0.0.0/8和6.0.0.0/8的汇总LSA。如果路由器3.3.3.3知道如何到达创建汇总LSA的通告路由器,则会将路由安装到其路由表中。在本示例中,通告路由器是Router 2.2.2.2。由于路由器3.3.3.3知道如何到达路由器2.2.2.2,因此它在路由表中安装4.0.0.0/8和6.0.0.0/8的路由。这些路由器的度量是访问通告路由器的度量与汇总 LSA 的度量之和。汇总 LSA 的度量是从访问生成了汇总 LSA 的区域内部路由或区域间路由的成本计算得出的。
注意:路由器使用第1类LSA在一个区域内通告它们直接连接的网络和其它路由器,该区域会在同一区域内泛洪。这样,同一区域内的所有路由器都具有其自身区域的完整拓扑信息。因此,ABR 将保留它们直接连接的所有区域的完整拓扑信息。不过,当 ABR 将属于某个区域的网络通告给另一个区域时,它们只使用类型 3 LSA 来通告该网络的前缀和掩码。第二个区域内的路由器不了解其他区域的拓扑信息,但了解其他区域中网络的可访问性信息。
下面的输出显示了上述每个路由器的路由表中的 OSPF 路由。
r1.1.1.1# show ip route ospf O IA 200.0.0.0/24 [110/65] via 6.0.0.2, 00:09:00, Serial2/1/0 O 6.0.0.0/8 [110/74] via 6.0.0.2, 00:14:41, Serial2/1/0 r2.2.2.2#show ip route ospf O 4.0.0.0/8 [110/74] via 4.0.0.1, 00:09:16, Serial0/1/0 r3.3.3.3#show ip route ospf O IA 4.0.0.0/8 [110/75] via 200.0.0.2, 00:09:27, ATM2/0.20 O IA 6.0.0.0/8 [110/11] via 200.0.0.2, 00:09:27, ATM2/0.20
有关路由表中缺少数据库信息时对 OSPF 进行故障排除的信息,请参阅为何某些 OSPF 路由器位于数据库中而不是位于路由表中?有关常规 OSPF 故障排除信息,请参阅 OSPF 故障排除。
版本 | 发布日期 | 备注 |
---|---|---|
1.0 |
28-Mar-2005 |
初始版本 |