在高级数据链路控制 (HDLC) 和点对点协议 (PPP) 等点对点链路上,开放最短路径优先 (OSPF) 作为点对点网络类型运行。默认情况下,此网络类型处于启用状态。本文档给出了点对点链路上 OSPF 的配置示例。OSPF 支持的其他网络类型是单点对多点、广播和非广播。要检查运行 OSPF 的接口的网络类型,请发出 show ip ospf interface 命令。
HDLC 和 PPP 封装都适用于本文档中说明的示例。
本文档的读者应该掌握一些关于 OSPF 路由协议的基础知识。有关 OSPF 路由协议的详细信息,请参阅开放最短路径优先文档。
本文档中的信息适用于以下软件和硬件版本。
Cisco 2500 路由器
在路由器上运行的思科IOS®软件版本12.2(27)
本文档中的信息都是基于特定实验室环境中的设备编写的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您使用的是真实网络,请确保您已经了解所有命令的潜在影响。
有关文件规则的更多信息请参见“ Cisco技术提示规则”。
对于本部分提供的信息,您可以用来配置运行 OSPF 的路由器,同时,这类路由器应该使用 HDLC 封装通过点对点串行链路连接起来,而且 IP 地址配置在串行接口上。
注:要查找有关本文档使用的命令的其他信息,请使用命令查找工具(仅注册客户)。
本部分使用以下配置。
路由器1 |
---|
Router1 ! interface Loopback0 ip address 3.3.3.3 255.255.255.255 ! interface Serial0 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. ! |
路由器2 |
---|
Router2 ! interface Loopback0 ip address 2.2.2.2 255.255.255.255 ! interface Serial0 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 作为路由协议的路由器,同时,这类路由器应该使用 PPP 封装通过点对点串行链路连接起来,而且采用未编号的串行接口。未编号的串行接口是指没有自己的 IP 地址的接口。这类接口向路由器上另一个已配置 IP 地址的接口借用 IP 地址。有关未编号串行接口的详细信息,请参阅了解和配置 ip unnumbered 命令。
注:要查找有关本文档使用的命令的其他信息,请使用命令查找工具(仅注册客户)。
本部分使用以下配置。
路由器1 |
---|
! interface Loopback0 ip address 3.3.3.3 255.255.255.255 ! interface Serial0 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. ! |
路由器2 |
---|
! interface Loopback0 ip address 2.2.2.2 255.255.255.255 ! interface Serial0 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 命令输出的分析。
这是在 Router1 上发出的 show ip ospf neighbor 命令的输出。
Router1#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
此输出显示,Router1 有一个路由器 ID 为 2.2.2.2 的邻居,并与该邻居建立了完全邻接关系。地址 1.1.1.1 是 Router2 上 Serial0 接口的 IP 地址。
有关 show ip ospf neighbor 命令的详细信息,请参阅 show ip ospf neighbor 命令显示了什么?
这是Router1上show ip ospf interface serial 0命令的输出。此输出将接口Serial0的OSPF网络类型显示为点对点。
Router1# 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)
类似地,本示例显示 Router2 上 show ip ospf neighbor 和 show ip ospf interface 命令的输出。
Router2# 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 Router2# 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 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 3.3.3.3 Suppress hello for 0 neighbor(s)
Router1 和 Router2 上的 show ip ospf neighbor 命令确认了完全邻接。此输出显示,Serial0 接口的 OSPF 网络类型为点对点。您也可以看到,两个路由器上串行接口的 Internet 地址都是 0.0.0.0。这是因为本例中借助 ip unnumbered 命令向环回接口借用了 IP 地址。
Router1#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 Router1# 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 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:08 Index 2/2, 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 上 show ip ospf neighbor 和 show ip ospf interface serial 0 命令的输出。
Router2#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 Router2# 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 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:08 Index 2/2, 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)
本示例显示了Router1上使用封装PPP的show ip route命令的输出以及使用未编号接口的输出。
Router1#show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route 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 封装和未编号接口的 Router2 上 show ip route 命令的输出。
Router2#show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route 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 封装和未编号接口的 Router1 上 show ip route 命令的输出。
Router1#show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route 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 封装和未编号接口的 Router2 上 show ip route 命令的输出。
Router1#show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route 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 故障排除。
版本 | 发布日期 | 备注 |
---|---|---|
1.0 |
06-Jul-2007 |
初始版本 |