Sub topic 8
The Link-State Database and LSA Flooding
This chapter assumes you know how OSPF neighbors reach the Full state, what a router ID is, and how routing tables use longest-prefix match. Here you will see what the routers exchange once they are adjacent, and how that data becomes a shared map.
What the LSDB Holds
The link-state database (LSDB) is the set of link-state advertisements (LSAs) a router has collected. An LSA is a small record that describes one piece of the topology, such as a router and its links. Every router in an area must hold an identical LSDB. Identical maps are what allow each router to run SPF on its own and still reach consistent, loop-free results.
Each LSA is identified by three fields: the LSA type, the link-state ID, and the advertising router. Three more header fields decide which copy of an LSA is newer:
- Sequence number: a signed 32-bit counter. A higher value is newer.
- Age: seconds since origination. An LSA reaching MaxAge (3600 seconds) is removed from the database.
- Checksum: detects corruption.
When two copies of the same LSA differ, the router compares sequence number first, then checksum, then age. It keeps the newest.
Synchronizing at Adjacency Time
When neighbors move through ExStart and Exchange, they send Database Description (DBD) packets. These list only LSA headers. A router compares the headers with its own LSDB. In the Loading state, it asks for any missing or newer LSAs with a Link-State Request (LSR). The neighbor answers with a Link-State Update (LSU) that carries the full LSAs. When nothing is left to request, the neighbors reach Full.
Flooding Changes
After the initial sync, flooding keeps the LSDBs aligned. When a link changes, the owning router originates a new LSA with a higher sequence number. It sends this LSA in an LSU to its neighbors. Each neighbor does the following:
- Acknowledges the LSA with a Link-State Acknowledgment (LSAck).
- Installs it if it is new.
- Forwards it out every other OSPF interface in the area.
- Schedules an SPF run.
Flooding is reliable. The sender retransmits an LSA until it receives an acknowledgment. On multi-access segments, routers send updates to the multicast address 224.0.0.6 (AllDRouters). The DR then re-floods them to 224.0.0.5 (AllSPFRouters).
Refresh and Aging
OSPF does not trust old data indefinitely. The originating router refreshes each of its LSAs every 30 minutes (LSRefreshTime) with a new sequence number. A router that stops hearing refreshes eventually ages the LSA out at MaxAge. This is a safety net. In normal operation, changes are flooded immediately, and the periodic refresh only repairs rare inconsistencies.
Common Errors
- Stuck in Loading or Exchange: often an MTU mismatch. DBD packets cannot be exchanged cleanly, so the LSDB never synchronizes.
- Flapping links: each flap generates new LSAs and SPF runs on every router in the area. This is why unstable links hurt a whole area.
- Different LSDBs in one area: usually a sign of a failed adjacency somewhere. Compare
show ip ospf databaseon two routers.
Exercise
Router A has an LSA with sequence number 0x80000005. Router B sends it a copy of the same LSA (same type, ID, and advertising router) with sequence number 0x80000007. What does Router A do?
Show answer
Router A treats the copy as newer, installs it in its LSDB, acknowledges it with an LSAck, floods it out its other OSPF interfaces in the area, and schedules an SPF calculation.
Exercise
Which packet type carries the full LSA contents, and which carries only LSA headers during adjacency formation?
Show answer
The Link-State Update (LSU) carries full LSAs. The Database Description (DBD) packet carries only LSA headers.