简介
本文档提供非广播链路上开放最短路径优先(OSPF)的初始配置。在非广播介质(例如,帧中继、X.25、ATM 和交换式多兆位数据服务 (SMDS))上,OSPF 可以在两种模式下运行:
-
非广播多路访问(NBMA):通过选择指定路由器(DR)和备用指定路由器(BDR)来模拟广播模型。 在 NBMA 网络上模拟广播模型的方式有两种:使用 ip ospf network broadcast 接口子命令将网络类型定义为广播,或者使用 router ospf 命令配置邻居语句。
-
单点对多点:通过配置ip ospf network point-to-multipoint命令,将非广播网络视为点对点链路的集合。
您必须在非广播网络上定义网络类型,以避免配置neighbor语句。本文档提供非广播链路上OSPF的示例配置。使用show ip ospf interface命令检查运行OSPF的接口的网络类型,并使用show ip ospf neighbor命令了解邻居路由器的状态。
先决条件
要求
Cisco建议您了解OSPF路由协议的基本配置。
使用的组件
本文档中的信息基于以下软件和硬件版本:
本文档中的信息都是基于特定实验室环境中的设备创建的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您使用的是真实网络,请确保您已经了解所有命令的潜在影响。
网络图
这是本文档中配置示例中使用的网络图。

NBMA的配置(使用网络类型广播)
路由器1 |
interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
!
interface Serial2
ip address 1.1.1.2 255.255.255.0
encapsulation frame-relay
ip ospf network broadcast
no keepalive
frame-relay map ip 1.1.1.1 16 broadcast
!
!
router ospf 1
network 1.1.1.0 0.0.0.255 area 0 |
路由器2 |
interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface Serial1/0
ip address 1.1.1.1 255.255.255.0
encapsulation frame-relay
ip ospf network broadcast
no keepalive
clockrate 2000000
frame-relay map ip 1.1.1.2 16 broadcast
!
router ospf 1
network 1.1.1.0 0.0.0.255 area 0
! |
验证提示
这是Router1的show命令输出。
Router1# show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 1 FULL/BDR 00:00:37 1.1.1.1 Serial2
Router1# show ip ospf interface s2
Serial2 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
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 2.2.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
3.3.3.3 1 FULL/DR 00:00:38 1.1.1.2 Serial1/0
Router2# show ip ospf interface s1/0
Serial1/0 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
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 3.3.3.3 (Designated Router)
Suppress hello for 0 neighbor(s)
NBMA的配置(使用邻居语句)
路由器1 |
interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
interface Serial2
ip address 1.1.1.2 255.255.255.0
encapsulation frame-relay
ip ospf priority 2
no keepalive
frame-relay map ip 1.1.1.1 16
!
router ospf 1
network 1.1.1.0 0.0.0.255 area 0
neighbor 1.1.1.1
! |
路由器2 |
interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface Serial1/0
ip address 1.1.1.1 255.255.255.0
encapsulation frame-relay
no keepalive
clockrate 2000000
frame-relay map ip 1.1.1.2 16
!
router ospf 1
network 1.1.1.0 0.0.0.255 area 0
neighbor 1.1.1.2
! |
注意:在刚刚显示的配置中,Router1上的ip ospf priority 2 命令设置的接口优先级高于默认优先级值1,这使它成为DR,而Router2成为NBMA网络的BDR。如果需要,可以将优先级值设置为0,以便将路由器配置为永远不成为DR/BDR。这在星型网络中是必要的,在该网络中应该将集线器配置为 DR,分支既不应该是 DR 也不应该是 BDR。虽然在一端配置neighbor语句足以形成邻接关系,但最好在两端都配置该语句,如图所示。并且,因为 OSPF 数据包是使用 neighbor 语句进行单播的,所以 frame-relay map 命令不需要包含 broadcast 参数。
验证提示
这是Router1的show命令输出。
Router1# show ip ospf neighbors
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 1 FULL/BDR 00:01:39 1.1.1.1 Serial2
Router1# show ip ospf interface s2
Serial2 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 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
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 2.2.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
3.3.3.3 1 FULL/DR 00:01:49 1.1.1.2 Serial1/0
Router2# show ip ospf interface s1/0
Serial1/0 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
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 3.3.3.3 (Designated Router)
Suppress hello for 0 neighbor(s)
点对多点的配置
路由器1 |
interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
interface Serial2
ip address 1.1.1.2 255.255.255.0
encapsulation frame-relay
ip ospf network point-to-multipoint
no keepalive
frame-relay map ip 1.1.1.1 16 broadcast
!
router ospf 1
network 1.1.1.0 0.0.0.255 area 0
! |
路由器2 |
interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface Serial1/0
ip address 1.1.1.1 255.255.255.0
encapsulation frame-relay
ip ospf network point-to-multipoint
no keepalive
clockrate 2000000
frame-relay map ip 1.1.1.2 16 broadcast
!
router ospf 1
network 1.1.1.0 0.0.0.255 area 0 |
验证提示
这是Router1的show命令输出。
Router1# show ip ospf neighbors
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 1 FULL/ - 00:01:53 1.1.1.1 Serial2
Router1# show ip ospf interface s2
Serial2 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
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 2.2.2.2
Suppress hello for 0 neighbor(s)
Router2 的输出如下所示。
Router2# show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
3.3.3.3 1 FULL/ - 00:01:58 1.1.1.2 Serial1/0
Router2# show ip ospf interface s1/0
Serial1/0 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
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 3.3.3.3
Suppress hello for 0 neighbor(s)
注意:如输出所示,将 NBMA 网络配置为单点对多点时,没有选择任何 DR 和 BDR,因为会将该网络视为点对点链路的集合。
有关详细信息,请参阅配置OSPF。
相关信息