Sub topic 13
Flooding link-state advertisements
This chapter assumes you know what a routing table is, how neighbors form adjacencies with hello packets, and basic graph terms. Here you will see how one router's topology news reaches every other router in an area.
What flooding does
A link-state advertisement (LSA) is a record that describes a router's links and their costs. Flooding is the process of copying each LSA to every router, so all routers end up with the same set of records. Each router then runs the same shortest-path calculation on that set.
The basic rule is simple. When a router receives a new LSA, it stores it and sends a copy out of every interface except the one it arrived on.
Why flooding does not loop forever
Without a check, an LSA would circle through any ring of routers indefinitely. Each LSA carries an identity (the originating router plus the LSA type) and a sequence number. The originator increases the sequence number every time it issues a new version.
A receiving router compares the incoming LSA with its stored copy:
| Comparison | Action |
|---|---|
| No stored copy | Store it, flood it onward |
| Higher sequence number | Replace the copy, flood it onward |
| Same sequence number | Treat it as a duplicate, do not flood |
| Lower sequence number | Send the newer stored copy back to the sender |
Duplicates stop the spread, so each LSA crosses each link only a small number of times.
def receive_lsa(lsdb, lsa_id, seq, body, came_from, interfaces):
"""lsdb: lsa_id -> (seq, body). Returns interfaces to flood on."""
stored = lsdb.get(lsa_id)
if stored is None or seq > stored[0]:
lsdb[lsa_id] = (seq, body)
return [i for i in interfaces if i != came_from]
return [] # duplicate or older: do not floodReliability and aging
Routers cannot assume a flooded packet arrived. OSPF acknowledges every LSA. If an acknowledgment does not come back, the sender retransmits. IS-IS achieves the same effect with sequence number packets on point-to-point links and periodic summaries on broadcast links.
LSAs also have an age. The originator refreshes them periodically (OSPF refreshes every 30 minutes by default). If an LSA reaches its maximum age, routers remove it from their databases. This clears stale records left by a router that failed without withdrawing its information.
Common errors
- Sequence number confusion. If a router restarts and reuses low sequence numbers, other routers keep the old, higher-numbered copy until it ages out or the router catches up. Protocols include rules to jump ahead after a restart.
- Flooding storms. An unstable link that goes up and down repeatedly produces a new LSA each time. Every router must flood and recompute, which uses CPU. Timers that delay SPF runs and LSA generation limit this.
- Database mismatch. If acknowledgments fail, such as when an MTU mismatch drops large database packets, neighbors can stay stuck short of a full adjacency and routers hold different databases.
Exercise
Router R holds an LSA from router X with sequence number 12. It receives an LSA from X with sequence number 11 on interface eth1. What does R do?
Show answer
R does not store or flood the older LSA. It sends its stored copy with sequence number 12 back to the sender, so the sender can update its database.