Verify OSPF Neighbors
If you have configured single-area OSPFv2, you will need to verify your configurations. This topic details the many commands that you can use to verify OSPF.
As you know, the following two commands are particularly useful for verifying routing:
- show ip interface brief – This verifies that the desired interfaces are active with correct IP addressing.
- show ip route– This verifies that the routing table contains all the expected routes.
Additional commands for determining that OSPF is operating as expected include the following:
- show ip ospf neighbor
- show ip protocols
- show ip ospf
- show ip ospf interface
The figure shows the OSPF reference topology used to demonstrate these commands.
standard OSPFv2 network topology used in this module as described in 2.1.1
OSPFv2 Reference Topology
Use the show ip ospf neighbor command to verify that the router has formed an adjacency with its neighboring routers. If the router ID of the neighboring router is not displayed, or if it does not show as being in a state of FULL, the two routers have not formed an OSPFv2 adjacency.
If two routers do not establish adjacency, link-state information is not exchanged. Incomplete LSDBs can cause inaccurate SPF trees and routing tables. Routes to destination networks may not exist, or may not be the most optimum path.
Note: A non-DR or BDR router that has a neighbor relationship with another non-DR or BDR router will display a two-way adjacency instead of full.
The following command output displays the neighbor table of R1.
R1# show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 22.214.171.124 0 FULL/ - 00:00:19 10.1.1.13 GigabitEthernet0/0/1 126.96.36.199 0 FULL/ - 00:00:18 10.1.1.6 GigabitEthernet0/0/0 R1#
For each neighbor, this command displays the following:
- Neighbor ID – This is the router ID of the neighboring router.
- Pri – This is the OSPFv2 priority of the interface. This value is used in the DR and BDR election.
- State – This is the OSPFv2 state of the interface. FULL state means that the router and its neighbor have identical OSPFv2 LSDBs. On multiaccess networks, such as Ethernet, two routers that are adjacent may have their states displayed as 2WAY. The dash indicates that no DR or BDR is required because of the network type.
- Dead Time – This is the amount of time remaining that the router waits to receive an OSPFv2 Hello packet from the neighbor before declaring the neighbor down. This value is reset when the interface receives a Hello packet.
- Address – This is the IPv4 address of the interface of the neighbor to which this router is directly connected.
- Interface – This is the interface on which this router has formed adjacency with the neighbor.
Two routers may not form an OSPFv2 adjacency if the following occurs:
- The subnet masks do not match, causing the routers to be on separate networks.
- The OSPFv2 Hello or Dead Timers do not match.
- The OSPFv2 Network Types do not match.
- There is a missing or incorrect OSPFv2 network command.
Verify OSPF Protocol Settings
The show ip protocols command is a quick way to verify vital OSPF configuration information, as shown in the following command output. This includes the OSPFv2 process ID, the router ID, interfaces explicitly configured to advertise OSPF routes, the neighbors the router is receiving updates from, and the default administrative distance, which is 110 for OSPF.
R1# show ip protocols *** IP Routing is NSF aware *** (output omitted) Routing Protocol is "ospf 10" Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set Router ID 188.8.131.52 Number of areas in this router is 1. 1 normal 0 stub 0 nssa Maximum path: 4 Routing for Networks: Routing on Interfaces Configured Explicitly (Area 0): Loopback0 GigabitEthernet0/0/1 GigabitEthernet0/0/0 Routing Information Sources: Gateway Distance Last Update 184.108.40.206 110 00:09:30 220.127.116.11 110 00:09:58 Distance: (default is 110) R1#
Verify OSPF Process Information
The show ip ospf command can also be used to examine the OSPFv2 process ID and router ID, as shown in the following command output. This command displays the OSPFv2 area information and the last time the SPF algorithm was executed.
R1# show ip ospf Routing Process "ospf 10" with ID 18.104.22.168 Start time: 00:01:47.390, Time elapsed: 00:12:32.320 Supports only single TOS(TOS0) routes Supports opaque LSA Supports Link-local Signaling (LLS) Supports area transit capability Supports NSSA (compatible with RFC 3101) Supports Database Exchange Summary List Optimization (RFC 5243) Event-log enabled, Maximum number of events: 1000, Mode: cyclic Router is not originating router-LSAs with maximum metric Initial SPF schedule delay 5000 msecs Minimum hold time between two consecutive SPFs 10000 msecs Maximum wait time between two consecutive SPFs 10000 msecs Incremental-SPF disabled Minimum LSA interval 5 secs Minimum LSA arrival 1000 msecs LSA group pacing timer 240 secs Interface flood pacing timer 33 msecs Retransmission pacing timer 66 msecs EXCHANGE/LOADING adjacency limit: initial 300, process maximum 300 Number of external LSA 1. Checksum Sum 0x00A1FF Number of opaque AS LSA 0. Checksum Sum 0x000000 Number of DCbitless external and opaque AS LSA 0 Number of DoNotAge external and opaque AS LSA 0 Number of areas in this router is 1. 1 normal 0 stub 0 nssa Number of areas transit capable is 0 External flood list length 0 IETF NSF helper support enabled Cisco NSF helper support enabled Reference bandwidth unit is 10000 mbps Area BACKBONE(0) Number of interfaces in this area is 3 Area has no authentication SPF algorithm last executed 00:11:31.231 ago SPF algorithm executed 4 times Area ranges are Number of LSA 3. Checksum Sum 0x00E77E Number of opaque link LSA 0. Checksum Sum 0x000000 Number of DCbitless LSA 0 Number of indication LSA 0 Number of DoNotAge LSA 0 Flood list length 0 R1#
Verify OSPF Interface Settings
The show ip ospf interface command provides a detailed list for every OSPFv2-enabled interface. Specify an interface to display the settings of just that interface, as shown in the following output for Gigabit Ethernet 0/0/0. This command shows the process ID, the local router ID, the type of network, OSPF cost, DR and BDR information on multiaccess links (not shown), and adjacent neighbors.
R1# show ip ospf interface GigabitEthernet 0/0/0 GigabitEthernet0/0/0 is up, line protocol is up Internet Address 10.1.1.5/30, Area 0, Attached via Interface Enable Process ID 10, Router ID 22.214.171.124, Network Type POINT_TO_POINT, Cost: 10 Topology-MTID Cost Disabled Shutdown Topology Name 0 10 no no Base Enabled by interface config, including secondary ip addresses Transmit Delay is 1 sec, State POINT_TO_POINT Timer intervals configured, Hello 5, Dead 20, Wait 20, Retransmit 5 oob-resync timeout 40 Hello due in 00:00:01 Supports Link-local Signaling (LLS) Cisco NSF helper support enabled IETF NSF helper support enabled Index 1/2/2, flood queue length 0 Next 0x0(0)/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 126.96.36.199 Suppress hello for 0 neighbor(s) R1#
To get a quick summary of OSPFv2-enabled interfaces, use the show ip ospf interface brief command, as shown in the following command output. This command is useful for seeing important information including the following:
- Interfaces are participating in OSPF
- Networks that are being advertised (IP Address/Mask)
- Cost of each link
- Network state
- Number of neighbors on each link
R1# show ip ospf interface brief Interface PID Area IP Address/Mask Cost State Nbrs F/C Lo0 10 0 10.10.1.1/24 10 P2P 0/0 Gi0/0/1 10 0 10.1.1.14/30 30 P2P 1/1 Gi0/0/0 10 0 10.1.1.5/30 10 P2P 1/1 R1#