簡介
本檔案將說明開放最短路徑優先(OSPF)連結狀態通告(LSA)第5類外部路由選擇機制。文中提供一個網路情境,其中包含如何選擇從一台自治系統邊界路由器(ASBR)接收的路由到另一台自治系統邊界路由器的組態。
必要條件
需求
Cisco建議您瞭解OSPF和IP路由。
採用元件
本文件所述內容不限於特定軟體和硬體版本。
本文中的資訊是根據特定實驗室環境內的裝置所建立。文中使用到的所有裝置皆從已清除(預設)的組態來啟動。如果您的網路正在作用,請確保您已瞭解任何指令可能造成的影響。
背景資訊
如果將路由從其他路由協定或從靜態路由重分發到OSPF,則會導致這些路由成為OSPF外部路由。外部路由分為兩種類別,外部型別1(O E1)和外部型別2(O E2)。
兩者之間的差異在於路由開銷(度量)的計算方式。第2類路由的成本始終是外部成本,與到達該路由的內部成本無關。第1類開銷是到達該路由所用的外部開銷和內部開銷之和。對於同一目的地,1類路由始終優先於2類路由。
設定
網路圖表
考慮此網路拓撲,檢查區域0中R4上接收到的LSA第5類,該類LSA源自區域1中的ASBR。R2和R3是區域邊界路由器(ABR)。
組態
為簡單起見,此配置在區域1路由器R5和R1的ASBR上重新分佈靜態路由。
R5# ip route 192.168.1.1 255.255.255.255 Null0 router ospf 1 重新分配靜態子網 網路10.5.5.5 0.0.0.0區域1 網路10.10.25.5 0.0.0.0區域1 |
R1# ip route 192.168.1.1 255.255.255.255 Null0
router ospf 1 重新分配靜態子網 網路10.1.1.1 0.0.0.0區域1 網路10.10.13.1 0.0.0.0區域1 |
註:如果沒有指定度量,則OSPF會在從除邊界網關協定(BGP)路由以外的所有協定重分發路由時設定預設值20,邊界網關協定(BGP)路由會收到度量1。當存在已劃分子網的主網路時,必須使用關鍵字subnet將協定重分發到OSPF。如果不使用此關鍵字,OSPF只重新分發未劃分子網的主網。
驗證
可以使用以下命令驗證重新分發:
R5#show ip ospf
Routing Process "ospf 1" with ID 10.5.5.5
Start time: 00:06:18.188, Time elapsed: 00:26:04.176
Supports only single TOS(TOS0) routes
Supports opaque LSA
Supports Link-local Signaling (LLS)
Supports area transit capability
Supports NSSA (compatible with RFC 3101)
Event-log enabled, Maximum number of events: 1000, Mode: cyclic
It is an autonomous system boundary router
Redistributing External Routes from,
static, includes subnets in redistribution
Router is not originating router-LSAs with maximum metric
Initial SPF schedule delay 5000 msecs
Minimum hold time between two consecutive SPFs 10000 msecs
Maximum wait time between two consecutive SPFs 10000 msecs
Incremental-SPF disabled
Minimum LSA interval 5 secs
Minimum LSA arrival 1000 msecs
LSA group pacing timer 240 secs
Interface flood pacing timer 33 msecs
Retransmission pacing timer 66 msecs
Number of external LSA 2. Checksum Sum 0x010F34
Number of opaque AS LSA 0. Checksum Sum 0x000000
Number of DCbitless external and opaque AS LSA 0
Number of DoNotAge external and opaque AS LSA 0
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Number of areas transit capable is 0
External flood list length 0
IETF NSF helper support enabled
Cisco NSF helper support enabled
Reference bandwidth unit is 100 mbps
Area 1
Number of interfaces in this area is 2 (1 loopback)
Area has no authentication
SPF algorithm last executed 00:22:45.848 ago
SPF algorithm executed 2 times
Area ranges are
Number of LSA 11. Checksum Sum 0x03C19D
Number of opaque link LSA 0. Checksum Sum 0x000000
Number of DCbitless LSA 0
Number of indication LSA 0
Number of DoNotAge LSA 0
Flood list length 0
R1#show ip ospf
Routing Process "ospf 1" with ID 10.1.1.1
Start time: 00:07:09.376, Time elapsed: 00:27:30.368
Supports only single TOS(TOS0) routes
Supports opaque LSA
Supports Link-local Signaling (LLS)
Supports area transit capability
Supports NSSA (compatible with RFC 3101)
Event-log enabled, Maximum number of events: 1000, Mode: cyclic
It is an autonomous system boundary router
Redistributing External Routes from,
static, includes subnets in redistribution
Router is not originating router-LSAs with maximum metric
Initial SPF schedule delay 5000 msecs
Minimum hold time between two consecutive SPFs 10000 msecs
Maximum wait time between two consecutive SPFs 10000 msecs
Incremental-SPF disabled
Minimum LSA interval 5 secs
Minimum LSA arrival 1000 msecs
LSA group pacing timer 240 secs
Interface flood pacing timer 33 msecs
Retransmission pacing timer 66 msecs
Number of external LSA 2. Checksum Sum 0x010F34
Number of opaque AS LSA 0. Checksum Sum 0x000000
Number of DCbitless external and opaque AS LSA 0
Number of DoNotAge external and opaque AS LSA 0
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Number of areas transit capable is 0
External flood list length 0
IETF NSF helper support enabled
Cisco NSF helper support enabled
Reference bandwidth unit is 100 mbps
Area 1
Number of interfaces in this area is 2 (1 loopback)
Area has no authentication
SPF algorithm last executed 00:24:42.268 ago
SPF algorithm executed 2 times
Area ranges are
Number of LSA 11. Checksum Sum 0x076A33
Number of opaque link LSA 0. Checksum Sum 0x000000
Number of DCbitless LSA 0
Number of indication LSA 0
Number of DoNotAge LSA 0
Flood list length 0
因此,從ASBR路由器中,R5和R1重新分發靜態路由。若要檢查路由器R4上的重分發路由是否有字首192.168.1.1/32,請輸入以下命令:
R4#show ip route 192.168.1.1 255.255.255.255
Routing entry for 192.168.1.1/32
Known via "ospf 1", distance 110, metric 20, type extern 2, forward metric 2
Last update from 10.10.24.2 on FastEthernet0/0, 00:25:43 ago
Routing Descriptor Blocks:
* 10.10.34.3, from 10.1.1.1, 00:26:44 ago, via FastEthernet0/1
Route metric is 20, traffic share count is 1
10.10.24.2, from 10.5.5.5, 00:25:43 ago, via FastEthernet0/0
Route metric is 20, traffic share count is 1
這顯示兩個源自於10.1.1.1(R1)的路由和10.5.5.5(R5)的路由都安裝在度量為20的路由表中。
也可以在OSPF資料庫中檢查此項:
如前所述,將路由重分發到OSPF時,度量值預設設定為20。接下來,在ASBR 10.1.1.1(R1)上重新分發時定義值10,並檢查路由器4上的輸出。
以下是在R1上實施的更改:
R1(config)#router ospf 1
R1(config-router)#redistribute static subnets metric 10
以下是R4上的路由表:
R4#show ip route 192.168.1.1 255.255.255.255
Routing entry for 192.168.1.1/32
Known via "ospf 1", distance 110, metric 10, type extern 2, forward metric 2
Last update from 10.10.34.3 on FastEthernet0/1, 00:00:09 ago
Routing Descriptor Blocks:
* 10.10.34.3, from 10.1.1.1, 00:00:09 ago, via FastEthernet0/1
Route metric is 10, traffic share count is 1
路由表中只有一個條目。進一步檢查此外部LSA的OSPF資料庫。
轉發度量
轉發度量是從路由器到達ASBR的成本。可以使用以下命令檢查此問題:
R4#show ip ospf border-routers
OSPF Router with ID (10.4.4.4) (Process ID 1)
Base Topology (MTID 0)
Internal Router Routing Table
Codes: i - Intra-area route, I - Inter-area route
i 10.3.3.3 [1] via 10.10.34.3, FastEthernet0/1, ABR, Area 0, SPF 3
I 10.1.1.1 [2] via 10.10.34.3, FastEthernet0/1, ASBR, Area 0, SPF 3
i 10.2.2.2 [1] via 10.10.24.2, FastEthernet0/0, ABR, Area 0, SPF 3
I 10.5.5.5 [2] via 10.10.24.2, FastEthernet0/0, ASBR, Area 0, SPF 3
在此輸出中,到達路由器R4的ASBR(R1和R5)的開銷為2。預設情況下,OSPF中快速乙太網介面的開銷為1。因此,在這種情況下,到達路由器R1或R5的開銷為2:轉發度量=到達ABR的路由器成本(1)+到達ASBR的ABR成本(1)= 2。
將R5上的重分發度量也更改為10,這樣兩個路由都會再次安裝到路由表中。
以下是在R1上實施的更改:
R5(config)#router ospf 1
R5(config-router)#redistribute static subnets metric 10
以下是R4上的路由表:
R4#show ip route 192.168.1.1 255.255.255.255
Routing entry for 192.168.1.1/32
Known via "ospf 1", distance 110, metric 10, type extern 2, forward metric 2
Last update from 10.10.24.2 on FastEthernet0/0, 00:00:12 ago
Routing Descriptor Blocks:
* 10.10.34.3, from 10.1.1.1, 00:12:05 ago, via FastEthernet0/1
Route metric is 10, traffic share count is 1
10.10.24.2, from 10.5.5.5, 00:00:12 ago, via FastEthernet0/0
Route metric is 10, traffic share count is 1
更改到達其中一個ASBR但具有相同重分發度量的成本,並檢查相同的輸出。
增加路由器R4 fa0/1的OSPF開銷:
R4(config)#int fa0/1
R4(config-if)#ip ospf cost 10
檢查轉發度量。它顯示現在到達ASBR R1的成本為11:
R4#show ip ospf border-routers
OSPF Router with ID (10.4.4.4) (Process ID 1)
Base Topology (MTID 0)
Internal Router Routing Table
Codes: i - Intra-area route, I - Inter-area route
i 10.3.3.3 [10] via 10.10.34.3, FastEthernet0/1, ABR, Area 0, SPF 7
I 10.1.1.1 [11] via 10.10.34.3, FastEthernet0/1, ASBR, Area 0, SPF 7
i 10.2.2.2 [1] via 10.10.24.2, FastEthernet0/0, ABR, Area 0, SPF 7
I 10.5.5.5 [2] via 10.10.24.2, FastEthernet0/0, ASBR, Area 0, SPF 7
以下是R4上的路由表:
R4#show ip route 192.168.1.1 255.255.255.255
Routing entry for 192.168.1.1/32
Known via "ospf 1", distance 110, metric 10, type extern 2, forward metric 2
Last update from 10.10.24.2 on FastEthernet0/0, 00:02:17 ago
Routing Descriptor Blocks:
10.10.24.2, from 10.5.5.5, 00:07:11 ago, via FastEthernet0/0
Route metric is 10, traffic share count is 1
因此,具有較低轉發度量的路由將安裝在路由表中。
總而言之,如果您有多個第5類LSA的條目,則第一個首選項將賦予度量(重分佈度量)。 具有較低度量的路由將安裝到路由表中。如果重分佈度量相同,則第二個優先選項將賦予Forward Metric。轉發度量較低的路由將安裝在路由表中。
疑難排解
目前尚無適用於此組態的具體疑難排解資訊。