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

帧中继子接口上的 OSPF 初始配置

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


目录


简介

本文档提供了帧中继子接口上的 Open Shortest Path First (OSPF) 配置示例。

先决条件

要求

在尝试进行此配置之前,请确保满足以下要求:

  • 基本了解帧中继和 OSPF 配置

有关详细信息,请参阅配置 OSPF帧中继的配置与故障排除

使用的组件

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

  • Cisco 2503 路由器

  • Cisco IOS在两路由器的软件版本12.3(3)

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

规则

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

背景信息

要在网络上配置 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|非广播|{{point-to-multipoint [non-broadcast]|point-to-point}}

本文档的配置部分包含帧中继点对点子接口以及具有广播、非广播和单点对多点网络的帧中继多点子接口的 OSPF 配置示例。

配置

本部分提供有关如何配置本文档所述功能的信息。

注意: 有关本文档所用命令的详细信息,请使用命令查找工具仅限注册用户)。

网络图

本文档使用此处所示的网络设置:

/image/gif/paws/13693/22a.gif

配置

本文使用在此部分显示的配置。

点对点配置

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
     !

点对点配置的验证提示

此处概述的命令对于验证十分有用:

这些命令的输出如下所示:

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 邻居。但是,此命令只对早于 Cisco IOS 软件版本 10.0 的软件有效。作为备用解决方案,可发出 ip ospf network 命令更改默认的网络类型(请参阅使用广播网络进行多点配置配置示例)。有关详细信息,请参阅 OSPF 设计指南的“避免在 NBMA 上使用 DR 和 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)

验证

要验证您的配置,请使用本文档配置部分提供的小节。

故障排除

本部分提供的信息可用于对配置进行故障排除。

在您对 NBMA 网络上的任何 OSPF 邻居相关问题进行故障排除之前,请务必记住可以使用 ip ospf network 命令在以下操作模式下配置 NBMA 网络:

  • 点对点

  • 单点对多点

  • 广播

  • NBMA

下表描述了每个模式的 Hello 和 Dead 间隔:

网络类型 Hello 间隔(秒) Dead 间隔(秒)
点对点 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 故障排除

相关的思科支持社区讨论

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


相关信息


Document ID: 13693