簡介
本文的目的在於說明當路由器收到指定外部網路的5類連結狀態通告(LSA)和第7類LSA時,開放最短路徑優先(OSPF)路徑選取行為。 在非NSSA區域中執行重分發時,OSPF會將第5類LSA注入到OSPF域中。重新分發到NSSA區域會建立一種稱為Type-7的特殊型別的LSA,它只能存在於NSSA區域中。
必要條件
使用本文檔時,請參閱圖1中的網路圖:
圖1
在網路圖中,非主幹區域1和NSSA區域50都連線到R1。R1是連線到主幹區域0的區域邊界路由器(ABR)。R2和R3負責將相同的字首192.0.2.100/32重新分發到OSPF域。
需求
Cisco建議您瞭解OSPF協定。
採用元件
本檔案中的資訊是根據以下軟體版本:
背景資訊
Cisco IOS-XE裝置支援RFC 3101用於外部路徑計算。RFC 1587已被RFC 3101取代,但特定於RFC 1587的行為仍可通過配置啟用。在Cisco IOS版本15.1(2)S和更新版本中,show ip ospf命令的輸出顯示了裝置是使用RFC 3101還是RFC 1587。
RFC 3101第2.5節摘要
(e) If the current LSA is functionally the same as an
installed LSA (i.e., same destination, cost and non-zero
forwarding address) then apply the following priorities in
deciding which LSA is preferred:
1. A Type-7 LSA with the P-bit set.
2. A Type-5 LSA.
3. The LSA with the higher router ID.
RFC 1587第3.5節摘要
5. Otherwise, compare the cost of this new AS external path
to the ones present in the table. Note that type-5 and
type-7 routes are directly comparable. Type-1 external
paths are always shorter than Type-2 external paths.
Type-1 external paths are compared by looking at the sum
of the distance to the forwarding address/ASBR and the
advertised Type-1 paths (X+Y). Type-2 external paths are
compared by looking at the advertised Type-2 metrics,
and then if necessary, the distance to the forwarding
address/ASBR.
When a type-5 LSA and a type-7 LSA are found to have the
same type and an equal distance, the following priorities
apply (listed from highest to lowest) for breaking the tie.
a. Any type 5 LSA.
b. A type-7 LSA with the P-bit set and the forwarding
address non-zero.
c. Any other type-7 LSA.
If the new path is shorter, it replaces the present paths
in the routing table entry. If the new path is the same
cost, it is added to the routing table entry's list of
paths
案例 1
網路圖表
圖2
在此案例中,我們將觀察使用RFC 3101進行外部路徑計算時觀察到的行為。我們將對在R3和R2上重新分發的字首192.0.2.100/32感興趣。
R1中的第1類LSA位於以下輸出中:
R1#show ip ospf database router 1.1.1.1
OSPF Router with ID (1.1.1.1) (Process ID 1)
Router Link States (Area 0)
LS age: 51
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 1.1.1.1
Advertising Router: 1.1.1.1
LS Seq Number: 80000007
Checksum: 0x3BD6
Length: 48
Area Border Router
AS Boundary Router
Number of Links: 2
Link connected to: another Router (point-to-point)
(Link ID) Neighboring Router ID: 4.4.4.4
(Link Data) Router Interface address: 192.168.14.1
Number of MTID metrics: 0
TOS 0 Metrics: 1
Link connected to: a Stub Network
(Link ID) Network/subnet number: 192.168.14.0
(Link Data) Network Mask: 255.255.255.0
Number of MTID metrics: 0
TOS 0 Metrics: 1
Router Link States (Area 1)
LS age: 562
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 1.1.1.1
Advertising Router: 1.1.1.1
LS Seq Number: 8000000C
Checksum: 0xEC26
Length: 48
Area Border Router
AS Boundary 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: 192.168.13.1
Number of MTID metrics: 0
TOS 0 Metrics: 1
Link connected to: a Stub Network
(Link ID) Network/subnet number: 192.168.13.0
(Link Data) Network Mask: 255.255.255.0
Number of MTID metrics: 0
TOS 0 Metrics: 1
Router Link States (Area 50)
LS age: 562
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 1.1.1.1
Advertising Router: 1.1.1.1
LS Seq Number: 80000012
Checksum: 0x42CA
Length: 48
Area Border Router
AS Boundary Router
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: 192.168.12.1
Number of MTID metrics: 0
TOS 0 Metrics: 1
Link connected to: a Stub Network
(Link ID) Network/subnet number: 192.168.12.0
(Link Data) Network Mask: 255.255.255.0
Number of MTID metrics: 0
TOS 0 Metrics: 1
在R1上,我們的資料庫中有以下外部LSA:
R1#show ip ospf database external
OSPF Router with ID (1.1.1.1) (Process ID 1)
Type-5 AS External Link States
LS age: 706
Options: (No TOS-capability, DC, Upward)
LS Type: AS External Link
Link State ID: 192.0.2.100 (External Network Number )
Advertising Router: 1.1.1.1
LS Seq Number: 80000001
Checksum: 0xE617
Length: 36
Network Mask: /32
Metric Type: 2 (Larger than any link state path)
MTID: 0
Metric: 20
Forward Address: 192.168.12.2
External Route Tag: 0
LS age: 600
Options: (No TOS-capability, DC, Upward)
LS Type: AS External Link
Link State ID: 192.0.2.100 (External Network Number )
Advertising Router: 3.3.3.3
LS Seq Number: 80000002
Checksum: 0xBFAC
Length: 36
Network Mask: /32
Metric Type: 2 (Larger than any link state path)
MTID: 0
Metric: 20
Forward Address: 0.0.0.0
External Route Tag: 0
R1#show ip ospf database nssa-external
OSPF Router with ID (1.1.1.1) (Process ID 1)
Type-7 AS External Link States (Area 50)
LS age: 865
Options: (No TOS-capability, Type 7/5 translation, DC, Upward)
LS Type: AS External Link
Link State ID: 192.0.2.100 (External Network Number )
Advertising Router: 2.2.2.2
LS Seq Number: 80000002
Checksum: 0x32BC
Length: 36
Network Mask: /32
Metric Type: 2 (Larger than any link state path)
MTID: 0
Metric: 20
Forward Address: 192.168.12.2
External Route Tag: 0
現在讓我們檢查R1上首選哪個LSA:
R1#show ip ospf rib 192.0.2.100
OSPF Router with ID (1.1.1.1) (Process ID 1)
Base Topology (MTID 0)
OSPF local RIB
Codes: * - Best, > - Installed in global RIB
LSA: type/LSID/originator
*> 192.0.2.100/32, NSSA2, cost 20, fwd cost 1, tag 0, area 50
SPF Instance 38, age 00:04:51
contributing LSA: 7/192.0.2.100/2.2.2.2 (area 50)
contributing LSA: 5/192.0.2.100/3.3.3.3
Flags: RIB, HiPrio, ViaFwAddr, IntraNonBB, NSSA P-bit
via 192.168.12.2, GigabitEthernet1 label 1048578
Flags: RIB
LSA: 7/192.0.2.100/2.2.2.2
正如我們在上述輸出中看到的,R1優先使用R2的Type-7 LSA。這是因為遵循RFC 3101,它有以下路徑計算優先選項
1.已設定P位的第7類LSA。
2. A 5類LSA。
3.具有較高路由器ID的LSA。
附註:請注意,如果當前LSA與已安裝LSA在功能上相同,則以下路徑計算首選項適用。我們可以檢驗兩個LSA的轉發度量是否與R1的第1類LSA相同。
現在,如果我們從R2清除了NSSA第7類LSA上的P位,我們會發現我們將優先使用來自R3的第5類LSA:
RFC 3101第2.4節摘要
An NSSA internal AS boundary router must set the P-bit in the LSA
header's option field of any Type-7 LSA whose network it wants
advertised into the OSPF domain's full transit topology. The LSAs of
these networks must have a valid non-zero forwarding address. If the
P-bit is clear the LSA is not translated into a Type-5 LSA by NSSA
border routers.
When an NSSA border router originates both a Type-5 LSA and a Type-7
LSA for the same network, then the P-bit must be clear in the Type-7
LSA so that it isn't translated into a Type-5 LSA by another NSSA
border router.
在我們繼續清除R2上的P位之前,這裡是R2的第7類LSA的輸出
R2#show ip ospf database nssa-external
OSPF Router with ID (2.2.2.2) (Process ID 1)
Type-7 AS External Link States (Area 50)
LS age: 1215
Options: (No TOS-capability, Type 7/5 translation, DC, Upward)
LS Type: AS External Link
Link State ID: 192.0.2.100 (External Network Number )
Advertising Router: 2.2.2.2
LS Seq Number: 80000002
Checksum: 0x32BC
Length: 36
Network Mask: /32
Metric Type: 2 (Larger than any link state path)
MTID: 0
Metric: 20
Forward Address: 192.168.12.2
External Route Tag: 0
當NSSA邊界路由器為同一網路建立第5類LSA和第7類LSA時,可以清除P位。
R2#show ip ospf database nssa-external
OSPF Router with ID (2.2.2.2) (Process ID 1)
Type-7 AS External Link States (Area 50)
LS age: 44
Options: (No TOS-capability, No Type 7/5 translation, DC, Upward)
LS Type: AS External Link
Link State ID: 192.0.2.100 (External Network Number )
Advertising Router: 2.2.2.2
LS Seq Number: 80000003
Checksum: 0xBFAD
Length: 36
Network Mask: /32
Metric Type: 2 (Larger than any link state path)
MTID: 0
Metric: 20
Forward Address: 0.0.0.0
External Route Tag: 0
以下是上述輸出的一些重要特徵:
- 位P — 此位用於告知NSSA ABR是否將型別7轉換為型別5。
- No Type 7/5 translation表示位P = 0。
- 型別7/5轉換表示位P = 1。
- 如果位P = 0,則NSSA ABR不能將此LSA轉換為型別5。當NSSA ASBR也是NSSA ABR時,會發生這種情況。
- 如果位P = 1,則NSSA ABR必須將此型別7 LSA轉換為型別5 LSA。如果有多個NSSA ABR,則具有最高路由器ID的NSSA ABR會執行此操作。
現在,我們檢查R1時,發現我們更喜歡型別5,而不是型別7 LSA。
R1#show ip ospf rib 192.0.2.100
OSPF Router with ID (1.1.1.1) (Process ID 1)
Base Topology (MTID 0)
OSPF local RIB
Codes: * - Best, > - Installed in global RIB
LSA: type/LSID/originator
*> 192.0.2.100/32, Ext2, cost 20, fwd cost 1, tag 0
SPF Instance 39, age 00:03:32
contributing LSA: 7/192.0.2.100/2.2.2.2 (area 50)
contributing LSA: 5/192.0.2.100/3.3.3.3
Flags: RIB, HiPrio, IntraNonBB
via 192.168.13.3, GigabitEthernet2 label 1048578
Flags: RIB
LSA: 5/192.0.2.100/3.3.3.3
案例 2
網路圖表
圖3
在此案例中,我們將觀察使用RFC 1587進行外部路徑計算時觀察到的行為。IOS-XE裝置上會自動啟用RFC 3101合規性。要將RFC 3101與RFC 1587的相容性替換為在非純末梢區域(NSSA)區域邊界路由器(ABR)中進行路由選擇,請在路由器配置模式或地址系列配置模式下使用compatiblerfc1587命令。要還原RFC 3101相容性,請使用此命令的no形式。
我們會對在R3和R2上重新分發的字首192.0.2.100/32感興趣。首先必須在R1上啟用RFC 1587相容性
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#router ospf 1
R1(config-router)#compatible rfc1587
R1#show ip ospf | in RFC
Supports NSSA (compatible with RFC 1587)
在R1上啟用相容性RFC 1587後,我們可以檢查資料庫中的路徑以及首選的LSA:
R1#show ip ospf database external
OSPF Router with ID (1.1.1.1) (Process ID 1)
Type-5 AS External Link States
LS age: 115
Options: (No TOS-capability, DC, Upward)
LS Type: AS External Link
Link State ID: 192.0.2.100 (External Network Number )
Advertising Router: 3.3.3.3
LS Seq Number: 80000003
Checksum: 0xBDAD
Length: 36
Network Mask: /32
Metric Type: 2 (Larger than any link state path)
MTID: 0
Metric: 20
Forward Address: 0.0.0.0
External Route Tag: 0
R1#show ip ospf database nssa-external
OSPF Router with ID (1.1.1.1) (Process ID 1)
Type-7 AS External Link States (Area 50)
LS age: 48
Options: (No TOS-capability, Type 7/5 translation, DC, Upward)
LS Type: AS External Link
Link State ID: 192.0.2.100 (External Network Number )
Advertising Router: 2.2.2.2
LS Seq Number: 80000005
Checksum: 0x2CBF
Length: 36
Network Mask: /32
Metric Type: 2 (Larger than any link state path)
MTID: 0
Metric: 20
Forward Address: 192.168.12.2
External Route Tag: 0
現在讓我們檢查LSA是什麼 r1上的首選:
R1#show ip ospf rib 192.0.2.100
OSPF Router with ID (1.1.1.1) (Process ID 1)
Base Topology (MTID 0)
OSPF local RIB
Codes: * - Best, > - Installed in global RIB
LSA: type/LSID/originator
*> 192.0.2.100/32, Ext2, cost 20, fwd cost 1, tag 0
SPF Instance 44, age 00:01:56
contributing LSA: 7/192.0.2.100/2.2.2.2 (area 50)
contributing LSA: 5/192.0.2.100/3.3.3.3
Flags: RIB, HiPrio, IntraNonBB, PartialSPF
via 192.168.13.3, GigabitEthernet2 label 1048578
Flags: RIB
LSA: 5/192.0.2.100/3.3.3.3
首選型別5 LSA。
在上面的輸出中,您可能還注意到R1並未將型別7轉換為型別5,這是因為只有新增到路由表的第7類路由才需要轉換。
相關資訊