IP : 开放最短路径优先 (OSPF)

基于非广播型链路的 OSPF 的初始配置

2015 年 8 月 28 日 - 机器翻译
其他版本: PDFpdf | 英语 (2015 年 4 月 22 日) | 反馈


目录


简介

在非广播介质(例如,帧中继、X.25、ATM 和交换式多兆位数据服务 (SMDS))上,OSPF 可以在两种模式下运行:

  • NBMA :通过选择指定路由器 (DR) 和备用指定路由器 (BDR) 模拟广播模型。在 NBMA 网络上模拟广播模型的方式有两种:使用 ip ospf network broadcast 接口子命令将网络类型定义为广播,或者使用 router ospf 命令配置邻居语句。

  • 单点对多点:通过配置 ip ospf network point-to-multipoint 命令,将非广播网络视为点对点链路的集合。

您必须在非广播网络上定义网络类型以避免配置邻居语句。下面是非广播链路上的 OSPF 的配置示例。请使用 show ip ospf interface 命令检查运行 OSPF 的接口的网络类型,并使用 show ip ospf neighbor 命令了解邻居路由器的状态。

先决条件

要求

本文档要求您了解 Open Shortest Path First (OSPF) 路由协议的基本配置。

使用的组件

本文档中的信息基于以下软件和硬件版本:

  • Cisco 2500 路由器

  • Cisco IOS 在路由器的软件版本12.2(24a)运行

本文档中的信息都是基于特定实验室环境中的设备创建的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您是在真实网络上操作,请确保您在使用任何命令前已经了解其潜在影响。

规则

有关文档规则的详细信息,请参阅 Cisco 技术提示规则

网络图

下面是本文档配置示例中使用的网络图。

/image/gif/paws/13690/18a_01.gif

NBMA 的配置(使用网络类型广播)

Router1
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

Router2
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 的配置(使用 Neighbor 语句)

Router1
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
     !

Router2
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,这使得 Router1 成为 NBMA 网络的 DR,Router2 成为该网络的 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)

点对多点的配置

Router1
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
     !

Router2
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

相关的思科支持社区讨论

思科支持社区是您提问、解答问题、分享建议以及与工作伙伴协作的论坛。


相关信息


Document ID: 13690