本檔案將介紹Nexus和Cisco IOS®功能之間的開放最短路徑優先(OSPF)協定如何在Cisco IOS和Nexus作業系統(NXOS)中實施。
Cisco建議您瞭解OSPF協定。
本文中的資訊係根據以下軟體和硬體版本:
Cisco IOS裝置支援RFC 1583。但是,NXOS支援RFC 2328,而且有多種設計可讓這種差異在網路中存在外部OSPF路由時造成路由環路。
本節將討論RFC 1583和RFC 2328在如何在多個外部路由中選擇最佳路由方面的差異。
為了比較第1類外部路徑,請檢視到轉發地址的距離和通告的第1類度量(X+Y)的總和。 若要比較第2類外部路徑,請檢視通告的第2類度量,如有必要,檢視到轉發地址的距離。
如果新路徑較短,則會替換路由表條目中的現有路徑。 如果新路徑的成本相同,則會將其新增到路由表條目的路徑清單中。
使用非主幹區域的區域內路徑總是最優先使用。其他路徑(區域內主幹路徑和區域間路徑)的優先順序相同。
R3和R4重新分發與OSPF外部型別E2路由度量相同的網路172.16.1.0/24。R6優先使用R3通告的路由,因為到ASBR R3的轉發度量低於到R4,而172.16.1.0/24的下一跳是R1。(根據RFC 1583,路徑選擇完全基於開銷。)
R6#sh ip ospf border-routers
OSPF Router with ID (192.168.6.6) (Process ID 1)
Base Topology (MTID 0)
Internal Router Routing Table
Codes: i - Intra-area route, I - Inter-area route
i 192.168.4.4 [51] via 192.168.56.5, GigabitEthernet0/0, ASBR, Area 2, SPF 17
>>>> Cost is 51 to reach R4 ASBR.
i 192.168.1.1 [1] via 192.168.16.1, GigabitEthernet0/1, ABR, Area 2, SPF 17
I 192.168.3.3 [42] via 192.168.16.1, GigabitEthernet0/1, ASBR, Area 2, SPF 17
>>>> Cost is 42 to reach R3 ASBR
R6#sh ip route 172.16.1.0
Routing entry for 172.16.1.0/24
Known via "ospf 1", distance 110, metric 20, type extern 2, forward metric 42
Last update from 192.168.16.1 on GigabitEthernet0/1, 00:02:13 ago
Routing Descriptor Blocks:
* 192.168.16.1, from 192.168.3.3, 00:02:13 ago, via GigabitEthernet0/1
Route metric is 20, traffic share count is 1
R1優先使用R4通告的路由,儘管其開銷較高,因為它是ASBR的區域內路由。路由不會通過主幹區域,而下一跳是R6(根據RFC 2328)。
R1-NXOS# sh ip ospf border-routers
OSPF Process ID 1 VRF default, Internal Routing Table
Codes: i - Intra-area route, I - Inter-area route
intra 192.168.2.2 [40], ABR, Area 0.0.0.0, SPF 18
via 192.168.12.2, Eth4/43
inter 192.168.3.3 [41], ASBR, Area 0.0.0.0, SPF 18 >>>> Cost is 41
via 192.168.12.2, Eth4/43
intra 192.168.4.4 [91], ASBR, Area 0.0.0.2, SPF 18 >>>> Cost is 91
via 192.168.16.6, Eth4/44
switch-R1-NXOS# sh ip route 172.16.1.0
IP Route Table for VRF "default"
'*' denotes best ucast next-hop
'**' denotes best mcast next-hop
'[x/y]' denotes [preference/metric]
'%' in via output denotes VRF
172.16.1.0/24, ubest/mbest: 1/0
*via 192.168.16.6, Eth4/44, [110/20], 00:10:41, ospf-1, type-2
這會導致網路中出現環路,因為R6將資料包傳送到R1,而R1將這些資料包傳送回R6。
R5#traceroute 172.16.1.1 numeric
Type escape sequence to abort.
Tracing the route to 172.16.1.1
VRF info: (vrf in name/id, vrf out name/id)
1 192.168.56.6 4 msec 0 msec 0 msec
2 192.168.16.1 4 msec 0 msec 4 msec
3 192.168.16.6 0 msec 4 msec 0 msec
4 192.168.16.1 4 msec 0 msec 4 msec
5 192.168.16.6 0 msec 4 msec 0 msec
如您所見,資料包在R1和R6之間循環。為了解決此問題,您需要更改NXOS上的RFC相容性。
R1-NXOS(config)# router ospf 1
R1-NXOS(config-router)# rfc1583compatibility
switch-R1-NXOS# sh ip route 172.16.1.0
IP Route Table for VRF "default"
'*' denotes best ucast next-hop
'**' denotes best mcast next-hop
'[x/y]' denotes [preference/metric]
'%' in via output denotes VRF
172.16.1.0/24, ubest/mbest: 1/0
*via 192.168.12.2, Eth4/43, [110/20], 00:00:40, ospf-1, type-2
現在,R1正確將其指向R2,並從網路中刪除環路。
R5#traceroute 172.16.1.1 numeric
Type escape sequence to abort.
Tracing the route to 172.16.1.1
VRF info: (vrf in name/id, vrf out name/id)
1 192.168.56.6 0 msec 4 msec 0 msec
2 192.168.16.1 0 msec 0 msec 0 msec
3 192.168.12.2 4 msec 0 msec 0 msec
4 192.168.23.3 4 msec 0 msec 4 msec
5 192.168.23.3 4 msec 0 msec 4 msec
R1收到來自R6的NSSA-External(第7類)路由和來自R2的External(第5類)路由(具有相同的字首172.16.1.0/24)。R1更喜歡第7類,不過通常在OSPF中第5類優先於第7類。
R1-NXOS# sh ip ospf database nssa-external 172.16.1.0 detail
OSPF Router with ID (192.168.1.1) (Process ID 1 VRF default)
Type-7 AS External Link States (Area 0.0.0.2)
LS age: 914
Options: 0x28 (No TOS-capability, Type 7/5 translation, DC)
LS Type: Type-7 AS-External
Link State ID: 172.16.1.0 (Network address)
Advertising Router: 192.168.4.4 >>>>> Type 7 originated by R4
and installed in the RIB.
LS Seq Number: 0x80000001
Checksum: 0x3696
Length: 36
Network Mask: /24
Metric Type: 2 (Larger than any link state path)
TOS: 0
Metric: 20
Forward Address: 192.168.45.4
External Route Tag: 0>
R1-NXOS# sh ip ospf database external 172.16.1.0 detail
OSPF Router with ID (192.168.1.1) (Process ID 1 VRF default)
Type-5 AS External Link States
LS age: 853
Options: 0x2 (No TOS-capability, No DC)
LS Type: Type-5 AS-External
Link State ID: 172.16.1.0 (Network address)
Advertising Router: 192.168.1.1 >>>>> Since Type 7 is installed
in the RIB, it was converted to type 5
LS Seq Number: 0x80000001
Checksum: 0xb545
Length: 36
Network Mask: /24
Metric Type: 2 (Larger than any link state path)
TOS: 0<
Metric: 20
Forward Address: 192.168.45.4
External Route Tag: 0<
LS age: 596
Options: 0x20 (No TOS-capability, DC)
LS Type: Type-5 AS-External
Link State ID: 172.16.1.0 (Network address)
Advertising Router: 192.168.3.3 >>>>>> Type 5 is also received from R3
LS Seq Number: 0x80000002
Checksum: 0x2250
Length: 36
Network Mask: /24
Metric Type: 2 (Larger than any link state path)>
TOS: 0
Metric: 20<>
Forward Address: 0.0.0.0
External Route Tag: 0
R1-NXOS# sh ip route 172.16.1.0
IP Route Table for VRF "default"
'*' denotes best ucast next-hop
'**' denotes best mcast next-hop
'[x/y]' denotes [preference/metric]
'%<string>' in via output denotes VRF <string>
172.16.1.0/24, ubest/mbest: 1/0
*via 192.168.16.6, Eth4/44, [110/20], 00:16:54, ospf-1, nssa type-2 >>>> Type 7
route is installed in RIB.
由於R1沒有在OSPF路由器進程下配置rfc1583相容性命令,並且路由的第5類鏈路狀態通告(LSA)adv-router-id可以在區域0(主幹路由器)訪問,因此OSPF始終通過非主幹區域為路由選擇路徑。在本例中,在區域2中選擇下一跳(根據RFC 2328)。
R1-NXOS(config)# router ospf 1
R1-NXOS(config-router)# rfc1583compatibility
R1-NXOS# sh ip route 172.16.1.0
IP Route Table for VRF "default"
'*' denotes best ucast next-hop
'**' denotes best mcast next-hop
'[x/y]' denotes [preference/metric]
'%<string>' in via output denotes VRF <string>
172.16.1.0/24, ubest/mbest: 1/0
*via 192.168.12.2, Eth4/43, [110/20], 00:00:04, ospf-1, type-2 >>>> Type 5
route is installed in RIB.
還有其它設計方案或網路方案,如果網路的NXOS和Cisco IOS與OSPFv2一起運行,則此相容性問題可能導致網路中出現環路或路由不佳。
如果網路包含僅支援RFC1583(即Cisco IOS)的裝置,思科建議在NXOS OSPF路由器配置模式下使用RFC 1583相容性命令。
目前沒有適用於此組態的驗證程序。
目前尚無適用於此組態的具體疑難排解資訊。