Computer Networks · IPv6
IPv6 Header Format and Fields (Version, Traffic Class, Flow Label, Payload Length, Next Header)
Overview
The IPv6 base header is simpler than the IPv4 header.
It uses a fixed-length header, so only a payload length field is needed, and it introduces the Flow Label, a field that never existed in earlier versions of IP. Understanding these fields is essential for identifying packet versions during the IPv4-to-IPv6 transition and for locating the extension headers that follow the base header.
Key concepts
- Base header: the portion of the IPv6 header from the start up to the Next Header field.
- Version (4 bits): identifies the IP version of an arriving packet. Value 0110 (binary 6) means IPv6; value 0100 (binary 4) means IPv4.
It is needed because IPv4 and IPv6 coexist during the transition: some routers run only IPv6 software, some only IPv4, some both, so a router must check the version to send the packet to the appropriate protocol handler. - Traffic Class / Priority (8 bits): both names are equally popular. It was initially called traffic class in IPv6; it is also called priority because the corresponding IPv4 field does almost the same job.
- Flow Label (20 bits): the most interesting and important field introduced in IPv6 for the first time in IP; it was not present in any earlier version of IP.
- Payload Length (16 bits): gives the total length of the payload only. No header length field is needed because the IPv6 base header is fixed length.
- Next Header (8 bits): tells what type of extension header immediately follows the base header (i.e., what the first header after the base header is). The base header ends at this field.
- Extension headers: IPv6 has no options field; options are replaced by extension headers. After the base header there can be any number of extension headers, followed finally by upper-layer data.
The TCP header is not an extension header; it is the upper-layer header that follows the last extension header.
How it works
- Version (4 bits): every arriving packet is checked for its version; the router forwards it to the matching software based on this value.
- Traffic Class / Priority (8 bits): indicates priority/traffic class handling.
- Flow Label (20 bits): the newly introduced field.
- First row total: 4 bits + 8 bits + 20 bits = 32 bits = 4 bytes for the entire first row.
- Payload Length (16 bits): gives the total length of the payload only; no header length field is needed because the base header is fixed length.
- Next Header (8 bits): the base header ends here; after it, extension headers may follow, then data.
Formulas
-
First row size:
-
IPv4:
-
IPv4 header length range: 20 bytes (minimum, no options) to 60 bytes (maximum, with options)
-
IPv6: the Payload Length field directly gives the payload size (base header length is fixed, so no subtraction is needed)
-
IPv6 Base Header Field Layout
Drawing the diagram…
- Shows the order and bit widths of the IPv6 base header fields from Version through Next Header, followed by extension headers and upper-layer data.
Worked examples
Example 1 — Identifying the packet version
- Received version bits = 0110 → binary 6 → IPv6 packet.
- Received version bits = 0100 → binary 4 → IPv4 packet.
Example 2 — Verifying the first row size
- Version = 4 bits, Traffic Class = 8 bits, Flow Label = 20 bits.
- Total = bits; bytes, so the whole first row is 4 bytes.
Example 3 — Why IPv4 needs two length fields
- The IPv4 header can be 20 to 60 bytes (variable due to options), so the payload must be computed as Total Length − Header Length.
- In IPv6 the header is fixed, so the Payload Length field alone is sufficient.
Comparison
| Aspect | IPv4 | IPv6 |
|---|---|---|
| Length fields | Header Length + Total Length (two fields) | Payload Length only (one field) |
| Header length | Variable (20–60 bytes) | Fixed |
| Options | Options field present | No options; replaced by extension headers |
| Flow Label | Not present | Present (20 bits), introduced for the first time |
| Version values | 0100 | 0110 |
Revision summary
- IPv6 base header first row = Version (4 bits) + Traffic Class (8 bits) + Flow Label (20 bits) = 32 bits = 4 bytes.
- Version = 0110 means IPv6;
Version = 0100 means IPv4 — needed because IPv4 and IPv6 coexist during the transition. - Traffic Class is also called Priority.
- Flow Label (20 bits) is the first field of its kind introduced in IPv6 — not present in any earlier IP version.
- Payload Length (16 bits) replaces IPv4's Total Length; there is no Header Length field because the IPv6 base header is fixed length.
- IPv4 needed both Header Length and Total Length because its header is variable (20–60 bytes).
- Next Header (8 bits) tells which extension header immediately follows the base header.
- IPv6 has no options field; it uses any number of extension headers, and even the TCP header counts as an extension header.
Previous-year exam insights
- The IPv6 base header is fixed at 40 bytes: Version (4) + Traffic Class (8) + Flow Label (20) + Payload Length (16) + Next Header (8) + Hop Limit (8) + Source Address (128) + Destination Address (128).
- IPv6 has no header checksum field (and no fragmentation/identification/flags/fragment-offset fields in the base header); fragmentation is handled by a Fragment extension header, and error detection relies on upper layers and link layer.
- Hop Limit (8 bits) in IPv6 plays the role of IPv4's TTL: it is decremented by each router and the packet is discarded when it reaches zero.
- Extension headers are processed in the order they appear, chained by Next Header values; the recommended order is Hop-by-Hop Options, Destination Options (for intermediate nodes), Routing, Fragment, AH, ESP, Destination Options (for final destination), then upper-layer data.
- IPv4 header fields for comparison: Version (4), IHL (4, in 32-bit words, so 5 to 15 → 20 to 60 bytes), Total Length (16, header + data), Identification (16), Flags (3), Fragment Offset (13), TTL (8), Protocol (8), Header Checksum (16), Source/Destination Address (32 each).
- The Flow Label (20 bits) is used to label packets of a flow for special handling such as QoS; a value of zero means the packet does not belong to any flow.