← Module 03 · Layer 3: Network

IPv4 Header Structure

Every router between a packet and its destination reads exactly these fields, and nothing else, to decide what to do with it.

The header, field by field

A router doesn't care what's inside a packet's payload, HTTP (Hypertext Transfer Protocol) request or DNS (Domain Name System) query or anything else. It only reads the IPv4 header wrapped around that payload, and mostly just a handful of fields in it.

Ver · IHL · DSCP Total Length Identification Flags Fragment Offset TTL Protocol Header Checksum Source IP Address Destination IP Address Options (rarely used) + Padding Payload: the actual application data (HTTP, DNS, whatever's being sent) TTL, Protocol, and both addresses are the fields a router actually acts on for every packet it forwards.
The IPv4 header. Everything below the first row is 32 bits wide, exactly like the header diagrams you'll see in any packet capture tool. The payload isn't part of the header itself, but it's what the header exists to wrap.

Every field, decoded

Field by field, in the order they appear in the diagram above:

FieldSizeWhat it holds
Version4 bitsAlways 4 for IPv4
IHL (Internet Header Length)4 bitsHeader length in 32-bit words; 5 (20 bytes) unless Options are present
DSCP (Differentiated Services Code Point)6 bitsTraffic priority marking for QoS, e.g. EF (Expedited Forwarding) for voice
Total Length16 bitsWhole packet's size in bytes, header plus payload, up to 65,535
Identification16 bitsShared across every fragment of the same original packet, so the destination knows which pieces belong together
Flags3 bitsDF (Don't Fragment) and MF (More Fragments); see IPv4 Fragmentation
Fragment Offset13 bitsWhere this fragment's data starts within the original payload, in 8-byte units
TTL (Time to Live)8 bitsDecremented at every hop; the packet is dropped once it hits 0
Protocol8 bitsWhat's riding inside: 6 = TCP, 17 = UDP, 1 = ICMP
Header Checksum16 bitsIntegrity check on the header only, recalculated at every hop
Source Address32 bitsSender's IP address
Destination Address32 bitsReceiver's IP address, what routers actually look up
Options0–40 bytesRarely used in practice: timestamps, security markings, source routing
PayloadVariableThe actual application data the header exists to deliver: an HTTP request, a DNS query, anything

The fields that actually drive behavior

WHY THIS FIELD LIST MATTERS BEYOND TRIVIA

When you open a packet capture in Wireshark, this is exactly the breakdown you'll see for every IPv4 packet, field for field. Knowing what TTL and Protocol mean here is what makes a capture readable instead of just a wall of hex.