IPv6 headers
Translation of the original in Catalan. Read it in: CatalàCastellano

Based on a couple of articles from Network Systems Design Line I wrote the article IPv6: going over the technical novelties, so well, parts 3 and 4 have been published and they continue to expand the introduction made in parts 1 and 2 that I reviewed in my article. Part number 3 talks specifically about the characteristics of IPv6 headers. A really important and interesting part in this new IP version. So I will dedicate this article to summarizing part 3 of the Network Systems Design Line article that talks about IPv6 headers.
IPv6 vs IPv4 header formats
To understand what the motivations are that have caused the changes in the IPv6 header it is necessary to be clear about what the fields of the IPv4 header were.
- Version (4bits) obviously contains the version of the protocol, in this case we will set the version to 4.
- Header Length (4bits) length in octets of the header.
- Type of Service (ToS) identifier used in QoS in order to be able to classify the packets according to the priority we want to give them.
- Total length (16bits) length in octets of the whole packet, header plus data. The maximum length will be 65,535 octets, which is the maximum we can define with 16 bits.
- Identification (16bits) Flags (3bits) Fragment Offset (13bits) through these three fields IPv4 implements the support for packet fragmentation.
- Time to Live (TTL) (8bits) maximum number of hops a packet can make before reaching its destination. This field prevents packets from hopping endlessly in a circle, never reaching their destination, if there is a routing problem. On each hop the packet makes, the value of the field is decremented and if it reaches 0 the packet is discarded.
- Protocol Number (8bits) indicates the code of the protocol that IP encapsulates in the upper layer, that is, layer 4. The numbers that identify these protocols (TCP, UDP, ICMP, etc) are defined by the IANA.
- Header Checksum (16bits) is used to check the integrity of the header data.
- Source IPv4 address (32bits) source IP address.
- Destination IPv4 Address (32 bits) destination IP address.
- Options (variable size) it is usual to store in it information needed to interpret the data that the packet carries.
- Padding (variable size) this field is used to adjust the size of the Options field to 32 bits in total.

The new IPv6 header tries to improve the main problems of IPv4 through:
- Fixed size of the header. Always 40bytes, this favours being able to process it faster because the routers can look up the source and destination addresses more efficiently. The features that IPv4 had through the variable size field, Options, we will now obtain through the header extensions, a concept that will be discussed later.
- Fragmentation stops making sense because through PMTU discovery the routers adjust the size of the frames so that there is no fragmentation of the packets. So the fields Identification, Flags, and Fragment Offset stop making sense.
- The header checksums are eliminated. This task is now left to the upper layers.
So, IPv6 headers are defined in RFC 2460 and are as follows:
- Version (4bits) version of the IP protocol, always fixed at 6.
- Traffic Class (8bits) does the same as the ToS of IPv4.
- Flow Label (20bits) through this field we identify a flow of packets, informing the router that the next 'n' packets will be the same as this one and therefore it does not need to process them. This idea is developed in RFC 3697. This information is fixed at the origin of the packet and cannot be modified by the routers.
- Payload Lengh (16bits) since the header always has 40bytes, with 16bits we have enough to delimit the size of the data. It is important to remember that the header extensions are considered part of the data.
- Next Header (8bits) we define what type of header extension follows the basic header.
- Hop Limit (8bits) it is the equivalent of the TTL. Only its name has been changed so that it is more descriptive of how the field works.
- IPv6 source address (128bits)
- IPv6 destination address (128bits)
IPv6 header extensions
Basically the header extensions are a second, optional, header that is used to provide the functions that were provided in IPv4 through the field, of variable size and a maximum of 40bytes, Otpions. In IPv6 we can make these header extensions as large as we are interested in, as long as we respect the maximum size of the packet.
Below we can see an example of a basic header, and of a header with a header extension.


In RFC 2460 we can find the definitions of the header extensions. We can find in it a description, the format and the functionality.
Hop-by-Hop Options Header
The Hop-by-Hop header is an extension of the basic header, it is defined in the Next Header field of the basic header, with the code 0. It is the only header extension that has to be processed by all the nodes on the path between the origin and the destination of the packet. It is used for example to facilitate the forwarding of Jumbograms (what that is will be explained later), or it also makes it easier for the routers to pass forwarding information to each other.
The options that this header extension carries are encoded in a format called TLV, below you can see a diagram of the format.

All the nodes on the path will receive this header and will process it. If any of the nodes did not understand the options that the header contains and that it has to process, it would generate an ICMP type packet. Although not all the options have to necessarily generate this ICMP message, this avoids problems with denial of service attacks by flooding with ICMP packets.
It is important to take into account the impact on performance that processing the hop-by-hop headers on each of the routers has. One of the features it has is supporting very large packets. The basic header only allows a size that can be defined in 16bits, that is, at most 65,536 octets.
The hop-by-hop extensions contain a 32-bit length field that can represent very large packets, called Jumbograms. When we want to use the 32bit field of the hop-by-hop header we will set the Payload length field of the basic header to 0, this identifies a Jumbogram packet.
Through RFC 2711 the Router Alert option is defined, which through the hop-by-hop header allows sending forwarding instructions. For example, to make bandwidth reservations with RSVP. Or to alert the routers that they have to process multicast packets, this is done through the Multicast Listener Discovery packets.
Destination Options Header
As the name itself indicates, this extension of the basic header refers only to the Option of the destination address. For example they are used with MIPv6. The code used in the Next Header field of the basic header is 60.
Routing Header
Identified with the code 43, in the Next Header field. It is used to enforce the path to be followed by some packets. The path is defined by the origin, and it might not coincide with the path calculated by the intermediate routers.
The routing header header contains a type field that makes it possible to know exactly the functionality of this header. At the moment there are two types of functionality defined:
- Type 0 (RFC 2460) specifies all the hops the packet has to make to travel to its destination. What the intermediate routers will do is keep changing the destination address of the basic header depending on the extended header to force the hop towards the next node; if they had to make any hop not contemplated, it would not modify the destination address of that moment nor would it appear or be added to the extended header. Therefore, these non-contemplated hops would be transparent to the process.
- Type 2 (RFC 3775) used with MIPv6. It contains a single unicast address, the home address, and enables the corresponding node to re-send the traffic directly to a mobile node.
Fragment Header
Fragmentation requires a lot of processing in the nodes. In order to avoid the need to overload the nodes' processors, IPv6 does not allow packet fragmentation. Before sending a packet, the origin has to go through a PMTU discovery process. This will determine the maximum size a packet can have along that path without the packets being fragmented. Although the routers no longer have to control the fragmentation problem, the destination nodes do have to know how to reassemble a fragmented packet. In order to be able to do so, the Fragment Option Header header extensions are used.
Authentication Header
This header is similar to the IPSec AH header (RFC 2402) used in IPv4. This system authenticates the origin of a transmission and ensures the integrity of the packet. The Next Header field identifies it with the code 51.
Encapsulating Security Payload Header
It is similar to the idea implemented in IPSec ESP (RFC 2406) in IPv4. Identified with the code 50 in the next header field.
Mobility Header
Defined in RFC 3775 and used in communications between mobile nodes, correspondent nodes and with home agents in the establishment and control of bindings. Identified with the code 135 in the next header field.
Finishing...
With this article there is enough to see that the matter of the header has been taken care of a great deal and that there is an infinity of combinations that allow extending the basic header for almost any need that occurs to us. Moreover, if we need to, we can even create new extensions for our needs. From my point of view this is one of the most powerful advantages in IPv6.
1 comment
Comments from the old blog, as they were written. Comments are closed.
adryan
i think, i still not understand about this statment... but i hope someone can help me..