show ip ospf database is the most useful command in OSPF and the least readable. It prints a stack of section headers and not one of them says "Type 1" or "Type 5". You are expected to already know that "Summary Net Link States" means Type 3, that "Summary ASB Link States" means Type 4, and that those two do completely different jobs even when they show the same Link ID.
This page maps every LSA type onto real output from a lab built to produce all of them at once: three routers on IOS XE 17.18.2 (iol-xe nodes in Cisco Modeling Labs), with R1 in area 0, R2 as an ABR in both areas, and R3 redistributing a static so it becomes an ASBR. Every capture below came off R1. For the surrounding context, the OSPF routing protocol guide covers areas, adjacency and cost.
One honesty note: the lab used normal areas, so it produced no Type 7. Types 1 through 5 are backed by captured output. Type 7, and the types you will almost never meet, are explained in prose with no invented CLI attached.
The lab behind these captures
area 0 area 1
[R1]--------------[R2 = ABR]--------------[R3 = ASBR]
Lo0 1.1.1.1 Lo0 2.2.2.2 Lo0 3.3.3.3
Et0/0 10.0.12.1 Et0/0 10.0.12.2 Et0/0 10.0.23.2
(broadcast) Et0/1 10.0.23.1 ip route 172.16.50.0/24 Null0
Three choices produce the five types. R1 to R2 is left as a broadcast segment, so a DR is elected and a Type 2 exists. R2 has one interface in each area, making it an ABR, which gives you Type 3 and Type 4. R3 runs redistribute static subnets against a route to Null0, making it an ASBR, which gives you Type 5. Captures came from an on-box EEM applet logging verbatim show output to syslog, so the blocks below are what the device printed.
Every LSA type in one command
One command on R1, five sections, five LSA types (the arrows are annotations, not device output):
R1# show ip ospf database
OSPF Router with ID (1.1.1.1) (Process ID 1)
Router Link States (Area 0) <-- Type 1 (Router LSA)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1.1 1.1.1.1 136 0x80000004 0x006278 2
2.2.2.2 2.2.2.2 134 0x80000005 0x005378 2
Net Link States (Area 0) <-- Type 2 (Network LSA, DR = 10.0.12.2)
Link ID ADV Router Age Seq# Checksum
10.0.12.2 2.2.2.2 137 0x80000001 0x00AC64
Summary Net Link States (Area 0) <-- Type 3 (Summary LSA, from ABR R2)
Link ID ADV Router Age Seq# Checksum
3.3.3.3 2.2.2.2 137 0x80000001 0x0031EC
10.0.23.0 2.2.2.2 186 0x80000001 0x001FED
Summary ASB Link States (Area 0) <-- Type 4 (ASBR-Summary, points at ASBR 3.3.3.3)
Link ID ADV Router Age Seq# Checksum
3.3.3.3 2.2.2.2 137 0x80000001 0x001905
Type-5 AS External Link States <-- Type 5 (External LSA, from ASBR R3)
Link ID ADV Router Age Seq# Checksum Tag
172.16.50.0 3.3.3.3 177 0x80000001 0x00DFC5 0
The section headings are the part nobody memorises, so here they are against the type number they mean:
Scope is printed for you: anything headed "(Area 0)" is area-scoped, and the Type-5 header carries no area because it floods domain-wide. The Age column runs independently per LSA (134 to 186 seconds here) because each was originated at a different moment and refreshes on its own clock. For the flooding mechanics behind those numbers, see how OSPF floods link-state updates between routers.
Type 1: Router LSA
Describes: a router's own links, inside one area
Generated by: every OSPF router, one per area it has interfaces in
Flooded: within the local area only, never across an ABR
Link State ID: the originating router's Router ID
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1.1 1.1.1.1 136 0x80000004 0x006278 2
2.2.2.2 2.2.2.2 134 0x80000005 0x005378 2
The giveaway is that Link ID and ADV Router hold the same value: a router advertising its own links keys the LSA on its own Router ID. If those columns ever disagree here, you are looking at a duplicate Router ID, not a normal database.
Link count is 2 for both routers and matches the topology exactly: a loopback (stub link) plus Ethernet0/0 into the broadcast segment (transit link). R2's area 1 interface is not counted, because it lives in a separate area 1 Router LSA that R1 will never see. That is why multi-area OSPF scales, covered in the breakdown of why OSPF splits a network into areas.
Type 2: Network LSA
Describes: a multi-access segment and the routers attached to it
Generated by: the Designated Router only, one per segment
Flooded: within the local area only
Link State ID: the DR's interface IP on that segment
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
10.0.12.2 2.2.2.2 137 0x80000001 0x00AC64
The Link ID is an interface address rather than a Router ID, and that is how you spot a Type 2: it is the only LSA keyed on an interface IP. It also tells you R2 won the DR election on 10.0.12.0/30, since only the DR originates it.
Convert the link with ip ospf network point-to-point and this LSA disappears entirely, the segment being described purely inside the two Router LSAs. And when the DR changes, the old Type 2 is flushed and a new one appears keyed on the new DR's address, which is why a DR flap briefly rewrites part of every LSDB in the area.
Type 3: Summary LSA
Describes: a prefix that lives in a different area
Generated by: Area Border Routers
Flooded: into the adjacent area, regenerated by each ABR it crosses
Link State ID: the network address being advertised
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
3.3.3.3 2.2.2.2 137 0x80000001 0x0031EC
10.0.23.0 2.2.2.2 186 0x80000001 0x001FED
R2 is the ABR, so R2 advertises both. Area 1 holds exactly two prefixes that matter to area 0, R3's loopback and the 10.0.23.0/30 link, and both cross the border stamped with R2's Router ID.
The word "Summary" is misleading. A Type 3 is not aggregated by default, it is one LSA per prefix. It summarises the topology away, not the addressing: R1 learns that 10.0.23.0/30 exists and what it costs, but learns nothing about area 1's internal links and runs no SPF over them. Aggregation only happens when you configure area 1 range on the ABR.
Type 4: ASBR Summary LSA
Describes: how to reach an ASBR that lives in another area
Generated by: ABRs
Flooded: into the adjacent area
Link State ID: the ASBR's Router ID
Summary ASB Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
3.3.3.3 2.2.2.2 137 0x80000001 0x001905
Type 4 is the one people forget, and this capture shows why it confuses everyone: 3.3.3.3 appears as a Link ID in both the Type 3 and the Type 4 section, from the same router, in the same area, at the same age. They are not duplicates. The Type 3 entry is a route to a prefix (R3's loopback /32, which lands in the RIB as O IA 3.3.3.3). The Type 4 entry is a route to a router identity, carries no usable prefix, and exists only so that routers in area 0 can resolve the ASBR named inside the Type 5.
That matters because the Type 5 floods domain-wide unchanged, still naming 3.3.3.3 as its originator, and any router wanting the external route must first compute a path to 3.3.3.3 as an ASBR. Routers inside area 1 do that from Type 1 LSAs they already hold. Routers in area 0 cannot, because area 1's topology never reaches them. Without the Type 4, R1 holds a valid Type 5 and still refuses to install the route. If you are staring at an external LSA with no matching route, check the Summary ASB section before anything else, a symptom worked through in the guide to OSPF routes that sit in the database but never reach the routing table. No Type 4 exists inside area 1 itself, because the ASBR is local there.
Type 5: External LSA
Describes: a prefix redistributed into OSPF from somewhere else
Generated by: ASBRs
Flooded: across the whole domain, unchanged (except into stub and NSSA areas)
Link State ID: the external network address
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
172.16.50.0 3.3.3.3 177 0x80000001 0x00DFC5 0
The header carries no area, because this is the only domain-wide LSA in the capture. And the advertising router is 3.3.3.3, not the ABR: unlike a Type 3, a Type 5 is not regenerated at the border, so R1 in area 0 is reading the original LSA R3 produced in area 1. The detail view carries the fields that decide how the route behaves:
R1# show ip ospf database external
OSPF Router with ID (1.1.1.1) (Process ID 1)
Type-5 AS External Link States
LS age: 177
Options: (No TOS-capability, DC, Upward)
LS Type: AS External Link
Link State ID: 172.16.50.0 (External Network Number )
Advertising Router: 3.3.3.3
LS Seq Number: 80000001
Checksum: 0xDFC5
Length: 36
Network Mask: /24
Metric Type: 2 (Larger than any link state path)
MTID: 0
Metric: 20
Forward Address: 0.0.0.0
External Route Tag: 0
Metric Type: 2 is the default for redistributed routes and produces the E2 in the routing table. E2 means the cost you see is the LSA metric and nothing else, with the internal cost of reaching the ASBR discarded. E1 (set with metric-type 1 on the redistribute statement) adds internal path cost on top, which is what you want when several ASBRs advertise the same prefix and each router should prefer the nearest one. Metric: 20 is simply the IOS default for a redistributed route, regardless of what it cost in its source protocol.
Forward Address: 0.0.0.0 means "send it to me, the advertising ASBR". A non-zero forwarding address changes the calculation completely, since routers then resolve that address instead of the ASBR and drop the route if they cannot reach it. That happens more often than you would like on multi-access segments, and it deserves its own read on what a non-zero forwarding address in an external LSA changes.
External Route Tag: 0 is a 32-bit field OSPF carries but never acts on. Set it during redistribution and match on it later to stop routes looping back where they came from, a discipline covered in the OSPF redistribution configuration walkthrough.
Type 7: NSSA External LSA
This lab did not produce a Type 7. All three routers used normal areas, so there is no captured output for it and nothing below is a screenshot of anything. To see it yourself, rebuild the topology with area 1 nssa on R2 and R3.
Describes: an external prefix injected by an ASBR inside a Not-So-Stubby Area
Generated by: the ASBR inside the NSSA
Flooded: within the NSSA only
Appears as: a "Type-7 AS External Link States" section, and O N1 or O N2 route codes
Type 7 exists to resolve a rules conflict. A stub area refuses Type 5 by definition, but sometimes the area you want to stub is exactly the one with a router redistributing something (a branch with a firewall handing over a couple of statics, typically). NSSA is the compromise: Type 5 stays blocked at the ABR, but the local ASBR may originate the same information as a Type 7 that floods only inside the NSSA. At the border, an ABR translates it into a Type 5 and floods that onward, after which it behaves exactly like the Type 5 above. Translation is controlled by the P bit, and where there are several ABRs the highest Router ID does the job so the prefix is not translated twice. That story, plus the full stub, totally stubby, NSSA and totally NSSA comparison, is in the guide to configuring stub and NSSA areas on IOS.
Types 6 and 8 to 11
- Type 6, Group Membership LSA (MOSPF): defined for multicast OSPF, never implemented by Cisco.
- Type 8, Link LSA: OSPFv3 only. Carries a router's link-local address and IPv6 prefixes to neighbours on the link.
- Types 9, 10, 11, Opaque LSAs: generic containers with link-local, area-local and domain-wide scope. Type 10 is the one you meet in the field, carrying MPLS traffic engineering attributes and segment routing information.
From LSA to route code in the routing table
Each type ends up as a specific route code, which is the fastest way to reason backwards from a routing table to a database problem. Same lab, same moment, R1's view:
R1# show ip route ospf
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/11] via 10.0.12.2, 00:02:17, Ethernet0/0
3.0.0.0/32 is subnetted, 1 subnets
O IA 3.3.3.3 [110/21] via 10.0.12.2, 00:02:17, Ethernet0/0
10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O IA 10.0.23.0/30 [110/20] via 10.0.12.2, 00:02:17, Ethernet0/0
172.16.0.0/24 is subnetted, 1 subnets
O E2 172.16.50.0 [110/20] via 10.0.12.2, 00:02:17, Ethernet0/0
The metrics confirm each origin. O 2.2.2.2 [110/11] is intra-area from Types 1 and 2, cost 11 being the Ethernet segment (10) plus the loopback stub link (1). O IA 3.3.3.3 [110/21] comes from a Type 3, so the ABR passed on area 1's internal cost (10 plus 10 plus 1) while hiding its topology. O E2 172.16.50.0 [110/20] comes from the Type 5, and 20 is that LSA's Metric: 20 field copied straight through: R1 sits two hops and 20 units of internal cost from the ASBR and none of it appears. That is the E2 rule in action, and with metric-type 1 the same line would read 40.
The mapping to keep in your head: O for Types 1 and 2, O IA for Type 3, O E1 and O E2 for Type 5, O N1 and O N2 for Type 7. Type 4 produces no route code of its own, which is exactly why its absence is so hard to spot.
LSA types at a glance
*Except stub, totally stubby and NSSA areas.
Get the OSPF Field Reference - 9 pages, free
Everything you'd want to remember about OSPF on nine printable pages. State machine diagram, LSA types, troubleshooting decision tree, copy-paste IOS XE templates, and real lab captures. Free for PingLabz members - just sign up with your email.
How LSAs flow through a multi-area network
Multi-area network with external routes
Scale the lab up and the same rules give a predictable pattern. Take a four-router version, NSSA at one end, internet-facing ASBR at the other:
Area 10 (NSSA) Area 0 Area 20
[R4]------[R1]----[R2]----[R3]------Internet
ASBR ABR ABR (ASBR)
- Within area 10: Type 1 from every router, and Type 7 from R4 (Type 5 is not allowed here).
- R1, the NSSA ABR: Type 3 in both directions, Type 5 translated from R4's Type 7, and a Type 4 pointing area 0 at R4 so those externals are usable.
- Within area 0: Types 1 and 2 for local links, Type 3 arriving from areas 10 and 20, Type 5 from both ASBRs passing through unchanged.
- R3, the internet ASBR: a Type 5 carrying the default route.
- R2, the area 20 ABR: Type 3 for area 0's prefixes, plus a Type 4 telling area 20 how to reach R3.
The pattern to internalise: Types 1 and 2 stop at the ABR, Type 3 is regenerated by every ABR it crosses, Type 5 passes through untouched, and Type 4 is created wherever a Type 5's originator is out of area.
Viewing LSAs
Show every LSA
R1# show ip ospf database
Show one type at a time
R1# show ip ospf database router
R1# show ip ospf database network
R1# show ip ospf database summary
R1# show ip ospf database asbr-summary
R1# show ip ospf database external
R1# show ip ospf database nssa-external
Show one LSA by Link State ID
R1# show ip ospf database summary 192.168.1.0
R1# show ip ospf database external 172.16.50.0
R1# show ip ospf database router 1.1.1.1
Two more pay for themselves during an incident. show ip ospf database database-summary gives per-area LSA counts without the wall of text, which is how you spot an area that suddenly grew ten thousand Type 3 entries. show ip ospf database self-originate shows only what this router produced.
If you would rather compare databases than read them, the OSPF database is one of the structures Genie parses into JSON, so you can snapshot the LSDB either side of a maintenance window and diff it programmatically instead of eyeballing sequence numbers, as shown in the walkthrough on diffing Cisco operational state with pyATS and Genie.
LSAs and area types
Area type is just a filter on which LSA types the ABR will let through. Read it as a permissions list.
Standard area
- Allows: Types 1, 2, 3, 4, 5
Stub area
- Allows: Types 1, 2, 3
- Blocks: Types 4 and 5
- ABR injects: a default route as a Type 3
Totally stubby area
- Allows: Types 1, 2
- Blocks: Type 3 (except the default), Types 4 and 5
NSSA
- Allows: Types 1, 2, 3, 7
- Blocks: Types 4 and 5
- ABR converts: Type 7 into Type 5 on the way out
Totally NSSA
- Allows: Types 1, 2, 7
- Blocks: Type 3 (except the default), Types 4 and 5
Gotchas from the lab
- The same Link ID in two sections is normal. 3.3.3.3 appeared as both a Type 3 and a Type 4 here. One is a /32 prefix, the other a router identity. Reading the section header is not optional.
- Type 4 has no route code, so its absence is silent. Nothing in
show ip routetells you one is missing. You just get an external route that will not install. - The Type 5 advertising router is the ASBR, not the ABR. It is the only LSA that crosses an area boundary with its originator field untouched, which is the entire reason Type 4 has to exist.
- Type 2 is a configuration artefact. It exists only because R1 to R2 is a broadcast segment. Set
ip ospf network point-to-pointon both ends and the Net Link States section empties out. - Metric 20 is a default, not a measurement. Redistributed prefixes get 20 whatever they cost in the source protocol, and with E2 every router in the domain sees that same number no matter how far away it is.
- Ages drift, and that is fine. LSAs here ranged from 134 to 186 seconds because each was originated at a different moment. An age that keeps resetting is the real problem.
Key takeaways
- Type 1 (Router) has Link ID equal to ADV Router, describes one router's links, and never leaves its area.
- Type 2 (Network) is keyed on the DR's interface IP and exists only on multi-access segments with a DR.
- Type 3 (Summary) is one LSA per inter-area prefix from the ABR, and summarises topology rather than addresses unless you configure
area range. - Type 4 (ASBR-Summary) carries no prefix. It exists purely so out-of-area routers can resolve the ASBR named inside a Type 5.
- Type 5 (External) crosses areas unchanged, defaults to metric 20 and metric type E2, and a forwarding address of 0.0.0.0 means "route via me".
- Type 7 (NSSA External) is a Type 5 that is allowed inside an NSSA and gets translated at the ABR on the way out.
- Route codes reverse the mapping: O is Types 1 and 2, O IA is Type 3, O E1 and O E2 are Type 5, O N1 and O N2 are Type 7, and Type 4 has none.
Where to go next
The LSDB is the input to the algorithm, not the output. Once you can read every type on this page, the next question is what the router does with them, answered in the breakdown of how SPF turns the link-state database into a routing table. If you would rather shrink the database than read it, area design is the lever, and the complete OSPF reference hub collects the area, cost and troubleshooting material in one place.