OSPFEXEC

show ospf neighbor

Displays OSPF neighbor information, including neighbor state, interface, and adjacency details.

Overview

The 'show ospf neighbor' command is a fundamental troubleshooting and monitoring tool for OSPF (Open Shortest Path First) networks on Cisco IOS-XR. It displays the current state of OSPF neighbor adjacencies, which are essential for exchanging routing information. OSPF uses Hello packets to discover and maintain neighbor relationships, and the neighbor state machine progresses through Down, Attempt, Init, 2-Way, ExStart, Exchange, Loading, and Full states. This command shows the current state for each neighbor, allowing engineers to quickly assess the health of OSPF adjacencies. On Cisco IOS-XR, the command syntax is similar to classic IOS but with VRF support and process-id optional. It is used during initial configuration to verify adjacencies form, after network changes to ensure stability, and during troubleshooting to identify why adjacencies are not forming or are flapping. The output includes key fields: Neighbor ID (Router ID), Priority (used for DR/BDR election), State (adjacency state and role), Dead Time (time until neighbor declared dead), Address (neighbor interface IP), and Interface (local interface). The detail option provides deeper insight into the adjacency, including DR/BDR addresses, options, retransmission counters, and uptime. Understanding this command is critical for CCNP and CCIE candidates, as OSPF is a core routing protocol.

Syntax·EXEC
show ospf [vrf {vrf-name}] [process-id] neighbor [interface-type interface-number] [neighbor-id] [detail]

When to Use This Command

  • Verify OSPF neighbor adjacencies are forming correctly after configuration changes.
  • Troubleshoot OSPF neighbor state issues (e.g., stuck in INIT or EXSTART).
  • Monitor OSPF neighbor stability and DR/BDR elections in broadcast networks.
  • Check neighbor details for a specific interface or neighbor ID during network maintenance.

Parameters

ParameterSyntaxDescription
vrfvrf {vrf-name}Specifies the VRF (Virtual Routing and Forwarding) instance. Use this to view OSPF neighbors in a specific VRF. If omitted, the default VRF is used.
process-id[process-id]The OSPF process ID (numeric). If only one OSPF process exists, it can be omitted. Use when multiple OSPF processes are configured.
interface-type interface-number[interface-type interface-number]Filters neighbors learned on a specific interface. For example, 'GigabitEthernet0/0/0/0'. Useful for focusing on a single link.
neighbor-id[neighbor-id]The Router ID of a specific neighbor. Displays details only for that neighbor. Combine with 'detail' for full information.
detail[detail]Provides extended information about each neighbor, including DR/BDR, options, retransmission statistics, and adjacency uptime.

Command Examples

Basic OSPF neighbor summary

show ospf neighbor
Neighbors for OSPF 1

Neighbor ID     Pri   State           Dead Time   Address         Interface
10.1.1.2          1   FULL/DR         00:00:34    192.168.1.2     GigabitEthernet0/0/0/0
10.2.2.2          1   FULL/BDR        00:00:32    192.168.2.2     GigabitEthernet0/0/0/1
10.3.3.3          1   2WAY/DROTHER    00:00:36    192.168.3.3     GigabitEthernet0/0/0/2

Neighbor ID: Router ID of the neighbor. Pri: OSPF priority (default 1). State: Adjacency state (FULL = fully adjacent) and role (DR, BDR, DROTHER). Dead Time: Time until neighbor is declared dead. Address: Neighbor interface IP. Interface: Local interface.

Detailed OSPF neighbor information

show ospf neighbor 10.1.1.2 detail
 Neighbor 10.1.1.2, interface address 192.168.1.2
    In the area 0.0.0.0 via interface GigabitEthernet0/0/0/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 0x52 (L LSR LLS)
    Dead timer due in 00:00:34
    Neighbor is up for 02:15:30
    Number of DBD retransmissions during last exchange: 0
    Index 1/1, retransmission queue length 0, number of retransmission 0
    First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
    Last retransmission scan length is 0, time is 0 msec
    Adjacency count 1

Detailed output shows area, interface, priority, state changes, DR/BDR, options, dead timer, uptime, DBD retransmissions, retransmission queue, and adjacency count. Healthy values: State FULL, dead timer counting down, retransmission queue length 0.

Understanding the Output

The 'show ospf neighbor' command output provides a snapshot of OSPF neighbor adjacencies. The first line indicates the OSPF process. Each row shows a neighbor with its Router ID (Neighbor ID), priority, state, dead timer, interface IP, and local interface. The State field is critical: FULL means the adjacency is complete and LSDBs are synchronized; 2WAY indicates a neighbor relationship without full adjacency (common in broadcast networks with multiple neighbors); INIT or EXSTART indicate problems. The Dead Timer shows seconds until the neighbor is considered dead (should reset on each hello). In broadcast networks, the role (DR, BDR, DROTHER) indicates the neighbor's role in the network. The 'detail' option provides additional information such as area, DR/BDR IPs, options flags, uptime, and retransmission statistics. Healthy output shows FULL state, low retransmission counts, and a decreasing dead timer. Problem indicators: state stuck in INIT or EXSTART, dead timer expired, or high retransmission counts.

Configuration Scenarios

Verifying OSPF neighbor adjacency after configuration

You have configured OSPF on two routers (R1 and R2) connected via GigabitEthernet0/0/0/0. You need to verify that the adjacency forms correctly.

Topology

R1 (10.1.1.1) --- Gig0/0/0/0 --- R2 (10.2.2.2) IP: 192.168.1.1/24 on R1, 192.168.1.2/24 on R2

Steps

  1. 1.Configure OSPF on R1 and R2 with network statements or interface commands.
  2. 2.On R1, issue 'show ospf neighbor' to see if R2 appears.
  3. 3.Check that the state is FULL and dead timer is counting down.
Configuration
! R1 configuration
router ospf 1
 router-id 10.1.1.1
 network 192.168.1.0 0.0.0.255 area 0
! R2 configuration
router ospf 1
 router-id 10.2.2.2
 network 192.168.1.0 0.0.0.255 area 0

Verify: On R1: 'show ospf neighbor' should show R2 with state FULL/DR or FULL/BDR. Also 'show ip route ospf' to verify routes.

Watch out: Ensure router IDs are unique and reachable; duplicate router IDs cause adjacency issues.

Troubleshooting with This Command

When troubleshooting OSPF neighbor issues on Cisco IOS-XR, start with 'show ospf neighbor' to identify the neighbor state. Common problems include neighbors stuck in INIT or EXSTART. If stuck in INIT, check that Hello packets are being received (use 'show ospf interface' to see hello timer and dead timer). Verify IP connectivity with ping. If stuck in EXSTART, check MTU mismatch (OSPF uses MTU in DBD packets; ensure consistent MTU on both ends). Also verify authentication if configured. If neighbor state is FULL but routes missing, check LSDB synchronization with 'show ospf database'. For flapping neighbors, examine dead timer and hello intervals; they must match. Use 'debug ospf hello' cautiously in production. On IOS-XR, the command 'show ospf neighbor detail' provides retransmission counters; high values indicate packet loss. Also check interface OSPF cost and network type (broadcast vs point-to-point) with 'show ospf interface'. For DR/BDR issues in broadcast networks, verify priority settings. If neighbors are not forming, ensure OSPF is enabled on the interface and area ID matches. Use 'show running-config router ospf' to verify configuration.

CCNA Exam Tips

1.

Remember that FULL state is required for LSDB exchange; 2WAY is normal for DROTHERs.

2.

In broadcast networks, DR and BDR are elected based on priority (highest wins, tie-breaker by Router ID).

3.

The dead timer is 4x hello interval by default (40 seconds for broadcast).

Common Mistakes

Assuming all neighbors must be in FULL state; DROTHERs can be in 2WAY.

Forgetting to specify the process ID if multiple OSPF processes exist.

Misinterpreting 'Dead Time' as time since last hello (it's time until expiration).

Platform Notes

On Cisco IOS-XR, the 'show ospf neighbor' command behaves similarly to classic IOS but with some differences. IOS-XR supports VRFs, so you can specify 'vrf vrf-name' to view neighbors in a specific VRF. The process ID is optional if only one OSPF process exists. The output format is slightly different: IOS-XR uses 'Neighbors for OSPF 1' header and shows 'Dead Time' in hh:mm:ss format. The 'detail' output includes 'Options is 0x52 (L LSR LLS)' indicating OSPF options. IOS-XR also supports 'show ospf neighbor [interface] [neighbor-id]' filtering. Equivalent commands on other platforms: Juniper 'show ospf neighbor', Arista 'show ip ospf neighbor'. In IOS-XR, the command is available in EXEC mode; no 'do' prefix needed. Version differences: In earlier IOS-XR releases, the command might not support VRF; check documentation. For troubleshooting, IOS-XR also provides 'show ospf neighbor statistics' for packet counters.

Practice for the CCNA 200-301

Test your knowledge with hundreds of CCNA practice questions covering all exam domains.

Practice CCNA Questions