Course contents

Module 4: OSPF FeaturesLesson 4.4 (4 of 5 in this module)15 of 29 in the OSPF course

OSPF LSA types 1, 2 and 3

Why does the OSPF database contain router IDs, interface addresses and network addresses in different sections? Let's learn what each record describes before reading the output.

Intermediate · 12 min read

Three sections of a database seen for the first time

A router cannot choose a path just from a list of router names. It needs to know which routers connect, which networks attach to them and what each outgoing connection costs. A link-state advertisement (LSA) is a record carrying part of that information. The link-state database (LSDB) stores the records used in OSPF's path calculation.

An LSA type tells you what a record describes, who creates it and where it can travel. An LSA is not a user packet or a route-table entry. OSPF transports LSAs inside link-state update packets, then calculates routes from the stored information.

A link-state update (LSU) is the OSPF packet that carries one or more complete LSAs. Think of the difference as the delivery message and the individual records inside it. They have separate type numbers: an LSU is OSPF packet type 4, while the records inside it can be LSA types 1, 2 or 3. An LSA type 3 is therefore not an OSPF packet type 3. Routers acknowledge LSA instances and can retransmit records when needed.

You run show ip ospf database on a router for the first time and get three sections of entries headed Router Link States, Net Link States and Summary Net Link States, full of IDs that look like IP addresses but aren't always. Each section is a different kind of LSA. Once you know who writes each kind and what it describes, the database becomes a readable map of the network, and a powerful troubleshooting tool.

A two-area network with one ABR

To see all three types, this lesson uses a small network with two areas. R2 is the ABR (area border router): its Gi0/1 is in area 1 and its Gi0/0 in area 0. In area 0, R2, R3 and R4 share one Ethernet segment, 10.0.0.0/24, where R4 is the DR. The R1–R2 link is configured as point-to-point. All interfaces are gigabit with the default reference bandwidth, so every interface costs 1.

LAN 1 is the source network, 192.168.1.0/24, behind R1. LAN 3, 192.168.3.0/24, is behind R3. A user on LAN 1 needs to reach a server on LAN 3. R2 connects the two areas. SW1 is a Layer 2 switch joining R2, R3 and R4 on one shared Ethernet subnet; it does not calculate OSPF routes.

For a host test, use PC-1 at 192.168.1.10/24 with gateway R1 Gi0/0 192.168.1.1, and the server at 192.168.3.10/24 with gateway R3 Gi0/1 192.168.3.1. R1 Gi0/1 is 10.1.12.1/30; R2 Gi0/1 is 10.1.12.2/30. On shared area 0, R2/R3/R4 Gi0/0 use 10.0.0.2/.3/.4 with /24 masks. These are interface addresses, while 1.1.1.1 through 4.4.4.4 are router IDs. The LAN interfaces are passive but selected for OSPF, so their prefixes are still advertised.

A designated router (DR) organises database exchanges on a shared segment. R4 has that role in this example. Its router ID is 4.4.4.4, while its address on the segment is 10.0.0.4. Those identifiers have different jobs.

Locate the devices, areas and advertised networks
Gi0/0Gi0/1 .1.2 Gi0/110.1.12.0/30Gi0/0 .2Gi0/0 .3Gi0/0 .4Gi0/1LAN 1Subnet 192.168.1.0/24R1RID 1.1.1.1R2 (ABR)RID 2.2.2.2SW1Subnet 10.0.0.0/24R3RID 3.3.3.3R4 (DR)RID 4.4.4.4LAN 3Subnet 192.168.3.0/24

Device key: LAN 1, LAN 3 (network / site) · R1, R2 (ABR), R3, R4 (DR) (router) · SW1 (switch)

Lines show the example’s network connections. Read the numbered steps for traffic direction and changes.

Reading the addresses

IP labels identify interfaces or destinations. Subnet labels identify networks; /n is the prefix length. A router ID (RID) identifies a routing process and need not be a reachable interface.

An IP address alone is not a URL. A web URL includes a scheme such as https://; an address on a router or printer does not imply a website.

  • LAN 1: Subnet 192.168.1.0/24
  • R1: RID 1.1.1.1
  • R2 (ABR): RID 2.2.2.2
  • SW1: Subnet 10.0.0.0/24
  • R3: RID 3.3.3.3
  • R4 (DR): RID 4.4.4.4
  • LAN 3: Subnet 192.168.3.0/24
  1. 1. Area 1: two router LSAs. R1 and R2 each describe their area 1 links. These stay inside area 1.
  2. 2. Area 0: three router LSAs. R2, R3 and R4 each describe their area 0 links. R2 writes a separate router LSA for each area it is in.
  3. 3. Area 0: one network LSA. R4, the DR, describes the 10.0.0.0/24 segment and lists R2, R3 and R4 as attached.
  4. 4. R2 advertises prefixes across the area border. Into area 0: 192.168.1.0/24 and 10.1.12.0/30. Into area 1: 10.0.0.0/24 and 192.168.3.0/24. Each with R2's cost to reach it.

Who writes each LSA and how far it travels

Who writes each LSA and how far it travels
Who writes each LSA and how far it travelsType; Created by; Describes; Flooded to; Link State ID. 1 Router: Every router, once per area it is in The router's links in that area: neighbours, segments, subnets, and their costs Its own area only The router ID 2 Network: The segment's DR, with at least one Full neighbour The segment mask, the DR and routers fully adjacent to it Its own area only The DR's interface IP address 3 Summary: An ABR A network in another area and the ABR's cost to reach it Into the other area(s) The network addressTypeCreated byDescribesFlooded toLink State ID1 RouterEvery router,once per area itis inThe router'slinks in thatarea: neighbours,segments,subnets, andtheir costsIts own area onlyThe router ID2 NetworkThe segment's DR,with at least oneFull neighbourThe segment mask,the DR androuters fullyadjacent to itIts own area onlyThe DR'sinterface IPaddress3 SummaryAn ABRA network inanother area andthe ABR's cost toreach itInto the otherarea(s)The networkaddress

On small screens, swipe sideways or focus the diagram and use the arrow keys.

Read each row across: the left box names the item, the others describe it.

Type 1: the router LSA

R3 creates a type 1 router LSA for area 0. It describes R3's connections in that area, including the shared segment and its own server LAN. R2 participates in two areas, so it creates a separate router LSA for each. R2's area 0 record does not include the detailed links inside area 1.

A router LSA is a protocol description of eligible OSPF links, not a complete inventory of every physical socket and CLI setting. Routers in a converged area learn each other's current topology records through flooding across adjacencies; they do not need to be directly cabled to every originator. R2's area 0 and area 1 router LSAs use the same router ID, but belong to different area databases.

Type 1: R3 describes its own two links in area 0
Type 1: R3 describes its own two links in area 0R3 router ID 3.3.3.3 advertises a router LSA in area 0. Its Gi0/0 at 10.0.0.3/24 points to transit segment DR address 10.0.0.4. Its Gi0/1 at 192.168.3.1/24 describes passive LAN 3 as a stub network. Both outgoing costs are 1.R3RID 3.3.3.3Transit network · cost 1Gi0/0 · 10.0.0.3/24Link ID: DR interface 10.0.0.4Stub network · cost 1Gi0/1 · 192.168.3.1/24LAN 3: 192.168.3.0/24 · passiveArea-local LSA
The type 1 Link State ID and Advertising Router are both R3's router ID. Stub network here means a link description, not an OSPF stub area. These records describe topology; they are not user packets.

Every router describes itself. Each entry in the LSA is one "link", of one of these kinds:

  • Point-to-point: a Full neighbour on a point-to-point link, named by its router ID. A numbered point-to-point link can also add a separate stub entry for its subnet.
  • Transit network: a shared segment with a DR. The entry points at the DR, and the details are in that segment's type 2 LSA.
  • Stub network: a reachable subnet represented without another router beyond that entry, such as a passive LAN or loopback host route. A numbered point-to-point link also has a stub entry for its subnet.

On the R1–R2 numbered point-to-point link, the router-to-router entry identifies the neighbour and the separate subnet entry describes 10.1.12.0/30. Two link entries can therefore come from one interface. Link count is not simply a physical-interface count. A stub-network link entry is also different from an OSPF stub area; our two areas remain normal areas.

Type 2: the network LSA

The type 2 network LSA describes a shared transit segment. Transit means routers can use the segment to reach another router, rather than only end hosts. R4 creates the record because it is the DR, not because it is the border between areas.

Type 2: the DR describes the shared segment
Type 2: the DR describes the shared segmentOn shared Ethernet 10.0.0.0/24 in area 0, R2 Gi0/0 is 10.0.0.2, R3 Gi0/0 is 10.0.0.3, and R4 Gi0/0 is 10.0.0.4. R4 is the established DR and originates the network LSA with link state ID 10.0.0.4 and advertising router 4.4.4.4, listing attached router IDs 2.2.2.2, 3.3.3.3 and 4.4.4.4.R2R4 · DRR3Gi0/010.0.0.2/24Gi0/010.0.0.4/24Gi0/010.0.0.3/24SW1 · area 0Network LSA: ID 10.0.0.4 · mask 255.255.255.0Advertising Router: 4.4.4.4Attached RIDs: 2.2.2.2 · 3.3.3.3 · 4.4.4.4
The Link State ID is the DR's interface address; the Advertising Router is its router ID. A switch forwards Ethernet frames and does not originate an OSPF LSA. R4's DR role is a given election result, not a claim that the highest ID always replaces an existing DR.

On a shared segment, listing every neighbour in every router's LSA would repeat the same information many times. Instead, each router only says "I'm on the segment whose DR is 10.0.0.4", and the DR writes one type 2 LSA listing itself and the neighbours fully adjacent to it. A type 2 LSA is originated while the DR has at least one Full neighbour on the segment. A LAN with a single router is just a stub network.

R3's transit entry points to 10.0.0.4, and R4's network LSA lists R3's router ID, 3.3.3.3. Together they describe the router-to-segment relationship used by the topology calculation. IP addresses that merely share a /24 do not prove this relationship; OSPF needs consistent link records. This models OSPF connectivity, not every cable or VLAN configuration inside SW1.

R4 originates the type 2 record; other routers can flood copies of it without becoming its creator. The BDR does not originate a second active network LSA for the same segment simply because it is the backup. If the DR changes, inspect the new DR address and advertising router rather than assuming 10.0.0.4 is a permanent segment identifier.

Type 3: the summary LSA

R3 needs a route to LAN 1, but it does not need every area 1 link in its database. R2 creates a type 3 summary LSA in area 0 describing LAN 1's prefix and R2's cost to it. R3 adds its own cost to reach R2. That produces an inter-area route: a route to a network in another OSPF area.

Type 3: the ABR originates reachability into another area
Type 3: the ABR originates reachability into another areaR2 is the ABR between area 1 and area 0. It originates a type 3 LSA for LAN 3 192.168.3.0/24 into area 1 with metric 2. R1 adds its cost 1 to reach R2, producing an O IA route metric 3 via next hop 10.1.12.2 on Gi0/1. R3's type 1 LSA is not flooded into area 1.Area 1Area 0R1R2 · ABRR3R1 Gi0/1 10.1.12.1/30R2 Gi0/1 10.1.12.2/30R2 Gi0/0 10.0.0.2/24R3 Gi0/0 10.0.0.3/24R1 → ABR cost 1ABR → LAN 3 cost 2Type 3: 192.168.3.0/24 · ADV Router 2.2.2.2 · metric 2R1 route: O IA 192.168.3.0/24 [110/3] via 10.1.12.2
A type 3 LSA is originated by the ABR; it does not forward the original area-local LSAs. The area 0 line abbreviates the shared Ethernet segment (SW1 and R4 omitted), not a new point-to-point link. One advertised prefix is not automatically an aggregated range.

Type 1 and 2 LSAs are flooded within their own area. An ABR runs SPF in each area, then tells the other area about eligible networks it found, normally one type 3 LSA per advertised network, each with the ABR's cost to reach it. The routers in area 1 do not receive R3's or R4's area 0 type 1 LSAs. Instead they learn "10.0.0.0/24 and 192.168.3.0/24 are reachable through R2 at these costs". That is how areas keep the database small. Routes learned this way show as O IA (inter-area). Despite the name, a summary LSA usually describes one network; it only covers a range if the ABR is configured to summarise.

The word summary does not mean that OSPF automatically combines all of an area's subnets. Here R2 advertises separate prefixes with their masks and costs. Deliberate address aggregation is a separate ABR configuration. R2 also originates the type 3 in the receiving area; it does not change R1's type 1 into a type 3 and pass the original record through.

Why the ABR passes on results, not the map

Inside an area, routers use the same converged topology records (types 1 and 2), but each computes a tree rooted at itself. Between areas, the detail would only make databases larger and make every router rerun SPF for changes far away. So the ABR passes on reachability results, not the complete map: networks and costs. A change in area 0 may leave the advertised inter-area prefixes and costs unchanged. Other protocol maintenance and refreshes can still occur.

A remote topology change can alter a type 3 metric, withdraw an advertised prefix or leave both unchanged. If the received summary changes, the receiving router must reconsider the affected inter-area route. It does not need the remote area's full router-and-network map. Do not turn that separation into a promise that no route calculation or update can ever cross an area boundary.

Reading R3's database section by section

Link ID identifies what the LSA describes. ADV Router identifies its creator. For type 1 both fields contain the router ID. For type 2, Link ID contains the DR's interface address and ADV Router contains its router ID. Do not assume every dotted value in this output is an address to ping.

Example output
R3#show ip ospf database
            OSPF Router with ID (3.3.3.3) (Process ID 1)

                Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
2.2.2.2         2.2.2.2         312         0x80000004 0x00B2C1 1
3.3.3.3         3.3.3.3         305         0x80000005 0x0041D7 2
4.4.4.4         4.4.4.4         298         0x80000003 0x00E83A 1

                Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
10.0.0.4        4.4.4.4         298         0x80000002 0x009A12

                Summary Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
10.1.12.0       2.2.2.2         350         0x80000001 0x00C46E
192.168.1.0     2.2.2.2         350         0x80000001 0x0021F0
Router Link States are type 1: one per router in area 0, named by router ID. R3 has 2 links (the shared segment and LAN 3), R2 and R4 have 1 each in this area. Net Link States are type 2: one for the segment, named by the DR's address 10.0.0.4. Summary Net Link States are type 3: the two area 1 networks, both from R2. (Checksums are illustrative.)
Example output
R3#show ip ospf database router 3.3.3.3
  LS Type: Router Links
  Link State ID: 3.3.3.3
  Advertising Router: 3.3.3.3
  Number of Links: 2

    Link connected to: a Transit Network
     (Link ID) Designated Router address: 10.0.0.4
     (Link Data) Router Interface address: 10.0.0.3
       TOS 0 Metrics: 1

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 192.168.3.0
     (Link Data) Network Mask: 255.255.255.0
       TOS 0 Metrics: 1
R3's own type 1 LSA in detail. The transit network entry points at the DR, 10.0.0.4. The stub network is LAN 3. TOS 0 Metrics is each link's cost. The top-level Link State ID 3.3.3.3 identifies this router LSA; the inner transit Link ID 10.0.0.4 identifies the segment it references. They are different fields even though the CLI uses similar names.
Example output
R3#show ip ospf database network 10.0.0.4
  LS Type: Network Links
  Link State ID: 10.0.0.4 (address of Designated Router)
  Advertising Router: 4.4.4.4
  Network Mask: /24
        Attached Router: 4.4.4.4
        Attached Router: 2.2.2.2
        Attached Router: 3.3.3.3
The type 2 LSA: the segment's mask and the three attached routers, written by the DR.
Example output
R1#show ip route ospf
      10.0.0.0/8 is variably subnetted, 3 subnets, 3 masks
O IA     10.0.0.0/24 [110/2] via 10.1.12.2, 00:06:20, GigabitEthernet0/1
O IA  192.168.3.0/24 [110/3] via 10.1.12.2, 00:06:20, GigabitEthernet0/1
In area 1, R1 learns area 0's networks from type 3 LSAs, so they show as O IA. The cost is R1's cost to R2 (1) plus the cost R2 put in the LSA: 1 for 10.0.0.0/24, 2 for LAN 3.
Example output
R3#show ip ospf database summary 192.168.1.0
  LS Type: Summary Links(Network)
  Link State ID: 192.168.1.0 (summary Network Number)
  Advertising Router: 2.2.2.2
  Network Mask: /24
        MTID: 0  Metric: 2
This example type 3 describes LAN 1, not R1's internal interfaces. Its advertising router is the receiving area's ABR, R2. Metric 2 is R2's cost through R1 to LAN 1; R3 adds its outgoing cost 1 to reach R2 over the shared Ethernet segment. The resulting inter-area metric is 3.

The same prefix can be intra-area here and inter-area there

Example output
R2#show ip route ospf | include 192.168.1.0
O     192.168.1.0/24 [110/2] via 10.1.12.1, 00:06:20, GigabitEthernet0/1
R2 reaches LAN 1 through its area 1 topology, so this is an intra-area OSPF route, shown as plain O. The next hop is R1's interface address. In [110/2], 110 is Cisco's administrative distance and 2 is the metric.
Example output
R3#show ip route ospf | include 192.168.1.0
O IA  192.168.1.0/24 [110/3] via 10.0.0.2, 00:06:20, GigabitEthernet0/0
R3 belongs only to area 0, so it learns this prefix through R2's type 3 and installs O IA. Its next hop is R2's shared-segment address, not the type 3 Link State ID or R2's router ID. A router's own directly connected LAN normally appears as C rather than an OSPF-learned O entry.

Using the database to find a fault

  • A router's type 1 LSA is missing from another router's database. They are in the same area but may not have a working flooding path between them. Check adjacency paths, area membership and convergence before concluding that one particular cable is faulty.
  • Two routers in the same area show different databases. Usually a moment during flooding; if it persists, check connectivity, adjacency paths, flooding and retransmissions. A healthy broadcast LAN can have 2-Way DROther pairs while databases synchronise through the DR/BDR. LSA age differences alone are normal.
  • A LAN is in the database but not in the routing table. The LSA is there, so OSPF knows a description, not necessarily a usable route. Check SPF reachability, LSA link consistency and competing route sources before concluding that administrative distance is the cause.

The Age and Seq# columns are worth a glance too. An LSA whose age stays low and whose sequence number keeps climbing is being re-originated; rapid repeated changes can indicate instability. Normal refresh also changes sequence numbers, while retransmitting the same instance does not. Compare timestamps, logs and interface events before diagnosing a flap.

Types 1, 2 and 3 side by side

Creator and scope of each type
  • Type 1 (router): every router, per area, lists its links and costs. Stays in the area.
  • Type 2 (network): the DR of a multi-access segment lists the attached routers. Stays in the area.
  • Type 3 (summary): the ABR advertises networks from one area into another, with its cost. Shown as O IA.
  • Inside an area routers share the map; between areas the ABR shares only the results.

Short lab: follow a cost change across the area boundary

Use the two-area topology in an isolated Cisco IOS or IOS XE lab, with all initial outgoing costs set to 1. On R3, inspect R1's LAN advertisement and route. The initial inter-area route to 192.168.1.0/24 should have cost 3: R3 to the shared segment, R2 to R1, then R1 to LAN 1.

show ip ospf database summary 192.168.1.0 show ip route 192.168.1.0

R3, privileged EXEC. The summary's advertising router is R2, 2.2.2.2. Its metric is 2; R3 adds outgoing cost 1 to reach R2, giving route metric 3.

interface GigabitEthernet0/0 ip ospf cost 5 exit

R1 only, starting in global configuration mode. Temporarily change the outgoing LAN 1 cost from 1 to 5 without changing its address or physical speed.

Repeat the two show commands on R3 after convergence. R2's type 3 metric becomes 6 and R3's route metric becomes 7. R3 still does not receive R1's area 1 type 1 LSA. Remove the temporary override with no ip ospf cost under R1 Gi0/0 and confirm the original metrics return. These expected values assume no other paths or route sources.

Optional failure check: withdraw LAN 1 without restarting OSPF

Only in the isolated lab, record the healthy host ping and the LAN 1 entries on R3. On R1, enter interface configuration for Gi0/0 and apply shutdown. This removes the live LAN interface, not the R1–R2 transit link. R1's area 1 router LSA changes; after convergence, R2 no longer advertises a usable LAN 1 prefix into area 0 and R3 loses the route. R1 can remain R2's Full transit neighbour throughout, showing why a neighbour record alone does not prove its LAN is reachable.

Restore R1 Gi0/0 with no shutdown, then check the connected LAN on R1, the type 3 metric 2 and route metric 3 on R3, and host traffic in both directions. A withdrawn LSA can briefly remain visible at maximum age while it is flushed; compare freshness and the installed route rather than treating any displayed copy as current reachability. Do not save the fault over your healthy configuration.

Test yourself on LSA types

Reference: RFC 2328: originating LSAs, SPF calculation, incremental summary updates and Cisco OSPF show-command reference. Commands use Cisco IOS/IOS XE-style syntax; output is authored for this example, not captured from a tested image. The two-area example introduces inter-area concepts beyond single-area CCNA configuration.

Predict · scenario 1

Which router creates the type 2 LSA for the 10.0.0.0/24 segment?

Predict · scenario 2

Does R1, in area 1, have R3's type 1 router LSA in its database?

Predict · scenario 3

R1's routing table shows O IA 192.168.3.0/24. Which LSA type taught R1 this route?

Predict · scenario 4

In a type 1 router LSA, what does a 'Stub Network' link describe?

The default route from Advertising a default route is a fourth kind, type 5, listed under Type-5 AS External Link States.

FAQ

Do I need multiple areas for the CCNA?
The CCNA 200-301 exam expects you to configure single-area OSPF. Type 1 records describe each participating router's links in the area. A shared transit segment can add a type 2 when its DR has a Full neighbour. With multiple areas, ABRs can advertise eligible inter-area prefixes using type 3 records. This lesson introduces that extra context without treating multi-area design as a single-area configuration requirement.
What about LSA types 4, 5 and 7?
Type 5 describes external reachability, including an originated default in a normal area. Type 4 advertises inter-area reachability to an autonomous system boundary router (ASBR), which introduces external routes. Type 7 carries external reachability inside a not-so-stubby area (NSSA); a suitable border router can translate eligible type 7 records into type 5 records. These have different formats and flooding scopes.
Why is there no type 2 LSA on point-to-point links?
A type 2 LSA is written by a DR, and point-to-point links have no DR. Each router's own type 1 LSA describes the link instead.