本檔案將提供透過訊框中繼子介面的開放最短路徑優先(OSPF)組態範例。
嘗試此組態之前,請確保符合以下要求:
對幀中繼和OSPF配置的基本瞭解
有關詳細資訊,請參閱配置OSPF和配置幀中繼和對其進行故障排除。
本文中的資訊係根據以下軟體和硬體版本:
思科2503路由器
兩台路由器上的Cisco IOS®軟體版本12.3(3)
本文中的資訊是根據特定實驗室環境內的裝置所建立。文中使用到的所有裝置皆從已清除(預設)的組態來啟動。如果您的網路正在作用,請確保您已瞭解任何指令可能造成的影響。
如需文件慣例的詳細資訊,請參閱思科技術提示慣例。
要配置網路上的OSPF並對其進行故障排除,您必須充分瞭解底層網路拓撲。鄰居發現機制、指定路由器(DR)和備用指定路由器(BDR)的選擇以及更新泛洪都取決於它。底層第2層拓撲可以是以下拓撲之一:
廣播多路訪問(例如,乙太網) — 廣播網路允許通過網路傳送廣播或組播資料包,因此每台裝置都可以直接與網段中的其它裝置通訊。多路訪問網路是連線兩台以上裝置的網路。有關詳細資訊,請參閱廣播介質OSPF的初始配置。
點對點(例如具有點對點及高階資料連結控制(PPP/HDLC)的序列連結) — 點對點網路也允許透過網路傳送廣播或多點傳送封包,而且這些網路僅連線區段上的兩部裝置。有關詳細資訊,請參閱點對點鏈路上的OSPF初始配置。
非廣播多路訪問(NBMA),如幀中繼 — 這些網路不支援廣播或組播,但可以連線多個裝置,並且本質上為多路訪問。有關詳細資訊,請參閱非廣播鏈路上的OSPF初始配置。
點對多點 — 這是網段上不同裝置之間的點對點鏈路的集合。這些網路還允許通過網路傳送廣播或組播資料包。這些網路可以將多接入網段表示為連線網段上所有裝置的多個點對點鏈路。
在網路上運行OSPF時,在交換路由資訊之前會發生兩個重要事件:
使用組播hello資料包發現鄰居。
為每個多路訪問網路選擇DR和BDR,以最佳化鄰接構建過程。該網段中的所有路由器應該能夠直接與DR和BDR通訊以實現適當的鄰接關係(在點對點網路的情況下,不需要使用DR和BDR,因為網段中只有兩台路由器,因此不會進行選舉)。
要在網段上成功發現鄰居,網路必須允許傳送廣播或組播資料包。
在廣播多路訪問第2層拓撲中,支援廣播;因此,運行OSPF的路由器可以自動發現OSPF鄰居,並選擇任何路由器作為DR和BDR,因為任何裝置都可以與該廣播網段中的所有其它路由器通訊。
在點對點拓撲中,鄰居是自動發現的,因為鄰居通過點對點鏈路直接彼此連線,並且廣播或組播資料包通過網路轉發;但是,DR和BDR選舉不會如前所述那樣進行。
在NBMA網路拓撲中(本質上為非廣播),不會自動發現鄰居。由於網路的多路訪問性質,OSPF嘗試選舉DR和BDR,但選舉失敗,因為未發現鄰居。必須手動配置鄰居才能解決這些問題。此外,在中心輻射型拓撲中需要進行額外配置,以確保與所有其他輻射型路由器都保持連線的中心路由器被選為DR和BDR。或者,您可以更改NBMA介面上的配置,使OSPF相信它是另一種沒有這些問題的網路型別。
正確配置是正確運行OSPF所必需的。
幀中繼子介面可以在兩種模式下運行:
點對點 — 配置幀中繼點對點子介面時,子介面模擬點對點網路,OSPF將其視為點對點網路型別。
多點 — 配置幀中繼多點子介面時,OSPF將此子介面視為NBMA網路型別。
Cisco IOS軟體使用ip ospf network 命令允許靈活地在不同模式下在介面上運行OSPF:
ip ospf network {broadcast |非廣播 | {點對多點[非廣播] |點對點}}
本文檔的配置部分包含幀中繼點對點子介面上的OSPF、帶有廣播、非廣播和點對多點網路的幀中繼上的OSPF多點子介面的配置示例。
本節提供用於設定本文件中所述功能的資訊。
註:使用Command Lookup Tool(僅限註冊客戶)查詢有關本文檔中使用的命令的更多資訊。
本檔案使用下列網路設定:
本文檔使用本節中顯示的配置。
R4-2503 |
---|
interface Loopback0 ip address 3.3.3.3 255.255.255.255 ! interface Serial0 no ip address encapsulation frame-relay !--- To enable Frame Relay encapsulation !--- on the interface. no keepalive ! interface Serial0.1 point-to-point !--- The subinterface is configured to !--- function as a point-to-point link !--- with this command. ip address 1.1.1.2 255.255.255.0 frame-relay interface-dlci 16 !--- To assign a data-link connection identifier !--- (DLCI) to a specified Frame Relay subinterface. !--- Without this command, all the DLCIs are assigned !--- to the physical interface. ! router ospf 1 network 1.1.1.0 0.0.0.255 area 0 ! |
R1-2503 |
---|
interface Loopback0 ip address 2.2.2.2 255.255.255.255 ! interface Serial0 no ip address encapsulation frame-relay !--- To enable Frame Relay encapsulation on !--- the interface. no keepalive clockrate 2000000 ! interface Serial0.1 point-to-point !--- The subinterface is configured to function !--- as a point-to-point link with this command. ip address 1.1.1.1 255.255.255.0 frame-relay interface-dlci 16 !--- To assign a data-link connection identifier !--- (DLCI) to a specified Frame Relay subinterface. !--- Without this command, all the DLCIs are !--- assigned to the physical interface. ! router ospf 1 network 1.1.1.0 0.0.0.255 area 0 ! |
此處概述的命令對驗證很有用:
show ip ospf neighbor — 此命令用於顯示OSPF鄰居資訊。
show ip ospf interface — 此命令用於顯示與OSPF相關的介面資訊。
這些命令的輸出如下所示:
R4-2503# show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 2.2.2.2 1 FULL/ - 00:00:33 1.1.1.1 Serial0.1
注意:在此輸出中,OSPF鄰居狀態顯示為「FULL / — 」,但未顯示DR和BDR狀態。這是因為點對點鏈路上沒有DR和BDR選舉。
R4-2503# show ip ospf interface s0 %OSPF: OSPF not enabled on Serial0 R4-2503# show ip ospf interface s0.1 Serial0.1 is up, line protocol is up Internet Address 1.1.1.2/24, Area 0 Process ID 1, Router ID 3.3.3.3, Network Type POINT_TO_POINT, Cost: 64 Transmit Delay is 1 sec, State POINT_TO_POINT, Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 oob-resync timeout 40 Hello due in 00:00:09 Index 1/1, flood queue length 0 Next 0x0(0)/0x0(0) Last flood scan length is 1, maximum is 1 Last flood scan time is 0 msec, maximum is 0 msec Neighbor Count is 1, Adjacent neighbor count is 1 Adjacent with neighbor 2.2.2.2 Suppress hello for 0 neighbor(s) R1-2503# show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 3.3.3.3 1 FULL/ - 00:00:37 1.1.1.2 Serial0.1 R1-2503# show ip ospf interface s0 %OSPF: OSPF not enabled on Serial0 R1-2503# show ip ospf interface s0.1 Serial0.1 is up, line protocol is up Internet Address 1.1.1.1/24, Area 0 Process ID 1, Router ID 2.2.2.2, Network Type POINT_TO_POINT, Cost: 64 Transmit Delay is 1 sec, State POINT_TO_POINT, Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 oob-resync timeout 40 Hello due in 00:00:03 Index 1/1, flood queue length 0 Next 0x0(0)/0x0(0) Last flood scan length is 1, maximum is 1 Last flood scan time is 0 msec, maximum is 0 msec Neighbor Count is 1, Adjacent neighbor count is 1 Adjacent with neighbor 3.3.3.3 Suppress hello for 0 neighbor(s)
在此配置中,使用ip ospf network broadcast命令將網路型別更改為廣播。現在,NBMA網路被視為廣播多路訪問網路,在此網路中進行DR和BDR選舉。frame relay map命令也設定為轉發廣播地址。
R4-2503 |
---|
interface Loopback0 ip address 3.3.3.3 255.255.255.255 ! interface Serial0 no ip address encapsulation frame-relay no keepalive ! interface Serial0.2 multipoint !--- The subinterface is treated as a multipoint link. ip address 1.1.1.2 255.255.255.0 ip ospf network broadcast !--- This command is used to define the network !--- type as broadcast. The network type is defined !--- on non-broadcast networks so as to not configur !--- the neighbors explicitly. frame-relay map ip 1.1.1.1 16 broadcast !--- To define the mapping between a destination !--- protocol address and the data-link connection !--- identifier (DLCI) used to connect to the !--- destination address. The broadcast keyword !--- is used to forward broadcasts and multicasts !--- to this address. ! ! router ospf 1 network 1.1.1.0 0.0.0.255 area 0 ! |
R1-2503 |
---|
interface Loopback0 ip address 2.2.2.2 255.255.255.255 ! ! interface Serial0 no ip address encapsulation frame-relay no keepalive clockrate 2000000 ! interface Serial0.2 multipoint !--- The subinterface is treated as a multipoint link. ip address 1.1.1.1 255.255.255.0 ip ospf network broadcast !--- This command is used to define the network !--- type as broadcast. The network type is defined !--- on non-broadcast networks so as not configure !--- the neighbors explicitly. frame-relay map ip 1.1.1.2 16 broadcast !--- To define the mapping between a !--- destination protocol address and the data-link !--- connection identifier (DLCI) used to connect !--- to the destination address. The broadcast !--- keyword is used to forward broadcasts and multicasts !--- to this address. ! router ospf 1 network 1.1.1.0 0.0.0.255 area 0 ! |
注意:如果子介面配置為點對點介面,則除非重新載入路由器,否則不能將同一子介面重新分配為多點子介面。在這種情況下,多點配置使用不同的子介面。
R4-2503# show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 2.2.2.2 1 FULL/BDR 00:00:32 1.1.1.1 Serial 0.2 R4-2503# show ip ospf interface s0 %OSPF: OSPF not enabled on Serial0 R4-2503# show ip ospf interface s0.2 Serial0.2 is up, line protocol is up Internet Address 1.1.1.2/24, Area 0 Process ID 1, Router ID 3.3.3.3, Network Type BROADCAST, Cost: 64 Transmit Delay is 1 sec, State DR, Priority 1 Designated Router (ID) 3.3.3.3, Interface address 1.1.1.2 Backup Designated router (ID) 2.2.2.2, Interface address 1.1.1.1 Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 oob-resync timeout 40 Hello due in 00:00:05 Index 1/1, flood queue length 0 Next 0x0(0)/0x0(0) Last flood scan length is 1, maximum is 1 Last flood scan time is 0 msec, maximum is 0 msec Neighbor Count is 1, Adjacent neighbor count is 1 Adjacent with neighbor 2.2.2.2 (Backup Designated Router) Suppress hello for 0 neighbor(s) R1-2503# show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 3.3.3.3 1 FULL/DR 00:00:35 1.1.1.2 Serial0.2 R1-2503# show ip ospf interface s0 %OSPF: OSPF not enabled on Serial0 R1-2503# show ip ospf interface s0.2 Serial0.2 is up, line protocol is up Internet Address 1.1.1.1/24, Area 0 Process ID 1, Router ID 2.2.2.2, Network Type BROADCAST, Cost: 64 Transmit Delay is 1 sec, State BDR, Priority 1 Designated Router (ID) 3.3.3.3, Interface address 1.1.1.2 Backup Designated router (ID) 2.2.2.2, Interface address 1.1.1.1 Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 oob-resync timeout 40 Hello due in 00:00:01 Index 1/1, flood queue length 0 Next 0x0(0)/0x0(0) Last flood scan length is 1, maximum is 1 Last flood scan time is 0 msec, maximum is 0 msec Neighbor Count is 1, Adjacent neighbor count is 1 Adjacent with neighbor 3.3.3.3 (Designated Router) Suppress hello for 0 neighbor(s)
在此配置中,網路為非廣播網路,不允許自動發現鄰居。neighbor命令用於手動配置OSPF鄰居。但是,只有低於10.0的Cisco IOS軟體版本才需要使用此命令。作為替代解決方案,發出ip ospf network命令可更改預設網路型別(請參閱使用廣播網路進行多點配置的配置示例)。 有關詳細資訊,請參閱OSPF設計手冊的「避免DR和NBMA上的neighbor命令」部分。DR和BDR是因多路訪問特性而選擇的。
R4-2503 |
---|
interface Loopback0 ip address 3.3.3.3 255.255.255.255 ! interface Serial0 no ip address encapsulation frame-relay no keepalive ! interface Serial0.2 multipoint ip address 1.1.1.2 255.255.255.0 frame-relay map ip 1.1.1.1 16 broadcast ip ospf priority 2 !--- This command assigns a higher priority for this router on this interface, !--- so that it gets elected as the DR. In case of a Hub and Spoke topology, !--- the hub should be elected as the DR as it has connectivity to all the spokes. ! router ospf 1 network 1.1.1.0 0.0.0.255 area 0 ! |
R1-2503 |
---|
interface Loopback0 ip address 2.2.2.2 255.255.255.255 ! interface Serial0 no ip address encapsulation frame-relay no keepalive clockrate 2000000 ! interface Serial0.2 multipoint ip address 1.1.1.1 255.255.255.0 frame-relay map ip 1.1.1.2 16 broadcast ! router ospf 1 network 1.1.1.0 0.0.0.255 area 0 neighbor 1.1.1.2 !--- Used to manually configure neighbors. |
R4-2503# show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 2.2.2.2 1 FULL/BDR 00:01:56 1.1.1.1 Serial0.2 R4-2503# show ip ospf interface s0 %OSPF: OSPF not enabled on Serial0 R4-2503# show ip ospf interface s0.2 Serial0.2 is up, line protocol is up Internet Address 1.1.1.2/24, Area 0 Process ID 1, Router ID 3.3.3.3, Network Type NON_BROADCAST, Cost: 64 Transmit Delay is 1 sec, State DR,Priority 2 Designated Router (ID) 3.3.3.3, Interface address 1.1.1.2 Backup Designated router (ID) 2.2.2.2, Interface address 1.1.1.1 Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5 oob-resync timeout 40 Hello due in 00:00:25 Index 1/1, flood queue length 0 Next 0x0(0)/0x0(0) Last flood scan length is 1, maximum is 1 Last flood scan time is 0 msec, maximum is 0 msec Neighbor Count is 1, Adjacent neighbor count is 1 Adjacent with neighbor 2.2.2.2 (Backup Designated Router) Suppress hello for 0 neighbor(s) R1-2503# show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 3.3.3.3 2 FULL/DR 00:01:52 1.1.1.2 Serial0.2 R1-2503# show ip ospf interface s0 %OSPF: OSPF not enabled on Serial0 R1-2503# show ip ospf interface s0.2 Serial0.2 is up, line protocol is up Internet Address 1.1.1.1/24, Area 0 Process ID 1, Router ID 2.2.2.2, Network Type NON_BROADCAST, Cost: 64 Transmit Delay is 1 sec, State BDR, Priority 1 Designated Router (ID) 3.3.3.3, Interface address 1.1.1.2 Backup Designated router (ID) 2.2.2.2, Interface address 1.1.1.1 Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5 oob-resync timeout 40 Hello due in 00:00:01 Index 1/1, flood queue length 0 Next 0x0(0)/0x0(0) Last flood scan length is 1, maximum is 1 Last flood scan time is 0 msec, maximum is 0 msec Neighbor Count is 1, Adjacent neighbor count is 1 Adjacent with neighbor 3.3.3.3 (Designated Router) Suppress hello for 0 neighbor(s)
在此配置中,使用ip ospf network point-to-multipoint命令更改網路型別,以作為點對點鏈路的集合。自動發現鄰居,並且不會進行DR和BDR選舉。
R4-2503 |
---|
interface Loopback0 ip address 3.3.3.3 255.255.255.255 ! interface Serial0 no ip address encapsulation frame-relay no keepalive ! interface Serial0.2 multipoint ip address 1.1.1.2 255.255.255.0 ip ospf network point-to-multipoint !--- To configure an interface as !--- point-to-multipoint for non-broadcast media. frame-relay map ip 1.1.1.1 16 broadcast ! ! router ospf 1 network 1.1.1.0 0.0.0.255 area 0 ! |
R1-2503 |
---|
interface Loopback0 ip address 2.2.2.2 255.255.255.255 ! interface Serial0 no ip address encapsulation frame-relay no keepalive clockrate 2000000 ! interface Serial0.2 multipoint ip address 1.1.1.1 255.255.255.0 ip ospf network point-to-multipoint !--- To configure an interface as !--- point-to-multipoint for non-broadcast media. frame-relay map ip 1.1.1.2 16 broadcast ! router ospf 1 network 1.1.1.0 0.0.0.255 area 0 ! |
R4-2503# show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 2.2.2.2 1 FULL/ - 00:01:58 1.1.1.1 Serial0.2 R4-2503# show ip ospf interface s0 %OSPF: OSPF not enabled on Serial0 R4-2503# show ip ospf interface s0.2 Serial2.1 is up, line protocol is up Internet Address 1.1.1.2/24, Area 0 Process ID 1, Router ID 3.3.3.3, Network Type POINT_TO_MULTIPOINT, Cost: 64 Transmit Delay is 1 sec, State POINT_TO_MULTIPOINT, Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5 oob-resync timeout 40 Hello due in 00:00:07 Index 1/1, flood queue length 0 Next 0x0(0)/0x0(0) Last flood scan length is 1, maximum is 2 Last flood scan time is 0 msec, maximum is 0 msec Neighbor Count is 1, Adjacent neighbor count is 1 Adjacent with neighbor 2.2.2.2 Suppress hello for 0 neighbor(s) R1-2503# show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 3.3.3.3 1 FULL/ - 00:01:49 1.1.1.2 Serial0.2 R1-2503# show ip ospf interface s0 %OSPF: OSPF not enabled on Serial0 R1-2503# show ip ospf interface s0.2 Serial0.2 is up, line protocol is up Internet Address 1.1.1.1/24, Area 0 Process ID 1, Router ID 2.2.2.2, Network Type POINT_TO_MULTIPOINT, Cost: 64 Transmit Delay is 1 sec, State POINT_TO_MULTIPOINT, Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5 oob-resync timeout 40 Hello due in 00:00:00 Index 1/1, flood queue length 0 Next 0x0(0)/0x0(0) Last flood scan length is 1, maximum is 2 Last flood scan time is 0 msec, maximum is 0 msec Neighbor Count is 1, Adjacent neighbor count is 1 Adjacent with neighbor 3.3.3.3 Suppress hello for 0 neighbor(s)
若要驗證您的設定,請使用本檔案Configure部分中提供的小節。
本節提供的資訊可用於對組態進行疑難排解。
在對NBMA網路上的任何與OSPF鄰居相關的問題進行故障排除之前,必須記住,可以使用ip ospf network命令在這些操作模式下配置NBMA網路:
點對點
單點對多點
廣播
NBMA
下表介紹了每種模式的Hello間隔和Dead間隔:
網路型別 | Hello間隔(秒) | 停頓間隔(秒) |
---|---|---|
點對點 | 10 | 40 |
單點對多點 | 30 | 120 |
廣播 | 10 | 40 |
非廣播 | 30 | 120 |
當在幀中繼等非廣播多路訪問技術的物理介面(例如介面S0)上配置OSPF時,將分配預設的網路型別NON_BROADCAST。當在點對點子介面上配置OSPF時,會分配預設介面型別POINT_TO_POINT。在多點子介面上配置OSPF時,會分配預設介面型別NON_BROADCAST。
當NBMA網路由不同路由器上的物理介面和邏輯介面(子介面)組合構成時,不同的OSPF網路型別將發揮作用。這種情況下,可能會發生Hello不匹配;因此,不會形成OSPF鄰接關係。
有關如何排除OSPF故障的詳細資訊,請參閱在幀中繼上的NBMA模式下運行OSPF的問題和排除OSPF。
修訂 | 發佈日期 | 意見 |
---|---|---|
1.0 |
10-Aug-2005 |
初始版本 |