Walk me through the IPv6 header. What was removed compared with IPv4, and why?
Show the answer
Say this first
It is a fixed 40 bytes with eight fields: Version, Traffic Class, Flow Label, Payload Length, Next Header, Hop Limit, and the 128-bit source and destination addresses. Compared with IPv4, the header length field, the header checksum, the fragmentation fields and options are gone. A fixed header with no checksum is cheaper for routers, fragmentation moved to an extension header used only by the source, and options moved to extension headers that most routers never look at.
Go deeper
The fields
| Field | Bits | Notes |
|---|---|---|
| Version | 4 | always 6 |
| Traffic Class | 8 | DSCP (6 bits) and ECN (2 bits), same as IPv4 ToS |
| Flow Label | 20 | marks packets of one flow, used for ECMP and LAG hashing |
| Payload Length | 16 | bytes after the 40-byte header, extension headers included |
| Next Header | 8 | next extension header or the upper layer: 6 TCP, 17 UDP, 58 ICMPv6 |
| Hop Limit | 8 | the TTL, renamed; decremented at each router |
| Source address | 128 | |
| Destination address | 128 |
What changed and why
| IPv4 | IPv6 | Reason |
|---|---|---|
| IHL (header length) | gone | header is always 40 bytes |
| Header checksum | gone | layer 2 FCS and layer 4 checksums already cover errors; routers no longer recompute a checksum at every hop |
| Identification, flags, fragment offset | Fragment extension header | only the source fragments |
| Options | extension headers | keep the fast path simple |
| Protocol | Next Header | can point to an extension header |
| TTL | Hop Limit | name now matches what it does |
Consequences
- The UDP checksum, optional in IPv4, is mandatory in IPv6 (tunnel protocols have a narrow exception).
- Payloads above 65,535 bytes need the Jumbo Payload option in a Hop-by-Hop header. Almost nothing uses it.
They will ask next
What is the Flow Label used for in practice?
Load balancing. A router or switch can hash on source, destination and flow label instead of digging for TCP ports, which helps when the transport header is encrypted or sits behind extension headers. Tunnel endpoints can set it so traffic inside one tunnel spreads across paths.
Is the IPv6 header bigger than IPv4?
Yes, 40 bytes against a usual 20, almost all of it the larger addresses. In exchange it is fixed and simpler to process.
Traps
- Saying Payload Length includes the 40-byte header. It does not.
- Saying IPv6 removed TTL. It renamed it.