IPV6-FUN . PACKET ANATOMY

IP Header Anatomy

The IPv4 (RFC 791) and IPv6 (RFC 8200) headers, with a toggle between them and the full writeup in deep-dive.md.

where this sits

The IP header is layer 3 - it hands off to a transport header above and rides inside a link-layer frame below. Hover a row for the layer's own byte layout and a code snippet.

L4 . transportTCP / UDP / ICMPv6above
L3 . networkIPv4 / IPv6 - this pagehere
L2 . data linkEthernet / Wi-Fi framebelow
the diff, at a glance
IPv4IPv6
Header size20-60 bytes, variable (options)40 bytes, fixed - extensions are separate chained headers
Address length32 bits128 bits
Header checksumyes - recomputed every hopnone - integrity pushed to upper layers
Fragmentationrouters may fragment in flightsource only, via a Fragment extension header
"next protocol" fieldProtocol (byte 9)Next Header (byte 6) - same IANA registry, same numbers
Broadcastyesnone - multicast only
Address autoconfigDHCP (or static)SLAAC or DHCPv6
Defining specRFC 791 (1981)RFC 8200 (2017)
the header, byte by byte

First word (version, traffic class, flow label) is bit-packed, so it's drawn bit by bit. Everything after it is byte-aligned - payload length, next header, hop limit, then the two 128-bit addresses drawn byte by byte.

Version+IHL+DSCP+ECN pack into the first 2 bytes, so they're drawn bit by bit; Total Length and Identification are byte-aligned; Flags+Fragment Offset pack into 2 more bits; TTL, Protocol, Checksum, and both addresses are byte-aligned.

why the source is documentation-safe. The example addresses on this page use the reserved documentation ranges - 2001:db8::/32 for IPv6 (RFC 3849) and 192.0.2.0/24 / 203.0.113.0/24 for IPv4 (RFC 5737) - so nothing here is a real routable host.