本文档说明了广播介质(例如,以太网和令牌环)上的 Open Shortest Path First (OSPF) 配置示例。show ip ospf interface 命令会验证在所有广播介质上运行的 OSPF 是否默认为广播网络类型。
本文档的读者应掌握以下这些主题的相关知识:
本文档中的信息适用于以下软件和硬件版本。
两个 Cisco 2501 路由器
Cisco IOS® 软件版本 12.2(27)
本文档中的信息都是基于特定实验室环境中的设备编写的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您使用的是真实网络,请确保您已经了解所有命令的潜在影响。
您还可以将此配置用于任意两个至少包含一个以太网、令牌环或 FDDI 接口的路由器。
有关文件规则的更多信息请参见“ Cisco技术提示规则”。
本部分为您提供了可用于配置本文档所述功能的信息。
注意:要查找有关本文档使用的命令的其他信息,请参阅OSPF命令或使用命令查找工具(仅限注册的客户)。
本文档使用此网络设置。
本文档使用以下配置。
路由器1 |
---|
interface Loopback0 ip address 192.168.45.1 255.255.255.0 ! interface Ethernet0 ip address 10.10.10.1 255.255.255.0 ! router ospf 1 network 10.10.10.0 0.0.0.255 area 0 !--- OSPF is configured to run on the !--- Ethernet interface with an Area ID of 1. ! |
路由器2 |
---|
interface Loopback0 ip address 172.16.10.1 255.255.255.0 ! interface Ethernet0 ip address 10.10.10.2 255.255.255.0 ! router ospf 1 network 10.10.10.0 0.0.0.255 area 0 !--- OSPF is configured to run on the !--- Ethernet interface with an Area ID of 1. ! |
本部分提供的信息可帮助您确认您的配置是否可正常运行。
命令输出解释程序工具(仅限注册用户)支持某些 show 命令,使用此工具可以查看对 show 命令输出的分析。
show ip ospf neighbor - 按接口显示 OSPF 邻居信息。Router1 的输出如下所示:
Router1#show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 172.16.10.1 1 FULL/BDR 00:00:38 10.10.10.2 Ethernet0
根据此输出,对于邻居ID为172.16.10.1的Router2,Router1的邻居状态为“Full”。Router2是该广播网络中的备用指定路由器(BDR)。要了解有关 show ip ospf neighbor 命令显示内容的详细信息,请参阅 show ip ospf neighbor 命令显示什么内容?
show ip ospf interface - 显示与 OSPF 相关的接口信息。在以太网接口上发出的 Router1 的输出如下所示:
Router1#show ip ospf interface ethernet 0 Ethernet0 is up, line protocol is up Internet Address 10.10.10.1/24, Area 0 Process ID 1, Router ID 192.168.45.1, Network Type BROADCAST, Cost: 10 Transmit Delay is 1 sec, State DR, Priority 1 Designated Router (ID) 192.168.45.1, Interface address 10.10.10.1 Backup Designated router (ID) 172.16.10.1, Interface address 10.10.10.2 Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 Hello due in 00:00:00 Index 2/2, 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 172.16.10.1 (Backup Designated Router) Suppress hello for 0 neighbor(s)
从此输出可以了解到,以太网 0 接口的网络类型为广播。要了解有关 show ip ospf interface 命令显示内容的详细信息,请参阅 show ip ospf interface 命令显示什么内容?
同样,在 Router2 上,show 命令的输出如下所示。
Router2#show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 192.168.45.1 1 FULL/DR 00:00:31 10.10.10.1 Ethernet0
从 show ip ospf neighbor 命令的输出可以了解到,Router1 是此广播网络中的指定路由器 (DR)。
Router2#show ip ospf interface ethernet 0 Ethernet0 is up, line protocol is up Internet Address 10.10.10.2/24, Area 0 Process ID 1, Router ID 172.16.10.1, Network Type BROADCAST, Cost: 10 Transmit Delay is 1 sec, State BDR, Priority 1 Designated Router (ID) 192.168.45.1, Interface address 10.10.10.1 Backup Designated router (ID) 172.16.10.1, Interface address 10.10.10.2 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 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.168.45.1 (Designated Router) Suppress hello for 0 neighbor(s)
Router2 的 show ip ospf interface ethernet 0 命令输出也显示以太网 0 接口的网络类型为广播。
本部分提供的信息可用于对配置进行故障排除。
命令输出解释程序工具(仅限注册用户)支持某些 show 命令,使用此工具可以查看对 show 命令输出的分析。
注意:在发出debug命令之前,请参阅有关debug命令的重要信息。
两个路由器之间形成邻接时,会有多种状态。您可以使用 debug ip ospf adj 命令来查看各种状态,以及在广播 OSPF 网络中发生的 DR 和 BDR 选择。在较早的 Cisco IOS 软件版本中,您可以使用 debug ip ospf adjacency 命令。您需要在邻居关系建立之前发出此 debug 命令。
此输出从Router1的角度出发。输出中以粗体显示的部分是邻接过程经历的各种状态。
Router1#debug ip ospf adj OSPF adjacency events debugging is on *Mar 1 01:41:23.319: OSPF: Rcv DBD from 172.16.10.1 on Ethernet0 seq 0x1F6C opt 0x42 flag 0x7 len 32 mtu 1500 state INIT *Mar 1 01:41:23.323: OSPF: 2 Way Communication to 172.16.10.1 on Ethernet0, state 2WAY *Mar 1 01:41:23.327: OSPF: Neighbor change Event on interface Ethernet0 *Mar 1 01:41:23.327: OSPF: DR/BDR election on Ethernet0 *Mar 1 01:41:23.331: OSPF: Elect BDR 172.16.10.1 *Mar 1 01:41:23.331: OSPF: Elect DR 192.168.45.1 *Mar 1 01:41:23.335: DR: 192.168.45.1 (Id) BDR: 172.16.10.1 (Id) *Mar 1 01:41:23.339: OSPF: Send DBD to 172.16.10.1 on Ethernet0 seq 0x2552 opt 0x42 flag 0x7 len 32 *Mar 1 01:41:23.343: OSPF: First DBD and we are not SLAVE *Mar 1 01:41:23.359: OSPF: Rcv DBD from 172.16.10.1 on Ethernet0 seq 0x2552 opt 0x42 flag 0x2 len 52 mtu 1500 state EXSTART *Mar 1 01:41:23.363: OSPF: NBR Negotiation Done. We are the MASTER *Mar 1 01:41:23.367: OSPF: Send DBD to 172.16.10.1 on Ethernet0 seq 0x2553 opt 0x42 flag 0x3 len 72 *Mar 1 01:41:23.387: OSPF: Rcv DBD from 172.16.10.1 on Ethernet0 seq 0x2553 opt 0x42 flag 0x0 len 32 mtu 1500 state EXCHANGE *Mar 1 01:41:23.391: OSPF: Send DBD to 172.16.10.1 on Ethernet0 seq 0x2554 opt 0x42 flag 0x1 len 32 *Mar 1 01:41:23.411: OSPF: Rcv DBD from 172.16.10.1 on Ethernet0 seq 0x2554 opt 0x42 flag 0x0 len 32 mtu 1500 state EXCHANGE *Mar 1 01:41:23.415: OSPF: Exchange Done with 172.16.10.1 on Ethernet0 *Mar 1 01:41:23.419: OSPF: Synchronized with 172.16.10.1 on Ethernet0, state FULL 01:41:23: %OSPF-5-ADJCHG: Process 1, Nbr 172.16.10.1 on Ethernet0 from LOADING to FULL, Loading Done *Mar 1 01:41:23.879: OSPF: Build router LSA for area 0, router ID 192.168.45.1, seq 0x80000004 *Mar 1 01:41:23.923: OSPF: Build network LSA for Ethernet0, router ID 192.168.45.1 *Mar 1 01:41:25.503: OSPF: Neighbor change Event on interface Ethernet0 *Mar 1 01:41:25.507: OSPF: DR/BDR election on Ethernet0 *Mar 1 01:41:25.507: OSPF: Elect BDR 172.16.10.1 *Mar 1 01:41:25.511: OSPF: Elect DR 192.168.45.1 *Mar 1 01:41:25.511: DR: 192.168.45.1 (Id) BDR: 172.16.10.1 (Id)
发出 debug ip ospf events 命令可验证 hello 计时器值,如此示例输出所示。
Router1#debug ip ospf events OSPF events debugging is on Router1# *Mar 1 04:04:11.926: OSPF: Rcv hello from 172.16.10.1 area 0 from Ethernet0 10.10.10.2 *Mar 1 04:04:11.930: OSPF: End of hello processing *Mar 1 04:04:21.926: OSPF: Rcv hello from 172.16.10.1 area 0 from Ethernet0 10.10.10.2 *Mar 1 04:04:21.930: OSPF: End of hello processing *Mar 1 04:04:31.926: OSPF: Rcv hello from 172.16.10.1 area 0 from Ethernet0 10.10.10.2 *Mar 1 04:04:31.930: OSPF: End of hello processing *Mar 1 04:04:41.926: OSPF: Rcv hello from 172.16.10.1 area 0 from Ethernet0 10.10.10.2 *Mar 1 04:04:41.930: OSPF: End of hello processing *Mar 1 04:04:51.926: OSPF: Rcv hello from 172.16.10.1 area 0 from Ethernet0 10.10.10.2 *Mar 1 04:04:51.930: OSPF: End of hello processing *Mar 1 04:05:01.926: OSPF: Rcv hello from 172.16.10.1 area 0 from Ethernet0 10.10.10.2 *Mar 1 04:05:01.930: OSPF: End of hello processing *Mar 1 04:05:11.926: OSPF: Rcv hello from 172.16.10.1 area 0 from Ethernet0 10.10.10.2 *Mar 1 04:05:11.930: OSPF: End of hello processing *Mar 1 04:05:21.926: OSPF: Rcv hello from 172.16.10.1 area 0 from Ethernet0 10.10.10.2 *Mar 1 04:05:21.930: OSPF: End of hello processing
此输出显示 Hello 数据包每 10 秒交换一次。
版本 | 发布日期 | 备注 |
---|---|---|
1.0 |
06-Jul-2007 |
初始版本 |