本檔案將說明將連線路由重新分發到開放最短路徑優先(OSPF)的行為。 有兩種行為取決於重分佈連線的網路時是否給定subnet關鍵字。通常,當使用redistribute命令將路由重分發到OSPF域時,路由器會自動成為自治系統邊界路由器(ASBR)。 預設情況下,當使用connected關鍵字將來自協定的路由重分發到OSPF時,這些路由將作為AS外部重分發,並且僅重分發未劃分子網的路由。如果包括subnets關鍵字,OSPF將重新分發已劃分子網的路由。該過程使用20作為預設度量。當使用metric-type關鍵字未指定度量時,會發生這種情況。
嘗試此組態之前,請確保符合以下要求:
通用IP路由知識
瞭解OSPF路由協定概念和術語
本文檔中的配置基於Cisco IOS®軟體版本軟體12.4(15)T 13上的Cisco 3700系列路由器。
本文中的資訊是根據特定實驗室環境內的裝置所建立。文中使用到的所有裝置皆從已清除(預設)的組態來啟動。如果您的網路正在作用,請確保您已瞭解任何指令可能造成的影響。
如需文件慣例的詳細資訊,請參閱思科技術提示慣例。
本節提供用於設定本文件中所述功能的資訊。
路由器R1、R2和R3通過串列介面相互連線,並配置了IP地址。在R1和R3上都建立了一些環回地址用於生成網路。EIGRP在路由器R1和R2上運行,而R3使用OSPF與R1通訊。同時運行EIGRP和OSPF的路由器R2使用redistribute命令將EIGRP路由重分發到OSPF。
註:使用Command Lookup Tool(僅限註冊客戶)查詢有關本文檔中使用的命令的更多資訊。
本檔案會使用以下網路設定:
本檔案會使用以下設定:
路由器R1 |
---|
version 12.4 ! hostname R1 ! ip cef ! interface Loopback0 ip address 10.10.10.10 255.255.255.240 ! interface Loopback1 ip address 20.20.20.20 255.255.255.240 ! interface Loopback2 ip address 30.30.30.30 255.255.255.240 ! interface Serial0/0 ip address 172.16.10.1 255.255.248.0 clock rate 2000000 ! router eigrp 100 network 10.10.10.0 0.0.0.15 network 20.20.20.16 0.0.0.15 network 30.30.30.16 0.0.0.15 network 172.16.8.0 0.0.7.255 no auto-summary !--- Auto-summary is disabled so that !--- the networks are summarized with subnets. ! end |
路由器R2 |
---|
version 12.4 ! hostname R2 ! ip cef ! interface Loopback0 ip address 1.1.1.1 255.255.255.255 ! interface Loopback1 ip address 2.2.2.2 255.255.255.255 ! interface Loopback2 ip address 3.3.3.3 255.255.255.255 ! interface Serial0/0 ip address 172.16.10.2 255.255.248.0 clock rate 2000000 ! interface Serial0/1 ip address 172.16.64.1 255.255.255.0 clock rate 2000000 ! router eigrp 100 network 1.0.0.0 network 3.0.0.0 network 172.16.8.0 0.0.7.255 auto-summary ! router ospf 100 log-adjacency-changes redistribute eigrp 100 redistribute connected network 2.2.2.2 0.0.0.0 area 0 network 172.16.64.0 0.0.0.255 area 0 ! end |
路由器R3 |
---|
version 12.4 ! hostname R3 ! ip cef ! interface Loopback0 ip address 11.1.1.1 255.255.255.255 ! interface Loopback1 ip address 12.1.1.1 255.255.255.255 ! interface Loopback2 ip address 13.1.1.1 255.255.255.255 ! interface Serial0/0 ip address 172.16.64.2 255.255.255.0 clock rate 2000000 ! router ospf 100 log-adjacency-changes network 11.1.1.1 0.0.0.0 area 0 network 12.1.1.1 0.0.0.0 area 0 network 13.1.1.1 0.0.0.0 area 0 network 172.16.64.0 0.0.0.255 area 0 ! end |
使用本節內容,確認您的組態是否正常運作。
輸出直譯器工具(僅供已註冊客戶使用)(OIT)支援某些show命令。使用OIT檢視show命令輸出的分析。
使用show ip route ospf 命令檢驗路由器R3是否已收到重分發路由。
show ip route ospf |
---|
當在路由器R2中通過redistribute connected重新分發連線的路由時:在路由器R3中 R3#show ip route ospf 2.0.0.0/32 is subnetted, 1 subnets O 2.2.2.2 [110/65] via 172.16.64.1, 06:14:14, Serial0/0 !--- Only the classful routes are shown without actual subnets.在路由器R2的redistribute connected subnets中使用subnets關鍵字的規范進行重分發時:在路由器R3中 R3#show ip route ospf 2.0.0.0/32 is subnetted, 1 subnets O 2.2.2.2 [110/65] via 172.16.64.1, 06:14:14, Serial0/0 R3#sh ip route ospf 1.0.0.0/32 is subnetted, 1 subnets O E2 1.1.1.1 [110/20] via 172.16.64.1, 00:00:02, Serial0/0 !--- When routes are redistributed in to OSPF, !--- OSPF uses 20 as the default metric if !--- the metric-type keyword is not mentioned !--- and the routes are redistributed as External Type 2(E2) routes. 2.0.0.0/32 is subnetted, 1 subnets O 2.2.2.2 [110/65] via 172.16.64.1, 06:36:58, Serial0/0 3.0.0.0/32 is subnetted, 1 subnets O E2 3.3.3.3 [110/20] via 172.16.64.1, 00:00:02, Serial0/0 172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks O E2 172.16.8.0/21 [110/20] via 172.16.64.1, 00:00:02, Serial0/0 !--- On specifying the keyword subnets, !--- the routes are reflected along with the subnets. !--- Only the classful routes are shown without actual subnets. |
當使用redistribute eigrp < process id > 命令將EIGRP路由重分發到OSPF時,如果沒有指定metric-type關鍵字,則路由會重分發為E2路由,預設度量為20。
show ip route ospf |
---|
在路由器R2中使用redistribute eigrp 100命令重新分配EIGRP時:在路由器R3中 R3#show ip route ospf O E2 1.0.0.0/8 [110/20] via 172.16.64.1, 00:00:09, Serial0/0 2.0.0.0/32 is subnetted, 1 subnets O 2.2.2.2 [110/65] via 172.16.64.1, 07:03:16, Serial0/0 O E2 3.0.0.0/8 [110/20] via 172.16.64.1, 00:00:09, Serial0/0 172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks O E2 172.16.0.0/16 [110/20] via 172.16.64.1, 00:00:09, Serial0/0 !--- Only classful networks are redistributed by default.在路由器R2的redistribute eigrp 100 subnets命令中指定subnet關鍵字時:在路由器R3中 R3#sh ip route ospf O E2 1.0.0.0/8 [110/20] via 172.16.64.1, 00:06:19, Serial0/0 2.0.0.0/32 is subnetted, 1 subnets O 2.2.2.2 [110/65] via 172.16.64.1, 07:09:26, Serial0/0 O E2 3.0.0.0/8 [110/20] via 172.16.64.1, 00:06:19, Serial0/0 20.0.0.0/28 is subnetted, 1 subnets O E2 20.20.20.16 [110/20] via 172.16.64.1, 00:00:06, Serial0/0 172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks O E2 172.16.0.0/16 [110/20] via 172.16.64.1, 00:06:19, Serial0/0 10.0.0.0/28 is subnetted, 1 subnets O E2 10.10.10.0 [110/20] via 172.16.64.1, 00:00:06, Serial0/0 30.0.0.0/28 is subnetted, 1 subnets O E2 30.30.30.16 [110/20] via 172.16.64.1, 00:00:06, Serial0/0 !--- On specifying the keyword subnets, !--- the subnetted routes are reflected along !--- with their subnet mask. |
修訂 | 發佈日期 | 意見 |
---|---|---|
1.0 |
29-Nov-2011 |
初始版本 |