本文档说明 Open Shortest Path First (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 Serial2/1/0 ip address 5.0.0.1 255.0.0.0 interface Ethernet2/0/0 ip address 4.0.0.1 255.0.0.0 router ospf 4 redistribute static metric 5 metric-type 1 network 5.0.0.0 0.255.255.255 area 1 network 4.0.0.0 0.255.255.255 area 1 ip route 9.0.0.0 255.0.0.0 4.0.0.2 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 Serial0/1/0 ip address 5.0.0.2 255.0.0.0 interface ATM1/0.20 ip address 6.0.0.2 255.0.0.0 router ospf 2 network 5.0.0.0 0.255.255.255 area 1 network 6.0.0.0 0.255.255.255 area 0 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 6.0.0.3 255.0.0.0 router ospf 2 network 6.0.0.0 0.255.255.255 area 0 end |
本部分所提供的信息可用于确认您的配置是否正常工作。
命令输出解释程序工具(仅限注册用户)支持某些 show 命令,使用此工具可以查看对 show 命令输出的分析。
show ip ospf database -显示Link State Advertisement (LSA)列表并且键入他们到连结状态数据库。此列表仅显示 LSA 报头中的信息。
show ip ospf database [router] [link-state-id] -显示在数据库中的一台路由器所有的LSA列表。LSA是由每个路由器生产的。这些基本LSA列出所有路由器链路或者接口,以及链路的状态和流出开销。他们应只在产生的区内被泛洪。
show ip ospf database summary <link state id> -显示区域边界路由器(ABR)汇总链路。
show ip ospf database external - 仅显示有关外部 LSA 的信息。
show ip ospf database asbr-summary - 仅显示有关自治系统边界路由器汇总 LSA 的信息。
下面的输出使用 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 2.2.2.2 2.2.2.2 93 0x80000020 0xCD0B 2 3.3.3.3 3.3.3.3 1225 0x8000000D 0x9057 2 Summary Net Link States (Area 0) Link ID ADV Router Age Seq# Checksum 4.0.0.0 2.2.2.2 73 0x80000001 0xFFE6 5.0.0.0 2.2.2.2 1651 0x80000006 0x8466 Summary ASB Link States (Area 0) Link ID ADV Router Age Seq# Checksum 1.1.1.1 2.2.2.2 74 0x80000001 0x935C Router Link States (Area 1) Link ID ADV Router Age Seq# Checksum Link count 1.1.1.1 1.1.1.1 89 0x80000011 0xFF59 3 2.2.2.2 2.2.2.2 88 0x80000033 0x2130 2 Summary Net Link States (Area 1) Link ID ADV Router Age Seq# Checksum 6.0.0.0 2.2.2.2 94 0x8000001F 0xCC43 Type-5 AS External Link States Link ID ADV Router Age Seq# Checksum Tag 9.0.0.0 1.1.1.1 135 0x80000001 0x3AE8 0
为了将外部路由通告给 OSPF,自治系统边界路由器 (ASBR) 将创建(类型 5)外部 LSA。
r2.2.2.2#show ip ospf database external 9.0.0.0 OSPF Router with ID (2.2.2.2) (Process ID 2) Type-5 AS External Link States Routing Bit Set on this LSA LS age: 286 Options: (No TOS-capability, DC) LS Type: AS External Link Link State ID: 9.0.0.0 (External Network Number ) !--- 9.0.0.0/8 is advertised by the !--- ASBR (Router 1.1.1.1). Advertising Router: 1.1.1.1 LS Seq Number: 80000001 Checksum: 0x3AE8 Length: 36 Network Mask: /8 Metric Type: 1 (Comparable directly to link state metric) TOS: 0 Metric: 5 Forward Address: 0.0.0.0 !--- Forwarding address is not specified since there !--- are no OSPF neighbors on Router 1.1.1.1's Ethernet. !--- When the forward address is 0.0.0.0, this means that !--- the traffic for this network is to be sent to the !--- advertising router (1.1.1.1). External Route Tag: 0
为了将 ASBR 的可访问性通告给其他区域,ABR 将创建(类型 4)ASBR 汇总 LSA。
r2.2.2.2#show ip ospf database asbr-summary 1.1.1.1 OSPF Router with ID (2.2.2.2) (Process ID 2) Summary ASB Link States (Area 0) LS age: 266 Options: (No TOS-capability, DC) LS Type: Summary Links(AS Boundary Router) Link State ID: 1.1.1.1 (AS Boundary Router address) !--- ABR (Router 2.2.2.2) is advertising that it knows how !--- to reach the ASBR (Router 1.1.1.1). Advertising Router: 2.2.2.2 LS Seq Number: 80000001 Checksum: 0x935C Length: 28 Network Mask: /0 TOS: 0 Metric: 64 !--- The ABR's cost to reach the ASBR.
ABR(路由器 2.2.2.2)已安装从 ASBR(路由器 1.1.1.1)获知的外部路由器并将外部 LSA 从区域 1 泛洪到区域 0。(外部 LSA 照旧泛洪到所有区域。) 但是,ASBR 不在区域 0 中。区域 0 中的路由器不知道如何访问 ASBR。这就是 ABR 创建 ASBR 汇总 LSA 并将路由器 1.1.1.1 的可访问性通告给区域 0 的原因。
注意:此下一组输出仅提供有关此示例设置中OSPF数据库的更多详细信息。如果您熟悉此信息,请跳到计算最短路径部分。
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 1) Routing Bit Set on this LSA LS age: 109 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. Advertising Router: 1.1.1.1 !--- This is the router ID of the router that created !--- this LSA. LS Seq Number: 80000011 Checksum: 0xFF59 Length: 60 AS Boundary Router !--- Bit E in the router LSA indicates that this !--- router originates external LSAs. Number of Links: 3 !--- There are three links in area 1. 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 !--- OSPF cost of the Ethernet segment. 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: 5.0.0.1 !--- The interface address that connects to !--- Router 2.2.2.2 is 5.0.0.1. Number of TOS metrics: 0 TOS 0 Metrics: 64 !--- OSPF cost of the link connecting the two routers. Link connected to: a Stub Network !--- This line represents the serial link 5.0.0.0/8. (Link ID) Network/subnet number: 5.0.0.0 (Link Data) Network Mask: 255.0.0.0 Number of TOS metrics: 0 TOS 0 Metrics: 64 !--- OSPF cost of the serial link. 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) LS age: 135 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: 80000020 Checksum: 0xCD0B 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: 6.0.0.2 Number of TOS metrics: 0 TOS 0 Metrics: 1 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: 1 Router Link States (Area 1) LS age: 130 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: 80000033 Checksum: 0x2130 Length: 48 Area Border Router Number of Links: 2 Link connected to: another Router (point-to-point) (Link ID) Neighboring Router ID: 1.1.1.1 (Link Data) Router Interface address: 5.0.0.2 Number of TOS metrics: 0 TOS 0 Metrics: 64 Link connected to: a Stub Network (Link ID) Network/subnet number: 5.0.0.0 (Link Data) Network Mask: 255.0.0.0 Number of TOS metrics: 0 TOS 0 Metrics: 64 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 0) LS age: 1280 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: 8000000D Checksum: 0x9057 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: 6.0.0.3 Number of TOS metrics: 0 TOS 0 Metrics: 1 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: 1
为了将路由从一个区域通告给另一个区域,ABR 将创建(类型 3)汇总 LSA。
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 0) LS age: 184 Options: (No TOS-capability, DC) LS Type: Summary Links(Network) Link State ID: 4.0.0.0 (summary Network Number) !--- 4.0.0.0/8 is advertised into area 0 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 5.0.0.0 OSPF Router with ID (2.2.2.2) (Process ID 2) Summary Net Link States (Area 0) LS age: 1768 Options: (No TOS-capability, DC) LS Type: Summary Links(Network) Link State ID: 5.0.0.0 (summary Network Number) !--- 5.0.0.0/8 is advertised into area 0 by !--- the ABR (Router 2.2.2.2). Advertising Router: 2.2.2.2 LS Seq Number: 80000006 Checksum: 0x8466 Length: 28 Network Mask: /8 TOS: 0 Metric: 64 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: 216 Options: (No TOS-capability, DC) LS Type: Summary Links(Network) Link State ID: 6.0.0.0 !--- 6.0.0.0/8 is advertised into area 1 by the ABR(2.2.2.2). Advertising Router: 2.2.2.2 LS Seq Number: 8000001F Checksum: 0xCC43 Length: 28 Network Mask: /8 TOS: 0 Metric: 1
本部分将从路由器 3.3.3.3 的角度来计算最短路径。
路由器 3.3.3.3 会在其自己的 LSA 中进行查找,并发现路由器 2.2.2.2 是邻居。然后,它会查看路由器 2.2.2.2 的 LSA 以验证路由器 2.2.2.2 是否将路由器 3.3.3.3 视为邻居。如果两个路由器互相看见作为邻居,则他们被认为可及的。
每个路由器还会检查自己的本地邻居表(可使用 show ip ospf neighbor 命令查看),以验证自身接口与邻居的接口是否位于公用 IP 子网上。
注意:未在未编号的接口上执行此检查。
如果这些接口位于一个公用子网上,则路由器将安装各自邻居的路由器 LSA 中列出的所有末节网络路由。在本示例中,60.0.0.0/8 是区域 0 中路由器 2.2.2.2 的 LSA 中列出的唯一末节网络,路由器 3.3.3.3 已直接与其相连。
检查完区域 0 中的所有可访问路由器的 LSA 之后,路由器 3.3.3.3 会查看数据库中的汇总 LSA。它查找4.0.0.0/8和5.0.0.0/8的汇总LSA。如果路由器3.3.3.3知道如何到达创建汇总LSA的通告路由器,它会将该路由添加到其路由表中。在本示例中,通告路由器是路由器 2.2.2.2,路由器 3.3.3.3 知道如何访问它。该通告路由器会在其路由表中安装 4.0.0.0/8 和 5.0.0.0/8 的路由。这些路由器的度量是访问通告路由器的度量与汇总 LSA 的度量之和。汇总 LSA 的度量是从访问生成了汇总 LSA 的区域内部路由或区域间路由的成本计算得出的。
在计算所有内部 OSPF 路由(区域内部或区域间)后,路由器 3.3.3.3 会检查外部 LSA。它首先检查 ASBR 1.1.1.1 创建的外部 LSA 9.0.0.0/8,然后计算如何访问 ASBR。路由器 3.3.3.3 检查路由器 1.1.1.1 的 ASBR 汇总 LSA,而该 LSA 是由 ABR(路由器 2.2.2.2)创建的。 执行此操作后,路由器 3.3.3.3 就知道可通过 ABR 来访问 ASBR。因此,路由器 3.3.3.3 将在其路由表中安装 9.0.0.0/8 的路由。在本示例中,该路由是 E1 路由,因此,其度量是访问 ABR 的路由器 3.3.3.3 的度量、访问 ASBR 的 ABR 的度量与外部 LSA 的度量之和。
下面的输出显示了上述每个路由器的路由表中的 OSPF 路由。
r3.3.3.3# show ip route ospf O IA 4.0.0.0/8 [110/75] via 6.0.0.2, 00:07:59, ATM2/0.20 O IA 5.0.0.0/8 [110/65] via 6.0.0.2, 00:07:59, ATM2/0.20 O E1 9.0.0.0/8 [110/70] via 6.0.0.2, 00:07:59, ATM2/0.20 r2.2.2.2#show ip route ospf O 4.0.0.0/8 [110/74] via 5.0.0.1, 00:06:55, Serial0/1/0 O E1 9.0.0.0/8 [110/69] via 5.0.0.1, 00:06:55, Serial0/1/0 r1.1.1.1#show ip route 9.0.0.0 Routing entry for 9.0.0.0/8 Known via "static", distance 1, metric 0 Redistributing via ospf 4 Advertised by ospf 4 metric 5 metric-type 1 Routing Descriptor Blocks: * 4.0.0.2 Route metric is 0, traffic share count is 1
目前没有针对此配置的故障排除信息。
版本 | 发布日期 | 备注 |
---|---|---|
1.0 |
10-Aug-2005 |
初始版本 |