Sub topic 2
What OSPF Is and the Five Packet Types
This chapter assumes you know IPv4 addressing and subnet masks, basic router interface configuration, and the difference between static and dynamic routing. It also assumes you know how a routing table uses longest-prefix match. The previous chapter covered how link-state routing works in general. Here you meet the protocol that implements it.
What OSPF Is
Open Shortest Path First (OSPF) is a link-state interior gateway protocol. "Interior" means it runs inside one organization's network, not between organizations. This tutorial covers OSPFv2, which routes IPv4 and is defined in RFC 2328.
OSPF routers do not send their routing tables to each other. They describe their own links and flood that description to every router in the same area. Each router stores the descriptions in a link-state database and runs the shortest-path-first (SPF) algorithm on it to build its routes.
OSPF does not use TCP or UDP. It runs directly on IP as protocol number 89. Because it has no transport layer, OSPF does its own reliability work, using acknowledgments and retransmissions for the packets that need them.
Most OSPF packets go to multicast addresses:
- 224.0.0.5 (AllSPFRouters) reaches every OSPF router on a link.
- 224.0.0.6 (AllDRouters) reaches only the designated router and backup designated router. You will meet these roles in a later chapter.
The Five Packet Types
Every OSPF packet starts with the same header. The header carries the version, the packet type, the sender's router ID, the area ID, and authentication information. The type field tells the receiver which of the five packets follows.
| Type | Name | Purpose |
|---|---|---|
| 1 | Hello | Discovers neighbors and keeps them alive |
| 2 | Database Description (DBD) | Summarizes the sender's database as a list of LSA headers |
| 3 | Link-State Request (LSR) | Asks for full copies of specific LSAs |
| 4 | Link-State Update (LSU) | Carries full LSAs, either as a reply to an LSR or as new information |
| 5 | Link-State Acknowledgment (LSAck) | Confirms receipt of LSAs |
A Link-State Advertisement (LSA) is one piece of topology information. LSAs are covered in detail later. For now, think of an LSA as one record in the database.
How the Packets Work Together
Two routers that become neighbors use the packets in a fixed order:
- Hello packets find the neighbor and check that both sides agree on key settings.
- DBD packets exchange lists of LSA headers, so each router learns what the other has.
- Each router sends an LSR for any LSA it lacks or holds an older copy of.
- The other router answers with an LSU that contains the full LSAs.
- The receiver sends an LSAck for each LSA it accepted.
After the databases match, Hello packets continue as keepalives. LSUs appear again only when the topology changes.
Common Errors
- Expecting OSPF to appear in a TCP or UDP capture filter. Filter on IP protocol 89 instead.
- Blocking multicast 224.0.0.5 or protocol 89 with an access list. Neighbors then never form.
- Mixing up LSU and LSA. An LSU is a packet. An LSA is the data inside it.
Exercise
A router receives an OSPF packet whose type field is 3. What is the router being asked to do, and which packet type normally answers it?
Show answer
Type 3 is a Link-State Request, so the sender wants full copies of specific LSAs it is missing. The answer is a Link-State Update (type 4), which the requester then confirms with a Link-State Acknowledgment (type 5).
Exercise
Why does OSPF need its own acknowledgment packet, and which transport protocol does it use?
Show answer
OSPF runs directly over IP protocol 89 and uses no TCP or UDP, so nothing below it provides reliable delivery. It uses LSAck packets and retransmission to make sure LSAs arrive.