OSPF Header Format
Every OSPF packet begins with a standard 24-byte header. Understanding this header is crucial for packet analysis and troubleshooting.
Header Purpose
The OSPF header provides:
- Packet type identification
- Version and length information
- Authentication data
- Area identification
- Router identification
OSPF Header Structure
The OSPF header is exactly 24 bytes (192 bits) and precedes all OSPF packet types:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Version | Type | Packet Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Router ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Area ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Checksum | Authentication Type |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Authentication Data |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Authentication Data (cont.) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Header Field Details
Version (8 bits)
Version Values
- 2: OSPF Version 2 (RFC 2328) - IPv4
- 3: OSPF Version 3 (RFC 5340) - IPv6
This tutorial focuses on OSPFv2 (version 2).
Type (8 bits)
Type | Value | Packet Name | Purpose |
---|---|---|---|
1 | 0x01 | Hello | Neighbor discovery and keepalive |
2 | 0x02 | Database Description (DD) | Database summary exchange |
3 | 0x03 | Link State Request (LSR) | Request specific LSAs |
4 | 0x04 | Link State Update (LSU) | Contains LSAs for flooding |
5 | 0x05 | Link State Acknowledgment (LSAck) | Acknowledge received LSAs |
Authentication Type (16 bits)
Type | Value | Authentication Method | Security Level |
---|---|---|---|
0 | 0x0000 | None | No security |
1 | 0x0001 | Simple Password | Very weak (plaintext) |
2 | 0x0002 | Cryptographic | Strong (MD5 hash) |
Real OSPF Header Examples
Hello Packet Header
Router ID: 192.168.1.1
Area ID: 0.0.0.0 (backbone)
Checksum: 0x3f2e, Auth Type: 0 (None)
Auth Data: 0x0000000000000000
Hello Packets
Hello packets are the foundation of OSPF neighbor relationships. They handle neighbor discovery, keepalive, and DR/BDR election.
Hello Packet Functions
- Neighbor Discovery: Find adjacent routers
- Keepalive: Maintain neighbor relationships
- Parameter Exchange: Share network configuration
- DR/BDR Election: Elect designated routers
Hello Packet Format
Hello packets follow the standard OSPF header with additional fields:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| OSPF Header |
| (24 bytes) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Network Mask |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Hello Interval | Options | Router Priority |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Dead Interval |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Designated Router |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Backup Designated Router |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Neighbor 1 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Neighbor 2 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Hello Packet Fields
Hello Interval (16 bits)
Network Type | Default Interval | Range | Considerations |
---|---|---|---|
Broadcast | 10 seconds | 1-65535 | Fast convergence |
Point-to-Point | 10 seconds | 1-65535 | Fast convergence |
NBMA | 30 seconds | 1-65535 | Slower links |
Point-to-Multipoint | 30 seconds | 1-65535 | Slower links |
DR/BDR Election Process
Election Rules
- Priority 0: Cannot become DR/BDR
- Highest Priority Wins: Range 1-255
- Router ID Tiebreaker: If priorities equal
- Non-preemptive: DR doesn't change unless failure
Database Description Packets
Database Description (DD) packets are used during the database exchange process to describe the contents of the link-state database.
DD Packet Purpose
- Database Summary: Describe LSAs in database
- Master/Slave: Establish relationship
- Sequencing: Ensure reliable exchange
- Synchronization: Coordinate database updates
DD Packet Format
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| OSPF Header |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Interface MTU | Options |0|0|0|0|0|I|M|MS
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| DD Sequence Number |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
+- -+
| LSA Header 1 |
+- -+
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
DD Flags
Flag | Name | Purpose | Set By |
---|---|---|---|
MS | Master/Slave | 1=Master, 0=Slave | Master router |
M | More | More DD packets follow | Sender |
I | Init | Initial DD packet | Both routers |
Link State Request Packets
Link State Request (LSR) packets are used to request specific LSAs from a neighbor during database synchronization.
LSR Packet Functions
- Request LSAs: Ask for specific LSAs
- Database Sync: Complete database synchronization
- Missing LSAs: Request missing or newer LSAs
- Reliable Transport: Ensure LSA delivery
LSR Packet Format
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| OSPF Header |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| LS Type |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Link State ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Advertising Router |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ... |
LSR Fields
Field | Size | Description | Example |
---|---|---|---|
LS Type | 32 bits | Type of LSA being requested | 1 (Router LSA) |
Link State ID | 32 bits | Identifies the LSA | 192.168.1.1 |
Advertising Router | 32 bits | Router that generated the LSA | 192.168.1.1 |
Link State Update Packets
Link State Update (LSU) packets carry the actual LSAs and are used to flood link-state information throughout the OSPF domain.
LSU Packet Functions
- LSA Transport: Carry actual LSAs
- Flooding: Distribute topology information
- Database Updates: Update neighbor databases
- Convergence: Ensure network-wide consistency
LSU Packet Format
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| OSPF Header |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Number of LSAs |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
+- LSA 1 -+
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
LSU Flooding Process
Multicast Addresses
Address | Usage | Network Types |
---|---|---|
224.0.0.5 | AllSPFRouters | Broadcast, Point-to-Multipoint |
224.0.0.6 | AllDRouters | Broadcast (DROther to DR/BDR) |
Unicast | Direct | Point-to-Point, NBMA |
Link State Acknowledgment Packets
Link State Acknowledgment (LSAck) packets provide reliable flooding by acknowledging the receipt of LSU packets.
LSAck Packet Functions
- Acknowledge LSUs: Confirm LSA receipt
- Reliable Flooding: Ensure LSA delivery
- Duplicate Detection: Prevent LSA duplication
- Error Recovery: Handle transmission errors
LSAck Packet Format
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| OSPF Header |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
+- LSA Header 1 -+
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
+- LSA Header 2 -+
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ... |
Acknowledgment Types
Type | Timing | Method | Use Case |
---|---|---|---|
Explicit Ack | Immediate | LSAck packet | Point-to-Point links |
Implicit Ack | Delayed | LSU with same LSA | Broadcast networks |
Delayed Ack | Up to RxmtInterval | Grouped LSAck | Efficiency optimization |
Retransmission Timer
If an LSAck is not received within RxmtInterval (default 5 seconds), the LSA is retransmitted. This ensures reliable flooding even on lossy networks.