本產品的文件集力求使用無偏見用語。針對本文件集的目的,無偏見係定義為未根據年齡、身心障礙、性別、種族身分、民族身分、性別傾向、社會經濟地位及交織性表示歧視的用語。由於本產品軟體使用者介面中硬式編碼的語言、根據 RFP 文件使用的語言,或引用第三方產品的語言,因此本文件中可能會出現例外狀況。深入瞭解思科如何使用包容性用語。
思科已使用電腦和人工技術翻譯本文件,讓全世界的使用者能夠以自己的語言理解支援內容。請注意,即使是最佳機器翻譯,也不如專業譯者翻譯的內容準確。Cisco Systems, Inc. 對這些翻譯的準確度概不負責,並建議一律查看原始英文文件(提供連結)。
本檔案將說明在OSPF(開放最短路徑優先)網域中,ASBR(自治系統邊界路由器)為外部LSA(連結狀態通告)選擇轉送位址所使用的概念。
本文檔的讀者應瞭解以下主題:
本文件所述內容不限於特定軟體和硬體版本。
本文中的資訊是根據特定實驗室環境內的裝置所建立。文中使用到的所有裝置皆從已清除(預設)的組態來啟動。如果您的網路正在作用,請確保您已瞭解任何指令可能造成的影響。
以下影象將用作文檔其餘部分的示例拓撲。
R3正在使用路由對映將網路192.168.20.0/24重分發到OSPF NSSA(非純末梢區域)。您可以使用任何將路由重分發到OSPF域的方法。
R3的相關配置:
router ospf 1
router-id 192.168.3.3
area 1 nssa
redistribute connected metric-type 1 subnets route-map CONN
network 10.143.31.0 0.0.0.255 area 1
route-map CONN, permit, sequence 10
Match clauses:
interface Ethernet0/1
Set clauses:
Policy routing matches: 0 packets, 0 bytes
interface Ethernet0/1
ip address 192.168.20.1 255.255.255.0
不同路由器之間的OSPF鄰居關係:
R1#sh ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.3.3 0 FULL/ - 00:00:38 10.143.31.234 Ethernet0/2
R2#sh ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.3.3 0 FULL/ - 00:00:36 10.143.31.230 Ethernet0/0
R3#sh ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.1.1 0 FULL/ - 00:00:34 10.143.31.233 Ethernet0/2
192.168.2.2 0 FULL/ - 00:00:30 10.143.31.229 Ethernet0/0
如果檢視R1和R2上外部路由「192.168.20.0」的度量,您會發現在R1上看到度量為30,在R2上看到度量為40。即使它們以相同的方式連線到R3,兩者也存在差異。
R1#sh ip route 192.168.20.0
Routing entry for 192.168.20.0/24
Known via "ospf 1", distance 110, metric 30, type NSSA extern 1
Last update from 10.143.31.234 on Ethernet0/2, 00:00:31 ago
Routing Descriptor Blocks:
* 10.143.31.234, from 192.168.3.3, 00:00:31 ago, via Ethernet0/2
Route metric is 30, traffic share count is 1
R2#sh ip route 192.168.20.0
Routing entry for 192.168.20.0/24
Known via "ospf 1", distance 110, metric 40, type NSSA extern 1
Last update from 10.143.31.230 on Ethernet0/0, 00:00:26 ago
Routing Descriptor Blocks:
* 10.143.31.230, from 192.168.3.3, 00:00:26 ago, via Ethernet0/0
Route metric is 40, traffic share count is 1
R1和R2上此字首的LSA資訊:
R1#sh ip ospf database nssa-external
OSPF Router with ID (192.168.1.1) (Process ID 1)
Type-7 AS External Link States (Area 1)
Routing Bit Set on this LSA in topology Base with MTID 0
LS age: 334
Options: (No TOS-capability, Type 7/5 translation, DC, Upward)
LS Type: AS External Link
Link State ID: 192.168.20.0 (External Network Number )
Advertising Router: 192.168.3.3
LS Seq Number: 80000003
Checksum: 0xA0E3
Length: 36
Network Mask: /24
Metric Type: 1 (Comparable directly to link state metric)
MTID: 0
Metric: 20
Forward Address: 10.143.31.234
External Route Tag: 0
R2#sh ip ospf database nssa-external
OSPF Router with ID (192.168.2.2) (Process ID 1)
Type-7 AS External Link States (Area 1)
Routing Bit Set on this LSA in topology Base with MTID 0
LS age: 352
Options: (No TOS-capability, Type 7/5 translation, DC, Upward)
LS Type: AS External Link
Link State ID: 192.168.20.0 (External Network Number )
Advertising Router: 192.168.3.3
LS Seq Number: 80000003
Checksum: 0xA0E3
Length: 36
Network Mask: /24
Metric Type: 1 (Comparable directly to link state metric)
MTID: 0
Metric: 20
Forward Address: 10.143.31.234
External Route Tag: 0
您可以看到,第7類LSA的轉發地址在R1和R2上相同。此外,此轉發地址屬於R3和R1之間的介面。此轉發地址對於R1是直接連線的,但是對於R2,可以通過R3到達。這意味著對於R2,轉發地址是額外的一跳。
如果R3選擇R3和R2之間鏈路的IP地址作為轉發地址,則R1上會出現類似的情況。
使用以下規則在ASBR上選擇轉發地址:
R3#sh ip ospf interface brief
Interface PID Area IP Address/Mask Cost State Nbrs F/C
Et0/2 1 1 10.143.31.234/30 10 P2P 1/1
Et0/0 1 1 10.143.31.230/30 10 P2P 1/1
Et0/2顯示在「show ip ospf interface brief」的頂部,這就是選擇其IP地址作為轉發地址的原因。
將Et0/0的配置更改為預設配置會使其從OSPF分離。再次新增配置會將其連線回OSPF。 在此之後,Et0/0將列在「show ip ospf interface brief」輸出的頂部。
R3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#
R3(config)#default interface e0/0
Interface Ethernet0/0 set to default configuration
*Aug 3 11:25:47.625: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.2.2 on Ethernet0/0 from FULL to DOWN, Neighbor Down: Interface down or detached
R3(config)#interface Ethernet0/0
R3(config-if)# ip address 10.143.31.230 255.255.255.252
R3(config-if)# ip ospf network point-to-point
R3(config-if)#end
R3#*Aug 3 11:26:03.995: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.2.2 on Ethernet0/0 from LOADING to FULL, Loading Done
R3#sh ip ospf interface brief
Interface PID Area IP Address/Mask Cost State Nbrs F/C
Et0/0 1 1 10.143.31.230/30 10 P2P 1/1
Et0/2 1 1 10.143.31.234/30 10 P2P 1/1
此更改將導致轉發地址重新計算為Et0/0上配置的IP地址的地址。
R1#sh ip ospf database nssa-external
OSPF Router with ID (192.168.1.1) (Process ID 1)
Type-7 AS External Link States (Area 1)
Routing Bit Set on this LSA in topology Base with MTID 0
LS age: 284
Options: (No TOS-capability, Type 7/5 translation, DC, Upward)
LS Type: AS External Link
Link State ID: 192.168.20.0 (External Network Number )
Advertising Router: 192.168.3.3
LS Seq Number: 80000004
Checksum: 0x6621
Length: 36
Network Mask: /24
Metric Type: 1 (Comparable directly to link state metric)
MTID: 0
Metric: 20
Forward Address: 10.143.31.230
External Route Tag: 0
R2#sh ip ospf database nssa-external
OSPF Router with ID (192.168.2.2) (Process ID 1)
Type-7 AS External Link States (Area 1)
Routing Bit Set on this LSA in topology Base with MTID 0
LS age: 303
Options: (No TOS-capability, Type 7/5 translation, DC, Upward)
LS Type: AS External Link
Link State ID: 192.168.20.0 (External Network Number )
Advertising Router: 192.168.3.3
LS Seq Number: 80000004
Checksum: 0x6621
Length: 36
Network Mask: /24
Metric Type: 1 (Comparable directly to link state metric)
MTID: 0
Metric: 20
Forward Address: 10.143.31.230
External Route Tag: 0
現在,「show ip route」的輸出將顯示到達R1上外部路由的度量是40,R2上是30。這與前面的輸出相反。
R1#sh ip route 192.168.20.0
Routing entry for 192.168.20.0/24
Known via "ospf 1", distance 110, metric 40, type NSSA extern 1
Last update from 10.143.31.234 on Ethernet0/2, 00:06:14 ago
Routing Descriptor Blocks:
* 10.143.31.234, from 192.168.3.3, 00:06:14 ago, via Ethernet0/2
Route metric is 40, traffic share count is 1
R2#sh ip route 192.168.20.0
Routing entry for 192.168.20.0/24
Known via "ospf 1", distance 110, metric 30, type NSSA extern 1
Last update from 10.143.31.230 on Ethernet0/0, 00:06:29 ago
Routing Descriptor Blocks:
* 10.143.31.230, from 192.168.3.3, 00:06:29 ago, via Ethernet0/0
Route metric is 30, traffic share count is 1
這種更改可能是不可預測的,並且會導致網路收斂,因此建議使用環回IP地址作為轉發地址。
R3(config)#int lo0
R3(config-if)#ip address 192.168.3.3 255.255.255.255
R3(config-if)#router ospf 1
R3(config-router)#network 192.168.3.3 0.0.0.0 area 1
R3(config-router)#end
這也會導致R1和R2上的度量相等:
R1#sh ip ospf database nssa-external
OSPF Router with ID (192.168.1.1) (Process ID 1)
Type-7 AS External Link States (Area 1)
Routing Bit Set on this LSA in topology Base with MTID 0
LS age: 1
Options: (No TOS-capability, Type 7/5 translation, DC, Upward)
LS Type: AS External Link
Link State ID: 192.168.20.0 (External Network Number )
Advertising Router: 192.168.3.3
LS Seq Number: 80000005
Checksum: 0x872F
Length: 36
Network Mask: /24
Metric Type: 1 (Comparable directly to link state metric)
MTID: 0
Metric: 20
Forward Address: 192.168.3.3
External Route Tag: 0
R1#sh ip route 192.168.20.0
Routing entry for 192.168.20.0/24
Known via "ospf 1", distance 110, metric 31, type NSSA extern 1
Last update from 10.143.31.234 on Ethernet0/2, 00:01:27 ago
Routing Descriptor Blocks:
* 10.143.31.234, from 192.168.3.3, 00:01:27 ago, via Ethernet0/2
Route metric is 31, traffic share count is 1
R2#sh ip ospf database nssa-external
OSPF Router with ID (192.168.2.2) (Process ID 1)
Type-7 AS External Link States (Area 1)
Routing Bit Set on this LSA in topology Base with MTID 0
LS age: 6
Options: (No TOS-capability, Type 7/5 translation, DC, Upward)
LS Type: AS External Link
Link State ID: 192.168.20.0 (External Network Number )
Advertising Router: 192.168.3.3
LS Seq Number: 80000005
Checksum: 0x872F
Length: 36
Network Mask: /24
Metric Type: 1 (Comparable directly to link state metric)
MTID: 0
Metric: 20
Forward Address: 192.168.3.3
External Route Tag: 0
R2#sh ip route 192.168.20.0
Routing entry for 192.168.20.0/24
Known via "ospf 1", distance 110, metric 31, type NSSA extern 1
Last update from 10.143.31.230 on Ethernet0/0, 00:01:57 ago
Routing Descriptor Blocks:
* 10.143.31.230, from 192.168.3.3, 00:01:57 ago, via Ethernet0/0
Route metric is 31, traffic share count is 1
附註:有關外部LSA的非零轉發地址的詳細資訊,請參閱OSPF轉發地址的常見路由問題。