OSPF · Topic 1 of 4
OSPF Packet Types and the Link-State Database
Learn the five OSPF packet types, LSA flooding, sequence numbers and aging, and how the OSPF link-state database is synchronized for the JNCIS-SP JN0-364.
- 5 min
- Packet types: 1 Hello, 2 DBD, 3 LSR, 4 LSU, 5 LSAck.
- OSPF runs over IP protocol 89.
- 224.0.0.5 is all OSPF routers; 224.0.0.6 is the DR and BDR.
What it is
The link-state database (LSDB) is the map each OSPF router keeps of its area. It is made of link-state advertisements (LSAs), each describing a router, a network or an external destination. Every router in an area must hold an identical copy, because each one runs the SPF algorithm on it to calculate routes.
OSPF uses five packet types to find neighbors, compare databases and move LSAs between routers. OSPF runs directly over IP as protocol 89, not over TCP or UDP.
How it works
The five packet types
| Type | Name | Purpose |
|---|---|---|
| 1 | Hello | Discover neighbors, check parameters, keep adjacencies alive, elect DR and BDR |
| 2 | Database description (DBD) | Summarize the LSA headers in the sender's database during adjacency formation |
| 3 | Link-state request (LSR) | Ask for LSAs that are missing or newer on the neighbor |
| 4 | Link-state update (LSU) | Carry one or more full LSAs |
| 5 | Link-state acknowledgment (LSAck) | Confirm that LSAs were received |
Only the LSU carries complete LSAs. The DBD carries only headers, which is why it is fast to compare databases.
Addresses used
| Address | Name | Who listens |
|---|---|---|
| 224.0.0.5 | AllSPFRouters | Every OSPF router |
| 224.0.0.6 | AllDRouters | The DR and BDR only |
On a broadcast segment, DROther routers send updates to 224.0.0.6, and the DR floods them to everyone on 224.0.0.5. On point-to-point links, packets go to 224.0.0.5.
Building the database
When two routers become neighbors, they synchronize databases in a fixed order:
- ExStart: the routers agree who is master and the starting DBD sequence number. The higher router ID becomes master.
- Exchange: they send DBD packets listing their LSA headers.
- Loading: each sends LSRs for LSAs it lacks or holds an older copy of, and receives LSUs in reply.
- Full: both databases match.
The MTU is checked in DBD packets. A mismatched interface MTU is the classic reason for neighbors stuck in ExStart or Exchange.
LSA headers, sequence numbers and age
Every LSA is identified by three values: LS type, link-state ID and advertising router. To decide which copy is newer, a router compares:
- The sequence number: higher is newer.
- The checksum: higher is newer if sequence numbers are equal.
- The age: an LSA at MaxAge is treated as newest, so a withdrawal wins; otherwise a much younger copy is newer.
| Timer | Value |
|---|---|
| LSA refresh | Every 30 minutes, the originator floods a new copy with a higher sequence number |
| MaxAge | 3600 seconds (60 minutes); an LSA that reaches it is removed from the database |
To withdraw an LSA, the originator floods it with age set to MaxAge. This is called premature aging, and it removes the LSA from every database at once.
Reliable flooding
Every LSU must be acknowledged. If no LSAck arrives, the sender retransmits the LSA. A router that receives a newer LSA installs it, acknowledges it and floods it out of its other interfaces in the same area. An older or duplicate LSA is not flooded further.
After a change to the database, the router runs SPF. In Junos, SPF runs after a short delay so several changes can be handled in one calculation.
Viewing the database
user@router> show ospf database
OSPF database, Area 0.0.0.0
Type ID Adv Rtr Seq Age Opt Cksum Len
Router *192.168.0.1 192.168.0.1 0x8000000a 312 0x22 0x4c1e 60
Router 192.168.0.2 192.168.0.2 0x80000008 287 0x22 0x8a32 60
Network 10.0.12.2 192.168.0.2 0x80000002 287 0x22 0x51d0 32
The * marks an LSA this router originated. The Seq column shows the sequence number and Age the age in seconds.
| Command | Use |
|---|---|
show ospf database | Summary of every LSA by area and type |
show ospf database router | Only router LSAs |
show ospf database extensive | Full contents of each LSA, including links and metrics |
show ospf database advertising-router 192.168.0.2 | LSAs from one router |
show ospf statistics | Counters of each packet type sent and received |
show ospf statistics is a quick way to see whether hellos are being sent and received, and whether LSUs or retransmissions are climbing on a problem link.
Common mistakes
Thinking DBD packets carry full LSAs. They carry headers only. Full LSAs travel in LSU packets.
Mixing up the multicast addresses. 224.0.0.5 reaches all OSPF routers; 224.0.0.6 reaches only the DR and BDR.
Expecting different databases inside one area. All routers in an area hold the same LSDB. A router in two areas holds one database per area.
OSPF is IP protocol 89. A firewall filter on the loopback that protects the Routing Engine must accept protocol ospf, or every adjacency drops after the dead interval.
What to remember for the exam
- Packet types: 1 Hello, 2 DBD, 3 LSR, 4 LSU, 5 LSAck.
- OSPF runs over IP protocol 89.
- 224.0.0.5 is all OSPF routers; 224.0.0.6 is the DR and BDR.
- Database sync: ExStart, Exchange, Loading, Full; MTU mismatch stalls ExStart or Exchange.
- Newer LSA: higher sequence number first, then checksum, then age rules.
- LSAs refresh every 30 minutes and expire at MaxAge, 3600 seconds.
- Every router in an area holds an identical LSDB; view it with
show ospf database.
Check yourself
Which OSPF packet type carries complete LSAs?
The link-state update, type 4; DBD packets carry only LSA headers.
Two routers each hold an LSA with the same LS type, link-state ID and advertising router. How is the newer one chosen first?
The copy with the higher sequence number is newer.
Neighbors stay in ExStart. What is the most likely cause?
An interface MTU mismatch, which is checked in the DBD packets.
Topic 1 of 4 in OSPF
Test yourself on OSPF
The full Juniper JNCIS-SP JN0-364 question bank has 860 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by Juniper. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.