简介
 
   本文档介绍在非广播链路上的开放最短路径优先(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配置(使用邻居语句)
 
    
     
      
      | 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语句足以形成邻接关系,但最好在两端都配置该语句,如下所示。并且,因为 OSPF 数据包是使用 neighbor 语句进行单播的,所以 frame-relay map 命令不需要包含 broadcast 参数。
 
    
   验证提示
 
   这是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。
 
    
   相关信息