簡介
本檔案將說明開放最短路徑優先版本3(OSPFv3)自治系統(AS)外部連結狀態通告(LSA)第5類路由選擇機制。文中提供一個網路情境,其中包含如何選擇從一台自治系統邊界路由器(ASBR)接收的路由到另一台自治系統邊界路由器的組態。
必要條件
需求
Cisco建議您瞭解OSPFv3和IPv6路由。
採用元件
本文件所述內容不限於特定軟體和硬體版本。
本文中的資訊是根據特定實驗室環境內的裝置所建立。文中使用到的所有裝置皆從已清除(預設)的組態來啟動。如果您的網路正在作用,請確保您已瞭解任何指令可能造成的影響。
背景資訊
如果路由從其他IPv6路由協定或IPv6靜態路由重分發到OSPFv3,則預設情況下這些路由會成為OSPF AS外部路由。這些AS-External路由分為兩類:外部型別1(O E1)和外部型別2(O E2)。
兩者之間的差異在於路由開銷(度量)的計算方式。第2類路由的成本始終為外部成本,與到達該路由的內部成本無關。第1類路由的成本是到達該路由的外部成本與內部成本的加加。對於同一目的地,1類路由始終優先於2類路由。
設定
網路圖表
請考慮以下網路拓撲,檢查區域0中R4上接收到的AS-External LSA 5(來自區域1中ASBR)。R2和R3是區域邊界路由器(ABR)。
組態
為簡單起見,此配置在區域1路由器R5和R1的ASBR上重新分配IPv6靜態路由。
R5#
ipv6 route FD00:AAAA:BBBB:CCCC::/64 Null0
!
interface FastEthernet0/0
ipv6 address FD00:AAAA:BBBB:25::5/64
ipv6 ospf 10 area 1
!
ipv6 router ospf 10
router-id 192.168.1.5
redistribute static
R1#
ipv6 route FD00:AAAA:BBBB:CCCC::/64 Null0
!
interface FastEthernet0/1
ipv6 address FD00:AAAA:BBBB:13::1/64
ipv6 ospf 10 area 1
!
ipv6 router ospf 10
router-id 192.168.1.1
redistribute static
注意:如果未指定度量,則OSPFv3在重新分發來自邊界網關協定(BGP)路由以外所有協定的路由時設定預設值20,邊界網關協定(BGP)路由接收到度量1。
驗證
可以使用以下命令驗證重新分發:
R5#show ipv6 ospf
Routing Process "ospfv3 10" with ID 192.168.1.5
Event-log enabled, Maximum number of events: 1000, Mode: cyclic
It is an autonomous system boundary router
Redistributing External Routes from,
static
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
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 0x0100D4
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Graceful restart helper support enabled
Reference bandwidth unit is 100 mbps
RFC1583 compatibility enabled
Area 1
Number of interfaces in this area is 1
SPF algorithm executed 5 times
Number of LSA 16. Checksum Sum 0x08011B
Number of DCbitless LSA 0
Number of indication LSA 0
Number of DoNotAge LSA 0
Flood list length 0
R1#show ipv6 ospf
Routing Process "ospfv3 10" with ID 192.168.1.1
Event-log enabled, Maximum number of events: 1000, Mode: cyclic
It is an autonomous system boundary router
Redistributing External Routes from,
static
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
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 0x0100D4
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Graceful restart helper support enabled
Reference bandwidth unit is 100 mbps
RFC1583 compatibility enabled
Area 1
Number of interfaces in this area is 1
SPF algorithm executed 6 times
Number of LSA 16. Checksum Sum 0x08AD19
Number of DCbitless LSA 0
Number of indication LSA 0
Number of DoNotAge LSA 0
Flood list length 0
因此,ASBR路由器R5和R1都會重新分配IPv6靜態路由。若要檢查路由器R4上的路由表和OSPFv3資料庫中的重分發路由是否有字首FD00:AAAA:BBB:CCCC::/64,請輸入以下命令:
重分佈度量
如前所述,將路由重分發到OSPFv3時,度量值預設設定為20。接下來,在ASBR 192.168.1.1(R1)上重分發時定義值10,並檢查Router 4上的輸出。
以下是在R1上實施的更改:
R1(config)#ipv6 router ospf 10
R1(config-rtr)#redistribute static metric 10
現在,路由表只顯示IPv6路由表中的一個條目。進一步檢查此AS外部LSA的OSPF資料庫:
轉發度量
轉發度量是從路由器到達ASBR的成本。可以使用以下命令檢查此問題:
R4#show ipv6 ospf border-routers
OSPFv3 Router with ID (192.168.1.4) (Process ID 10)
Codes: i - Intra-area route, I - Inter-area route
I 192.168.1.1 [3] via FE80::C801:37FF:FE2C:6, FastEthernet0/0, ASBR, Area 0, SPF 2
I 192.168.1.1 [2] via FE80::C802:BFF:FEB4:6, FastEthernet0/1, ASBR, Area 0, SPF 2
i 192.168.1.3 [1] via FE80::C802:BFF:FEB4:6, FastEthernet0/1, ABR, Area 0, SPF 2
i 192.168.1.2 [1] via FE80::C801:37FF:FE2C:6, FastEthernet0/0, ABR, Area 0, SPF 2
I 192.168.1.5 [2] via FE80::C801:37FF:FE2C:6, FastEthernet0/0, ASBR, Area 0, SPF 2
在此輸出中,從路由器R4到達ASBR(R1和R5)的開銷為2。預設情況下,OSPFv3中FastEthernet介面的開銷為1。因此,在這種情況下,從R4到達R1或R5的開銷為2:轉發度量=到達ABR的路由器成本(1)+到達ASBR的ABR成本(1)= 2。
將R5上的重分發度量也更改為10,因此兩個路由都再次安裝在IPv6路由表中。
以下是在R5上實施的更改:
R5(config)#ipv6 router ospf 10
R5(config-rtr)#redistribute static metric 10
R4上的IPv6路由表和OSPFv3 RIB顯示:
R4#sh ipv6 ospf rib detail
* FD00:AAAA:BBBB:CCCC::/64, Ext-2, cost 10/2
source 192.168.1.1, tag 0
via FE80::C801:37FF:FE2C:6, FastEthernet0/0
via FE80::C802:BFF:FEB4:6, FastEthernet0/1
LSA: 4005/0/192.168.1.5
LSA: 4005/0/192.168.1.1
R4#show ipv6 route FD00:AAAA:BBBB:CCCC::/64
Routing entry for FD00:AAAA:BBBB:CCCC::/64
Known via "ospf 10", distance 110, metric 10, type extern 2
Route count is 2/2, share count 0
Routing paths:
FE80::C802:BFF:FEB4:6, FastEthernet0/1
Last updated 00:09:49 ago
FE80::C801:37FF:FE2C:6, FastEthernet0/0
Last updated 00:00:14 ago
現在,讓我們更改到達某個ASBR但具有相同的重分配度量的成本,並檢查相同的輸出。
增加路由器R4 fa0/1的OSPFv3開銷:
R4(config)#int fa0/1
R4(config-if)#ipv6 ospf cost 10
檢查轉發度量。它顯示現在從Fa0/1介面到達ASBR R1的成本為11:
R4#show ipv6 ospf border-routers
OSPFv3 Router with ID (192.168.1.4) (Process ID 10)
Codes: i - Intra-area route, I - Inter-area route
I 192.168.1.1 [3] via FE80::C801:37FF:FE2C:6, FastEthernet0/0, ASBR, Area 0, SPF 3
I 192.168.1.1 [11] via FE80::C802:BFF:FEB4:6, FastEthernet0/1, ASBR, Area 0, SPF 3
i 192.168.1.3 [10] via FE80::C802:BFF:FEB4:6, FastEthernet0/1, ABR, Area 0, SPF 3
i 192.168.1.2 [1] via FE80::C801:37FF:FE2C:6, FastEthernet0/0, ABR, Area 0, SPF 3
I 192.168.1.5 [2] via FE80::C801:37FF:FE2C:6, FastEthernet0/0, ASBR, Area 0, SPF 3
現在,R4上的IPv6路由表和OSPFv3 RIB顯示:
R4#sh ipv6 ospf rib detail
* FD00:AAAA:BBBB:CCCC::/64, Ext-2, cost 10/2
source 192.168.1.5, tag 0
via FE80::C801:37FF:FE2C:6, FastEthernet0/0
LSA: 4005/0/192.168.1.5
LSA: 4005/0/192.168.1.1
R4#show ipv6 route FD00:AAAA:BBBB:CCCC::/64
Routing entry for FD00:AAAA:BBBB:CCCC::/64
Known via "ospf 10", distance 110, metric 10, type extern 2
Route count is 1/1, share count 0
Routing paths:
FE80::C801:37FF:FE2C:6, FastEthernet0/0
Last updated 00:02:19 ago
因此,具有較低轉發指標的路由將安裝在IPv6路由表中。
總而言之,當您有多個用於AS-External LSA的條目時,第一個首選項將指定給度量(重分佈度量)。 具有較低度量的路由將安裝在IPv6路由表中。如果重分佈度量相同,則第二個優先選項將賦予Forward Metric。轉發度量較低的路由將安裝在IPv6路由表中。