show ip ospf database
Displays the OSPF link-state database (LSDB) to verify OSPF adjacencies, check for missing or corrupt LSAs, and troubleshoot OSPF routing issues.
show ip ospf databaseWhen to Use This Command
- Verify that all expected LSAs (Type 1, 2, 3, etc.) are present in the LSDB after configuring OSPF.
- Troubleshoot missing routes by checking if Type 3 summary LSAs are being generated by the ABR.
- Confirm that an ASBR is advertising external routes by looking for Type 5 LSAs.
- Check the age and sequence number of LSAs to detect OSPF instability or flapping neighbors.
Command Examples
Basic OSPF Database Display
show ip ospf database OSPF Router with ID (192.168.1.1) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
192.168.1.1 192.168.1.1 345 0x80000004 0x00B2D4 2
192.168.1.2 192.168.1.2 567 0x80000003 0x00A1C3 3
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
192.168.1.3 192.168.1.3 234 0x80000001 0x0099E1
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
10.0.0.0 192.168.1.2 123 0x80000002 0x00CC44
Summary ASB Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
192.168.2.1 192.168.1.2 456 0x80000001 0x00DD55
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
0.0.0.0 192.168.2.1 789 0x80000001 0x00EE66 0The output is organized by LSA type. 'Router Link States' shows Type 1 LSAs from each router (identified by Link ID = Router ID). 'Net Link States' shows Type 2 LSAs from the DR (Link ID = DR's interface IP). 'Summary Net Link States' shows Type 3 LSAs from ABRs. 'Summary ASB Link States' shows Type 4 LSAs (ASBR summary). 'Type-5 AS External Link States' shows external routes. Key fields: ADV Router (advertising router), Age (seconds since LSA originated, should be < 1800 for stability), Seq# (increments with each update; higher is newer), Checksum (integrity check).
Display OSPF Database for a Specific LSA Type
show ip ospf database router 192.168.1.1 OSPF Router with ID (192.168.1.1) (Process ID 1)
Router Link States (Area 0)
LS age: 345
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 192.168.1.1
Advertising Router: 192.168.1.1
LS Seq Number: 80000004
Checksum: 0xB2D4
Length: 48
Number of Links: 2
Link connected to: a Transit Network
(Link ID) Designated Router address: 192.168.1.3
(Link Data) Router Interface address: 192.168.1.1
Number of MTID metrics: 0
TOS 0 Metrics: 10
Link connected to: a Stub Network
(Link ID) Network/subnet number: 192.168.1.0
(Link Data) Network Mask: 255.255.255.0
Number of MTID metrics: 0
TOS 0 Metrics: 10This shows detailed information for a specific Type 1 LSA. 'LS age' should be low (<1800) for a stable network. 'Link State ID' and 'Advertising Router' identify the originator. 'Number of Links' shows how many interfaces are participating in OSPF. Each link entry describes the type (transit, stub, etc.), the neighbor's DR address, and the metric (cost). A high age or rapidly changing Seq# may indicate instability.
Understanding the Output
The 'show ip ospf database' command displays the entire OSPF link-state database, organized by LSA type. Each section corresponds to a different LSA type: Type 1 (Router), Type 2 (Network), Type 3 (Summary), Type 4 (ASBR Summary), and Type 5 (External). The 'Link ID' field identifies the LSA's origin (e.g., Router ID for Type 1, DR's interface IP for Type 2). 'ADV Router' is the router that originated the LSA. 'Age' is the time in seconds since the LSA was first created; values approaching 1800 (MaxAge) indicate the LSA is about to be flushed. 'Seq#' is a sequence number that increments with each update; a higher number means a more recent LSA. 'Checksum' is used for error detection. In a stable network, ages should be relatively low and consistent, and sequence numbers should not be jumping erratically. Missing or incomplete sections can indicate adjacency problems or misconfigurations (e.g., no Type 3 LSAs if ABR is not working).
CCNA Exam Tips
CCNA exam tip: Know that Type 1 LSAs are generated by every router, Type 2 by the DR, Type 3 by ABRs, Type 4 by ABRs for ASBRs, and Type 5 by ASBRs.
CCNA exam tip: The 'show ip ospf database' command is used to verify that the LSDB is synchronized; if an LSA is missing, the route will not be in the routing table.
CCNA exam tip: In the exam, you may be asked to identify which router is the DR based on Type 2 LSA output (the Link ID is the DR's interface IP).
CCNA exam tip: A high 'Age' value (close to 1800) indicates the LSA is about to expire; if it resets to 0, the LSA was refreshed. Frequent refreshes may indicate a flapping link.
Common Mistakes
Mistake 1: Confusing 'Link ID' with 'ADV Router' — the Link ID identifies the object (e.g., router ID or network), while ADV Router is the router that sent the LSA.
Mistake 2: Assuming that missing Type 5 LSAs mean no external routes exist — check if the ASBR is properly configured and reachable.
Mistake 3: Ignoring the 'Age' field — if ages are consistently high or vary wildly, it may indicate OSPF instability or a router with a bad clock.
Related Commands
show ip ospf
Displays general information about OSPF routing process, including router ID, areas, and LSDB statistics, used to verify OSPF configuration and operational status.
show ip ospf neighbor
Displays OSPF neighbor information to verify adjacency formation and troubleshoot OSPF neighbor relationships.
Practice for the CCNA 200-301
Test your knowledge with hundreds of CCNA practice questions covering all exam domains.
Practice CCNA Questions