show ip ospf neighbor
Verify OSPF neighbour adjacencies are forming correctly and diagnose why a neighbour is not reaching FULL state.
Definition: show ip ospf neighbor is a Cisco IOS privileged exec command. Displays OSPF neighbour table showing router IDs, adjacency state, dead timer, and the interface the neighbour is reachable through.
Overview
The 'show ip ospf neighbor' command is a fundamental troubleshooting and verification tool in Cisco IOS that displays the OSPF neighbor table. This command is essential for network engineers to verify that OSPF adjacencies have formed correctly, which is a prerequisite for exchanging routing information. OSPF (Open Shortest Path First) is a link-state routing protocol that uses Hello packets to discover and maintain neighbor relationships. The neighbor table lists all routers with which the local router has established a bidirectional communication, along with their state (e.g., FULL, 2WAY, INIT) and other key attributes. Understanding this command is critical for CCNA and CCNP candidates because OSPF neighbor formation is a common source of routing issues. Without proper adjacencies, routes are not exchanged, leading to network unreachability.
When troubleshooting OSPF, the 'show ip ospf neighbor' command is often the first step. It provides immediate insight into whether the router can see its neighbors and the state of those relationships. For example, if a neighbor is stuck in INIT or EXSTART state, it indicates a problem with Hello/Dead timers, authentication, or MTU mismatch. The command also shows the neighbor's router ID, interface, and the time since the last Hello was received. This information helps pinpoint issues such as mismatched OSPF areas, network types, or passive interfaces.
Compared to other commands, 'show ip ospf neighbor' is more focused than 'show ip ospf interface' (which shows interface-specific OSPF settings) or 'show ip route ospf' (which shows learned routes). It directly addresses the neighbor relationship layer. In a troubleshooting workflow, you would typically start with 'show ip ospf neighbor' to confirm adjacency, then use 'show ip ospf interface' to verify interface parameters, and finally 'debug ip ospf adj' for granular detail.
Important IOS behaviors: The command output is buffered and may be truncated if the neighbor table is large; use 'terminal length 0' to disable paging. It requires privileged EXEC mode (enable). The command does not modify the running configuration. In some IOS versions, the output includes additional fields like 'Dead time' or 'State/Priority'. The command can be filtered by specifying a neighbor IP address or interface to narrow down results. Understanding these nuances helps engineers efficiently gather the needed information without unnecessary overhead.
show ip ospf neighbor [detail]When to Use This Command
- Confirm two routers have reached FULL adjacency after configuring OSPF
- Identify neighbours stuck in 2WAY, EXSTART, EXCHANGE, or LOADING
- Check which router is DR and which is BDR on a multi-access segment
- Verify dead timer is counting down (neighbour hellos being received)
Parameters
| Parameter | Syntax | Description |
|---|---|---|
| interface-type interface-number | interface-type interface-number | Specifies a particular interface to display neighbors discovered on that interface. For example, 'GigabitEthernet0/0'. If omitted, all OSPF neighbors are shown. Common mistake: using the wrong interface name or number, resulting in no output. |
| neighbor-id | A.B.C.D | The router ID of a specific neighbor to display detailed information about that neighbor. For example, '10.0.0.1'. If omitted, all neighbors are shown. Common mistake: using an IP address that is not a router ID, leading to empty output. |
| detail | detail | Displays detailed information about all neighbors, including dead time, neighbor priority, and state changes. Useful for in-depth troubleshooting. Common mistake: forgetting that 'detail' is a keyword, not a parameter value. |
Command Examples
Basic neighbour table
Router# show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 10.0.0.2 1 FULL/DR 00:00:35 192.168.1.2 GigabitEthernet0/0 10.0.0.3 0 FULL/ - 00:00:39 10.1.1.2 Serial0/0/0
Detailed output including options and uptime
Router# show ip ospf neighbor detail Neighbor 10.0.0.2, interface address 192.168.1.2 In the area 0 via interface GigabitEthernet0/0 Neighbor priority is 1, State is FULL, 6 state changes DR is 192.168.1.2 BDR is 192.168.1.1 Options is 0x12
Understanding the Output
State column: FULL = complete adjacency (routing works). 2WAY = seen each other's hellos but no full adjacency (normal for DROther-DROther pairs). EXSTART/EXCHANGE/LOADING = adjacency forming. Pri = OSPF priority (0 = cannot become DR).
FULL/DR means this neighbour is the DR; FULL/BDR means BDR; FULL/ - means point-to-point.
Configuration Scenarios
Verify OSPF adjacency between two directly connected routers
Two routers, R1 and R2, are connected via a point-to-point link. OSPF has been configured, but routes are not being exchanged. The goal is to verify that the OSPF neighbor adjacency has formed correctly.
Topology
R1(Gi0/0)---10.0.12.0/30---(Gi0/0)R2Steps
- 1.Step 1: On R1, enter privileged EXEC mode: R1> enable
- 2.Step 2: Display OSPF neighbors: R1# show ip ospf neighbor
- 3.Step 3: Verify that R2 appears in the output with state FULL/DR or FULL/BDR (for broadcast) or FULL/- (for point-to-point).
- 4.Step 4: If no neighbor appears, check OSPF configuration: R1# show running-config | section router ospf
- 5.Step 5: Verify interface OSPF settings: R1# show ip ospf interface gigabitEthernet 0/0
! R1 OSPF configuration router ospf 1 network 10.0.12.0 0.0.0.3 area 0 ! ! R2 OSPF configuration router ospf 1 network 10.0.12.0 0.0.0.3 area 0
Verify: R1# show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 10.0.0.2 1 FULL/DR 00:00:38 10.0.12.2 GigabitEthernet0/0 Expected: State is FULL, Dead Time is counting down, Address is correct.
Watch out: If the network type is broadcast, ensure that the DR/BDR election is complete. If the state is 2WAY/DROTHER, the adjacency is not fully formed; check that both routers have the same OSPF network type.
Troubleshoot OSPF neighbor stuck in INIT state
R1 and R3 are connected via a serial link. OSPF is configured, but the neighbor state remains INIT. The goal is to identify and resolve the issue preventing adjacency formation.
Topology
R1(Se0/0/0)---10.0.13.0/30---(Se0/0/0)R3Steps
- 1.Step 1: On R1, check OSPF neighbors: R1# show ip ospf neighbor
- 2.Step 2: Observe that R3's state is INIT. This means R1 has received a Hello from R3 but the adjacency is not bidirectional.
- 3.Step 3: Verify that R3's OSPF configuration includes R1's network: R3# show running-config | section router ospf
- 4.Step 4: Check for mismatched parameters: R1# show ip ospf interface serial 0/0/0
- 5.Step 5: Compare Hello and Dead timers, area ID, authentication, and network type with R3.
- 6.Step 6: If timers mismatch, adjust them: R1(config-if)# ip ospf hello-interval 10
- 7.Step 7: If authentication is mismatched, configure the same key: R1(config-if)# ip ospf authentication message-digest
! R1 interface configuration interface Serial0/0/0 ip address 10.0.13.1 255.255.255.252 ip ospf hello-interval 10 ip ospf dead-interval 40 ip ospf authentication message-digest ip ospf message-digest-key 1 md5 cisco ! router ospf 1 network 10.0.13.0 0.0.0.3 area 0
Verify: After fixing mismatches, R1# show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 10.0.0.3 0 FULL/ - 00:00:35 10.0.13.2 Serial0/0/0 Expected: State changes to FULL.
Watch out: A common mistake is forgetting that the MTU must match on both sides for OSPF to form adjacency over point-to-point links. Check MTU with 'show interfaces' and adjust if necessary.
Troubleshooting with This Command
The 'show ip ospf neighbor' command is the primary tool for diagnosing OSPF neighbor relationship issues. A healthy output shows neighbors in the FULL state (for point-to-point or broadcast networks) or 2WAY state (for NBMA networks). The Dead Time field should be counting down from the dead interval (typically 40 seconds) and resetting upon receipt of Hello packets. If the Dead Time reaches zero, the neighbor is declared dead.
Key fields to focus on: State indicates the adjacency progress. Common states are DOWN, ATTEMPT, INIT, 2WAY, EXSTART, EXCHANGE, LOADING, and FULL. Stuck states like INIT or EXSTART indicate problems. For example, INIT means the router has received a Hello but the neighbor has not seen its own router ID in the Hello packet (lack of bidirectional communication). This often points to mismatched Hello/Dead timers, authentication, or area ID. EXSTART/EXCHANGE states suggest issues with MTU mismatch or OSPF database description packet problems.
When troubleshooting, follow this diagnostic flow: 1. Run 'show ip ospf neighbor' to see the current state of all neighbors. 2. If a neighbor is missing, check 'show ip ospf interface' on the connecting interface to verify OSPF is enabled and the network type is correct. 3. Verify that the interface is up/up and has an IP address in the same subnet as the neighbor. 4. Check for ACLs that might block OSPF multicast (224.0.0.5 and 224.0.0.6). 5. Use 'debug ip ospf adj' to see real-time adjacency events (use with caution in production). 6. Correlate with 'show ip route ospf' to see if routes are being learned.
Common symptoms: If a neighbor is stuck in INIT, check authentication and timers. If stuck in EXSTART, check MTU. If the neighbor appears but state is 2WAY/DROTHER on a broadcast network, it means the router is not the DR/BDR; this is normal unless you expect it to be. If the neighbor state fluctuates, check for flapping interfaces or unstable OSPF process.
Correlating with other commands: 'show ip ospf interface' provides interface-specific OSPF parameters. 'show ip ospf database' shows the LSDB. 'show ip route ospf' shows installed routes. Together, they give a complete picture of OSPF health.
CCNA Exam Tips
Key CCNA exam states: FULL/DR and FULL/BDR are expected on multi-access (Ethernet) segments
DRothers show FULL only with DR/BDR, and 2WAY with other DROthers — this is correct behaviour
Stuck in EXSTART usually means MTU mismatch
Stuck in EXCHANGE means DBD packets not being acknowledged
Common Mistakes
Confusing 2WAY (correct for DROther pairs) with a fault
Expecting all neighbours to show FULL/DR or FULL/BDR — only two routers per segment hold those roles
Forgetting that serial (point-to-point) interfaces show FULL/ - (no DR election on P2P links)
show ip ospf neighbor vs clear ip ospf process
Both commands are essential for OSPF troubleshooting but serve opposite purposes: one reveals current neighbor relationships, while the other destroys them. Network engineers often confuse them because they both deal with OSPF adjacencies, yet one is read-only and the other is a disruptive reset.
| Aspect | show ip ospf neighbor | clear ip ospf process |
|---|---|---|
| Scope | displays neighbor table per interface | resets entire OSPF process |
| Modification | no changes to state | tears down all adjacencies |
| Persistence | state is transient snapshot | clears persistent adjacency state |
| Precedence | low impact, safe diagnostic | high impact, disruptive |
| Typical use | verifying neighbor states | forcing OSPF restart |
Use show ip ospf neighbor when you need to check current OSPF neighbor status and adjacency states without affecting network operation.
Use clear ip ospf process when you must force an OSPF re-initialization due to stuck adjacencies or configuration changes requiring a fresh start.
Platform Notes
In IOS-XE (e.g., Catalyst 9000 switches), the 'show ip ospf neighbor' command syntax and output are largely identical to classic IOS. However, some newer platforms may include additional fields like 'BFD' status if BFD is enabled. The command is available in privileged EXEC mode.
For NX-OS (e.g., Nexus switches), the equivalent command is 'show ip ospf neighbors'. The output format differs slightly: it includes columns like 'Neighbor ID', 'Pri', 'State', 'Dead Time', 'Address', 'Interface', but may also show 'Uptime'. NX-OS also supports 'show ip ospf neighbors detail' for detailed output. Note that NX-OS uses a different OSPF configuration model (VRF-aware).
On ASA firewalls, OSPF neighbor information is displayed using 'show ospf neighbor' (without 'ip'). The output is similar but may include security context information. ASA does not support all IOS parameters.
In IOS-XR (e.g., ASR 9000), the command is 'show ospf neighbor' (no 'ip'). The output is more detailed and includes instance and VRF information. IOS-XR also supports XML output for automation.
Differences between IOS versions: In older IOS (12.x), the output might not show the 'Dead Time' field in the same format. In 15.x and 16.x, the output is more consistent. Some versions may include 'State/Priority' as a combined field. Always check the specific platform documentation for exact syntax.
Related Commands
clear ip ospf process
Resets all OSPF processes, tearing down all neighbour adjacencies and flushing the LSDB, forcing OSPF to re-elect the DR/BDR and rebuild the routing table from scratch.
auto-cost reference-bandwidth
Changes the OSPF reference bandwidth used to calculate interface costs. Default is 100 Mbps, which assigns cost 1 to any interface 100 Mbps or faster — causing FastEthernet and GigabitEthernet to have the same cost.
show ip interface brief
Displays a one-line summary of all interfaces showing the IP address assigned, operational status (up/down), and line protocol status. The fastest way to get a device health overview.
Practice for the CCNA 200-301
Test your knowledge with practice questions covering all CCNA 200-301 exam domains.
Practice CCNA 200-301 Questions