Kahibaro
Discord Login Register

8.4 IPv6 Header

Overview

The IPv6 header is the fixed part that appears at the start of every IPv6 packet and tells routers and hosts how to handle that packet. Compared with IPv4, the IPv6 header is simpler, has a fixed size, and moves several optional features out into separate extension headers.

This chapter focuses only on the structure and fields of the base IPv6 header, and on how it differs from the IPv4 header. Address formats, address types, and other IPv6 details are in other chapters.

Fixed Size and Basic Structure

The IPv6 header is always 40 bytes long. It comes immediately after the data link header, such as an Ethernet frame header, and before any IPv6 extension headers and the actual payload data.

In a simple linear view, the base IPv6 header contains:

Source Address, Destination Address, plus several control fields at the start such as Version, Traffic Class, Flow Label, Payload Length, Next Header, and Hop Limit.

There is no header checksum in IPv6, and there are no header options inside the base header. All optional information is handled through extension headers.

Field Layout

The IPv6 header fields follow a fixed order and size. Conceptually, you can imagine the layout like this:

FieldSize
Version4 bits
Traffic Class8 bits
Flow Label20 bits
Payload Length16 bits
Next Header8 bits
Hop Limit8 bits
Source Address128 bits
Destination Address128 bits

In total this is 40 bytes. The Source and Destination fields are each one full IPv6 address.

The IPv6 base header is always exactly 40 bytes long. Any additional control information must use extension headers, not options inside the base header.

Version, Traffic Class, and Flow Label

The first 32 bits of the IPv6 header are split into three fields that help identify the protocol and influence traffic handling.

The Version field is 4 bits and is set to 6 for IPv6 packets. Devices use this to distinguish between IPv4 and IPv6.

The Traffic Class field is 8 bits and is intended for quality of service marking. It can be used to indicate priority or special handling, for example for voice, video, or control traffic. It is conceptually similar to, but not identical to, the IPv4 Type of Service or DSCP field.

The Flow Label field is 20 bits and is specific to IPv6. It allows a sender to mark packets that belong to the same flow. A flow can be considered a sequence of packets between two endpoints that should receive similar treatment, for example all packets of a real time voice call. Intermediate routers can use the Flow Label together with the Source and Destination addresses to recognize these flows without inspecting deeper layers.

For many basic networks, the Flow Label is often left at zero and ignored. Advanced equipment, however, can use it to support special handling or load balancing for flows.

Payload Length

The Payload Length field is 16 bits and tells how many bytes follow the IPv6 header. This count includes any extension headers and the upper layer data, such as TCP or UDP, but not the 40 byte base IPv6 header itself.

Because it is 16 bits, the maximum value is $2^{16} - 1 = 65535$. If larger payloads are needed, IPv6 uses a special mechanism called Jumbograms, which relies on an extension header, not the base header. That special case is outside this chapter.

Payload Length counts everything after the 40 byte IPv6 base header, including all extension headers and the transport layer data, but never includes the base header itself.

Next Header

The Next Header field is 8 bits and tells what comes immediately after the base IPv6 header. It replaces two IPv4 concepts: the Protocol field and the IPv4 header options. In IPv6 the same field number is used both for upper layer protocols and for extension headers.

Some common Next Header values include:

Next Header valueMeaning
6TCP
17UDP
58ICMPv6
0Hop by Hop Options extension
43Routing extension
44Fragment extension
60Destination Options extension

If the Next Header points to an extension header, that extension header will itself have its own Next Header field which points to the next item in the chain. Eventually, the chain will point to a transport protocol, such as TCP or UDP.

This chained Next Header design is the core idea that allows IPv6 to keep the base header simple while still supporting many features.

Hop Limit

The Hop Limit field is 8 bits and is the IPv6 version of the IPv4 Time To Live. It is a simple counter that is decreased by one at each router hop. When the Hop Limit reaches zero, the packet is discarded.

This prevents packets from circulating forever in case of routing loops. Because there is no header checksum in IPv6, the only field that routers must change per hop is the Hop Limit, and they do not need to recompute a checksum when they do so.

Routers must decrement the Hop Limit by 1 for every hop. If the Hop Limit reaches 0, the router must discard the packet and typically send an ICMPv6 message back to the sender.

Source and Destination Addresses

The Source Address and Destination Address each occupy 128 bits, which allows the much larger address space of IPv6. Each one holds a full IPv6 address as described in the address format chapter.

The Source Address identifies who sent the packet. The Destination Address identifies the intended recipient. The exact type of address, for example unicast, multicast, or anycast, belongs in the address types chapter, but the header itself does not care about the type, it only carries the values.

These fields are always present and always the same size in every IPv6 packet, which simplifies parsing for devices.

Removed and Simplified Fields Compared to IPv4

Understanding IPv6 header design is easier if you know what was removed compared to IPv4.

There is no header length field in IPv6, because the base header is always 40 bytes. There are no internal options in the base header. Optional data is moved into extension headers that are pointed to by the Next Header field.

There is no header checksum field at all. IPv6 assumes that lower layers and upper layers provide sufficient error detection, so routers do not need to recompute checksums when forwarding, which improves performance.

Fragmentation details are not present in the base header. If fragmentation is needed, IPv6 uses a separate Fragment extension header. That means most packets that are not fragmented can skip that overhead.

Overall, the IPv6 header is intentionally simpler and more regular than the IPv4 header, which helps routers process packets faster and makes future extensions easier without redesigning the base header.

IPv6 Header and Extension Headers

The base IPv6 header is only the first part of a possible chain. After it, there can be zero or more extension headers, followed by the final upper layer header, such as TCP or UDP.

The Next Header field in the base header points either directly to a transport protocol, or to the first extension header. Each extension header then has its own Next Header value to indicate the next element in the chain.

For absolute beginners it is useful to remember that the IPv6 header itself is always the same size and always has the same fields. Any extra features, such as routing options or security information, are placed in separate extension headers, not inside the base header.

Summary

The IPv6 header is the fixed, 40 byte part of every IPv6 packet that contains control information such as version, class, flow label, payload length, next header, hop limit, and the source and destination addresses. It is designed to be simpler and more efficient to process than the IPv4 header. Details such as fragmentation, advanced options, or special behaviors are handled by extension headers, referenced through the Next Header field, instead of complicating the base header itself.

Views: 40

Comments

Please login to add a comment.

Don't have an account? Register now!