基于点到点链路的 OSPF 的初始配置 目录 简介先决条件要求使用的组件规则带有串行接口 IP 地址的点对点链路上的 OSPF 网络图配置带有未编号接口的点对点链路上的 OSPF 网络图配置验证验证带有串行接口 IP 地址的 OSPF 的配置验证带有未编号接口的 OSPF 的配置故障排除相关信息 简介 在高级数据链路控制 (HDLC) 和点对点协议 (PPP) 等点对点链路上, 开放最短路径优先 (OSPF) 作为点对点网络类型运行 默认情况下, 此网络类型处于启用状态 本文档给出了点对点链路上 OSPF 的配置示例 OSPF 支持的其他网络类型是单点对多点 广播和非广播 要检查运行 OSPF 的接口的网络类型, 请发出 show ip ospf interface 命令 HDLC 和 PPP 封装都适用于本文档中说明的示例 先决条件 要求 本文档的读者应该掌握一些关于 OSPF 路由协议的基础知识 有关 OSPF 路由协议的详细信息, 请参阅开放最短路径优先文档 使用的组件 本文档中的信息适用于以下软件和硬件版本 Cisco 2500 路由器
在路由器运行的 Cisco IOS 软件版本 12.2(27) 本文档中的信息都是基于特定实验室环境中的设备编写的 本文档中使用的所有设备最初均采用原始 ( 默认 ) 配置 如果您使用的是真实网络, 请确保您已经了解所有命令的潜在影响 规则 有关文档规则的详细信息, 请参阅 Cisco 技术提示规则 带有串行接口 IP 地址的点对点链路上的 OSPF 对于本部分提供的信息, 您可以用来配置运行 OSPF 的路由器, 同时, 这类路由器应该使用 HDLC 封装通过点对点串行链路连接起来, 而且 IP 地址配置在串行接口上 注意 : 要查找有关本文档所用命令的其他信息, 请使用命令查找工具 ( 仅限注册用户 ) 网络图 配置 本部分使用以下配置 ip address 3.3.3.3 255.255.255.255 ip address 1.1.1.2 255.255.255.0 router ospf 1 network 1.1.1.0 0.0.0.255 area 0 --- Configures the Serial Interface S0 under OSPF area 0. ip address 2.2.2.2 255.255.255.255 ip address 1.1.1.1 255.255.255.0 clockrate 2000000 router ospf 1 network 1.1.1.0 0.0.0.255 area 0 --- Configures the Serial Interface S0 under OSPF area 0.. 带有未编号接口的点对点链路上的 OSPF
对于本部分提供的信息, 您可以用来配置运行 OSPF 作为路由协议的路由器, 同时, 这类路由器应该使用 PPP 封装通过点对点串行链路连接起来, 而且采用未编号的串行接口 未编号的串行接口是指没有自己的 IP 地址的接口 这类接口向路由器上另一个已配置 IP 地址的接口借用 IP 地址 有关未编号串行接口的详细信息, 请参阅了解和配置 ip unnumbered 命令 注意 : 要查找有关本文档所用命令的其他信息, 请使用命令查找工具 ( 仅限注册用户 ) 网络图 配置 本部分使用以下配置 ip address 3.3.3.3 255.255.255.255 ip unnumbered loopback 0 --- Configures Serial 0 as an unnumbered interface. encapsulation ppp --- Configures the Encapsulation on the interface as PPP. router ospf 1 network 3.3.3.0 0.0.0.255 area 0 --- Configures the Loopback Interface L0 under OSPF area 0. ip address 2.2.2.2 255.255.255.255 ip unnumbered loopback 0 --- Configures Serial 0 as an unnumbered interface. encapsulation ppp --- Configures the Encapsulation on the interface as PPP. router ospf 1 network 2.2.2.0 0.0.0.255 area 0 --- Configures the Loopback Interface L0 under OSPF area 0.. 验证 本部分提供的信息可用于确认您的配置是否工作正常 命令输出解释程序工具 ( 仅限注册用户 ) 支持某些 show 命令, 使用此工具可以查看对 show 命令输出的分析 验证带有串行接口 IP 地址的 OSPF 的配置 这是在 上发出的 show ip ospf neighbor 命令的输出
#show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 2.2.2.2 1 FULL/ - 00:00:32 1.1.1.1 Serial 0 此输出显示, 有一个路由器 ID 为 2.2.2.2 的邻居, 并与该邻居建立了完全邻接关系 地址 1.1.1.1 是 上 Serial0 接口的 IP 地址 有关 show ip ospf neighbor 命令的详细信息, 请参阅 show ip ospf neighbor 命令显示了什么? 这是 上 show ip ospf interface serial 0 命令的输出 此输出显示,Serial0 接口的 OSPF 网络类型为点对点 # show ip ospf interface serial 0 Serial0 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 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 Suppress hello for 0 neighbor(s) 类似地, 本示例显示 上 show ip ospf neighbor 和 show ip ospf interface 命令的输出 # show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 3.3.3.3 1 FULL/ - 00:00:32 1.1.1.2 Serial0 # show ip ospf interface serial 0 Serial0 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 configured, Hello 10, Dead 40, Wait 40, Retransmit 5 Hello due in 00:00:05 Index 1/1, flood neighbor 3.3.3.3 Suppress hello for 0 neighbor(s) 验证带有未编号接口的 OSPF 的配置 和 上的 show ip ospf neighbor 命令确认了完全邻接 此输出显示,Serial0 接口的 OSPF 网络类型为点对点 您也可以看到, 两个路由器上串行接口的 Internet 地址都是 0.0.0.0 这是因为本例中借助 ip unnumbered 命令向环回接口借用了 IP 地址 #show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 2.2.2.2 1 FULL/ - 00:00:37 2.2.2.2 Serial0 # show ip ospf interface serial 0 Serial0 is up, line protocol is up Internet Address 0.0.0.0/24, Area 0 Process ID 1, Router ID 3.3.3.3, Network Type configured, Hello 10, Dead 40, Wait 40, Retransmit 5 Hello due in 00:00:08 Index 2/2, flood neighbor 2.2.2.2 Suppress hello for 0 neighbor(s) 本示例显示 上 show ip ospf neighbor 和 show ip ospf interface serial 0 命令的输出 #show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 3.3.3.3 1 FULL/ - 00:00:30 3.3.3.3 Serial0 # show ip ospf interface serial 0 Serial0 is up, line protocol is up Internet Address 0.0.0.0/24, Area 0 Process ID 1, Router ID 2.2.2.2, Network Type configured, Hello 10, Dead 40, Wait 40, Retransmit 5 Hello due in 00:00:08 Index 2/2, flood neighbor 3.3.3.3 Suppress hello for 0 neighbor(s) 本示例显示使用 PPP 封装和未编号接口的 上 show ip route 命令的输出 #show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D
Gateway of last resort is not set 2.0.0.0/32 is subnetted, 1 subnets C 2.2.2.2 is directly connected, Serial0 3.0.0.0/32 is subnetted, 1 subnets C 3.3.3.3 is directly connected, Loopback0 本示例显示使用 PPP 封装和未编号接口的 上 show ip route 命令的输出 #show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D Gateway of last resort is not set 2.0.0.0/32 is subnetted, 1 subnets C 2.2.2.2 is directly connected, Loopback0 3.0.0.0/32 is subnetted, 1 subnets C 3.3.3.3 is directly connected, Serial0 本示例显示使用 HDLC 封装和未编号接口的 上 show ip route 命令的输出 #show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D Gateway of last resort is not set 2.0.0.0/32 is subnetted, 1 subnets O 2.2.2.2 [110/65] via 2.2.2.2, 00:00:08, Serial0 3.0.0.0/32 is subnetted, 1 subnets C 3.3.3.3 is directly connected, Loopback0 本示例显示使用 HDLC 封装和未编号接口的 上 show ip route 命令的输出 #show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D Gateway of last resort is not set 2.0.0.0/32 is subnetted, 1 subnets C 2.2.2.2 is directly connected, Loopback0 3.0.0.0/32 is subnetted, 1 subnets O 3.3.3.3 [110/65] via 3.3.3.3, 00:01:28, Serial0 注意 : 在串行接口上使用 IP 未编号配置时,PPP 和 HDLC 两种封装条件下的 show ip route 命令输出可能有所不同 PPP 将主机路由安装到在另一端的串行接口上作为直连网络的路由器使用的 IP 地址上 如果像此配置中一样, 通过 OSPF 也获知同一个前缀, 那么它仅显示为已连接路由 ( 就像这里的 show ip route 输出显示的一样 ) 这是因为已连接路由的管理距离比 OSPF 更短, 更适合作为首选路由 如果在串行接口下发出 no peer neighbor-route 命令, 从而防止安装主机路由并将其作为 OSPF 路由对待, 则可改变这种行为 使用 HDLC 时不会这样, 因为它不安装主机路由 使用 IP 未编号配置时,HDLC 为另一端的地址安装 OSPF 路由 故障排除 有关如何排除 OSPF 故障的信息, 请参阅 OSPF 故障排除 相关信息 通过点到多点链路连接的 OSPF 路由器 通过未编号的串行链路连接 OSPF 路由器 OSPF 邻居状态 OSPF 技术支持页 了解和配置 ip unnumbered 命令 技术支持和文档 - Cisco Systems