本檔案將說明開放最短路徑優先(OSPF)如何將外部路由傳播到多個網路區域。
本文件沒有特定需求。
本文件所述內容不限於特定軟體和硬體版本。
如需文件慣例的詳細資訊,請參閱思科技術提示慣例。
本節提供用於設定本文件中所述功能的資訊。
注意:要查詢有關本文檔中使用的命令的其他資訊,請使用命令查詢工具(僅限註冊客戶)。
本檔案會使用下圖中所示的網路設定。
本檔案會使用此處顯示的組態。
| 路由器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 — 顯示鏈路狀態通告(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)獲知的外部路由,並從區域1將外部LSA泛洪到區域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。如果Router 3.3.3.3知道如何到達建立彙總LSA的通告路由器,它會將該路由安裝到其路由表中。在我們的示例中,通告路由器是Router 2.2.2.2,路由器3.3.3.3知道如何到達該路由器。它會將4.0.0.0/8和5.0.0.0/8的路由安裝到其路由表中。這些路由的度量是到達通告路由器的度量加上彙總LSA的度量。根據到達為其生成彙總LSA的區域內或區域間路由的開銷計算彙總LSA的度量。
在計算所有內部OSPF路由(區域內和區域間)後,Router 3.3.3.3檢查外部LSA。它首先檢查由ASBR 1.1.1.1建立的外部LSA 9.0.0.0/8,然後計算如何到達ASBR。路由器3.3.3.3檢查ABR(路由器2.2.2.2)為路由器1.1.1.1建立的ASBR彙總LSA。 執行此操作後,路由器3.3.3.3知道可以通過ABR到達ASBR。因此,Router 3.3.3.3在其路由表中安裝9.0.0.0/8的路由。在我們的示例中,它是E1路由,因此其度量是路由器3.3.3.3到達ABR的度量,加上到達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 |
13-Jan-2004
|
初始版本 |