簡介
本檔案將介紹非廣播連結上的開放最短路徑優先(OSPF)的初始組態。
背景資訊
在幀中繼、X.25、ATM和交換式多百萬位元資料服務(SMDS)等非廣播媒體上,OSPF可以在兩種模式下執行:
-
非廣播多重存取(NBMA):通過選擇指定路由器(DR)和備份指定路由器(BDR)來模擬廣播模型。在NBMA網路上模擬廣播模型的方法有兩種:使用ip ospf network broadcast interface子命令將網路型別定義為廣播,或配置使用router ospf命令的neighbor語句。
-
點對多點:通過配置ip ospf network point-to-multipoint 命令,將非廣播網路視為點對點鏈路的集合。
必須定義非廣播網路上的網路型別,以避免配置neighbor語句。本文檔提供了通過非廣播鏈路的OSPF配置示例。使用show ip ospf interface 命令檢查運行OSPF的介面的網路型別,並使用show ip ospf neighbor 命令瞭解鄰居路由器的狀態。
必要條件
需求
Cisco建議您瞭解OSPF路由協定的基本配置。
採用元件
本文中的資訊係根據以下軟體和硬體版本:
本文中的資訊是根據特定實驗室環境內的裝置所建立。文中使用到的所有裝置皆從已清除(預設)的組態來啟動。如果您的網路運作中,請確保您瞭解任何指令可能造成的影響。
網路圖表
以下是本檔案中的組態範例中使用的網路圖表。
NBMA配置(使用網路型別廣播)
Router1 |
interface Loopback0
ip address 192.0.2.3 255.255.255.255
!
!
interface Serial2
ip address 192.0.2.1 255.255.255.0
encapsulation frame-relay
ip ospf network broadcast
no keepalive
frame-relay map ip 192.0.2.1 16 broadcast
!
!
router ospf 1
network 192.0.2.0 0.0.0.255 area 0 |
Router2 |
interface Loopback0
ip address 192.0.2.2 255.255.255.255
!
interface Serial1/0
ip address 192.0.2.1 255.255.255.0
encapsulation frame-relay
ip ospf network broadcast
no keepalive
clockrate 2000000
frame-relay map ip 192.0.2.1 16 broadcast
!
router ospf 1
network 192.0.2.0 0.0.0.255 area 0
! |
驗證提示
以下是Router1的show命令輸出。
Router1# show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.0.2.2 1 FULL/BDR 00:00:37 192.0.2.1 Serial2
Router1# show ip ospf interface s2
Serial2 is up, line protocol is up
Internet Address 192.0.2.1/24, Area 0
Process ID 1, Router ID 192.0.2.3, Network Type BROADCAST, Cost: 64
Transmit Delay is 1 sec, State DR, Priority 1
Designated Router (ID) 192.0.2.3, Interface address 192.0.2.1
Backup Designated router (ID) 192.0.2.2, Interface address 192.0.2.1
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
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 4 msec
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 192.0.2.2 (Backup Designated Router)
Suppress hello for 0 neighbor(s)
Router2的輸出如下。
Router2# show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.0.2.3 1 FULL/DR 00:00:38 192.0.2.1 Serial1/0
Router2# show ip ospf interface s1/0
Serial1/0 is up, line protocol is up
Internet Address 192.0.2.1/24, Area 0
Process ID 1, Router ID 192.0.2.2, Network Type BROADCAST, Cost: 64
Transmit Delay is 1 sec, State BDR, Priority 1
Designated Router (ID) 192.0.2.3, Interface address 192.0.2.1
Backup Designated router (ID) 192.0.2.2, Interface address 192.0.2.1
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
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 2
Last flood scan time is 0 msec, maximum is 4 msec
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 192.0.2.3 (Designated Router)
Suppress hello for 0 neighbor(s)
NBMA的配置(使用Neighbor語句)
Router1 |
interface Loopback0
ip address 192.0.2.3 255.255.255.255
!
interface Serial2
ip address 192.0.2.1 255.255.255.0
encapsulation frame-relay
ip ospf priority 2
no keepalive
frame-relay map ip 192.0.2.1 16
!
router ospf 1
network 192.0.2.0 0.0.0.255 area 0
neighbor 192.0.2.1
! |
Router2 |
interface Loopback0
ip address 192.0.2.2 255.255.255.255
!
interface Serial1/0
ip address 192.0.2.1 255.255.255.0
encapsulation frame-relay
no keepalive
clockrate 2000000
frame-relay map ip 192.0.2.1 16
!
router ospf 1
network 192.0.2.0 0.0.0.255 area 0
neighbor 192.0.2.1
! |
註:在剛才顯示的配置中,Router1上的ip ospf priority 2命令將介面優先順序設定為比預設優先順序值1更高的優先順序,這使它成為NBMA網路的DR,而Router2成為BDR。如果需要,您可以將優先順序值設定為0,以便將路由器配置為永不成為DR/BDR。在必須配置中心以成為DR的集中星型網路中,這是必需的,其中as輻條既不能是DR也不能是BDR。雖然在一端上設定neighbor語句足以形成鄰接關係,但最好在兩端都設定該語句,如圖所示。此外,frame-relay map命令不需要具有broadcast引數,因為OSPF資料包使用neighbor語句進行單播。
驗證提示
以下是Router1的show命令輸出。
Router1# show ip ospf neighbors
Neighbor ID Pri State Dead Time Address Interface
192.0.2.2 1 FULL/BDR 00:01:39 192.0.2.1 Serial2
Router1# show ip ospf interface s2
Serial2 is up, line protocol is up
Internet Address 192.0.2.1/24, Area 0
Process ID 1, Router ID 192.0.2.3, Network Type NON_BROADCAST, Cost: 64
Transmit Delay is 1 sec, State DR, Priority 1
Designated Router (ID) 192.0.2.3, Interface address 192.0.2.1
Backup Designated router (ID) 192.0.2.2, Interface address 192.0.2.1
Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5
Hello due in 00:00:19
Index 1/1, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 2, 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 192.0.2.2 (Backup Designated Router)
Suppress hello for 0 neighbor(s)
Router2的輸出如下。
Router2# show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.0.2.3 1 FULL/DR 00:01:49 192.0.2.1 Serial1/0
Router2# show ip ospf interface s1/0
Serial1/0 is up, line protocol is up
Internet Address 192.0.2.1/24, Area 0
Process ID 1, Router ID 192.0.2.2, Network Type NON_BROADCAST, Cost: 64
Transmit Delay is 1 sec, State BDR, Priority 1
Designated Router (ID) 192.0.2.3, Interface address 192.0.2.1
Backup Designated router (ID) 192.0.2.2, Interface address 192.0.2.1
Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5
Hello due in 00:00:01
Index 1/1, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 2, 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 192.0.2.3 (Designated Router)
Suppress hello for 0 neighbor(s)
點對多點配置
Router1 |
interface Loopback0
ip address 192.0.2.3 255.255.255.255
!
interface Serial2
ip address 192.0.2.1 255.255.255.0
encapsulation frame-relay
ip ospf network point-to-multipoint
no keepalive
frame-relay map ip 192.0.2.1 16 broadcast
!
router ospf 1
network 192.0.2.0 0.0.0.255 area 0
! |
Router2 |
interface Loopback0
ip address 192.0.2.2 255.255.255.255
!
interface Serial1/0
ip address 192.0.2.1 255.255.255.0
encapsulation frame-relay
ip ospf network point-to-multipoint
no keepalive
clockrate 2000000
frame-relay map ip 192.0.2.1 16 broadcast
!
router ospf 1
network 192.0.2.0 0.0.0.255 area 0 |
驗證提示
以下是Router1的show命令輸出。
Router1# show ip ospf neighbors
Neighbor ID Pri State Dead Time Address Interface
192.0.2.2 1 FULL/ - 00:01:53 192.0.2.1 Serial2
Router1# show ip ospf interface s2
Serial2 is up, line protocol is up
Internet Address 192.0.2.1/24, Area 0
Process ID 1, Router ID 192.0.2.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
Hello due in 00:00:18
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 192.0.2.2
Suppress hello for 0 neighbor(s)
Router2的輸出如下。
Router2# show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.0.2.3 1 FULL/ - 00:01:58 192.0.2.1 Serial1/0
Router2# show ip ospf interface s1/0
Serial1/0 is up, line protocol is up
Internet Address 192.0.2.1/24, Area 0
Process ID 1, Router ID 192.0.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
Hello due in 00:00:18
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 192.0.2.3
Suppress hello for 0 neighbor(s)
註:如輸出所示,當NBMA網路配置為點對多點時,沒有選擇DR和BDR,因為它被視為點對點鏈路的集合。
有關詳細資訊,請參閱配置OSPF。
相關資訊