Welcome to the fifth article in the IPv6 series. In past articles, we have looked at IPv6 address types, the IPv6 scoped address architecture and, most recently, interface identifiers for unicast addresses. In this article, we will consider the structure of an IPv6 packet and also look at the IPv6 header and how it compares to the IPv4 header.

IPv4 and IPv6 Packet Structures

From our IPv4 knowledge, we are familiar with the concept of encapsulation, in which each lower-level OSI layer takes the data passed down from higher layers of the OSI model and encapsulates it in its own format, including a header (and sometimes a footer). At the IP (network) layer, we call this message an IP packet or IP datagram. The general format of an IPv4 packet is as shown below:

The IP header is added at the IP layer and contains information such as the source and destination IP address, while the payload contains the upper-layer protocol data unit (i.e., the upper-layer header + upper-layer payload). Stemming from this format, the IPv6 packet is also similar except that the Payload portion is made up of upper-layer protocol data and IPv6 extension headers if available.

We will talk about IPv6 extension headers in a later section of this article, but keep in mind that an IPv6 packet may not contain an IPv6 extension header, effectively making the structure of that IPv6 packet similar to that of an IPv4 packet.

IPv4 and IPv6 Headers

As usual, let us begin with what we are familiar with. According to the RFC on IPv4, the IPv4 header is shown below:

Let’s briefly highlight what each field is about, because it will help in our understanding of the IPv6 header:

  1. Version—Identifies the format of the header. For IPv4, this value will be 4. As we will see, the value will be 6 for IPv6.
  2. IHL—This stands for Internet header length. Remember that, because of IP options, the IPv4 header does not have a fixed length. The minimum length is 20 bytes and the maximum length is 60 bytes.
  3. Type of Service—This has been renamed the differentiated services field and it finds its use in quality of service (QoS).
  4. Total Length—Entire length of the IPv4 packet, i.e., the header plus payload.
  5. Identification—Helps in reassembly of fragmented packets.
  6. Flags—Conveys information about fragmentation.
  7. Fragment Offset—Indicates the position of a fragment in the payload.
  8. Time to Live (TTL)—Specifies the maximum lifetime of a packet as it traverses links.
  9. Protocol—Indicates the upper-layer protocol, e.g., TCP (6), ICMP (1).
  10. Header Checksum—Ensures integrity of the IPv4 header. The payload is not included in the checksum calculation.
  11. Source Address—Address of sending host.
  12. Destination Address—Address of recipient.
  13. Options—Variable length field that carries IPv4 options information, such as loose source routing.
  14. Padding—Used to ensure that the header is a multiple of 32 bits.

Let’s look at an example packet (telnet session) captured through Wireshark.

The first thing you will notice is the concept of encapsulation that I mentioned above, i.e., the TCP segment is encapsulated in the IP packet, which is encapsulated in an Ethernet frame, and so on. Then, if we look at the IPv4 portion, we will see all the fields we discussed above, although there are no options (or padding) specified in this packet.

We can now move on to the IPv6 header. As I mentioned in the introductory article, the IPv6 header is much simpler than the IPv4 header even though it is twice the (minimum) size of an IPv4 header. According to RFC 2460, the main IPv6 header format is as shown below:

Let’s also highlight the fields in the IPv6 header as we did for IPv4:

  1. Version—The same as in IPv4 except that it has a value of 6.
  2. Traffic Class—Similar functionality as the differentiated services (ToS) field.
  3. Flow Label—New to IPv6, this allows the source to identify that a packet belongs to a sequence of packets (i.e., flow) that require special handling by the router
  4. Payload Length—This is similar to the Total Length field in the IPv4 header except that it specifies only the length of the payload, i.e., the IPv6 extension headers (if any) + upper-layer PDU.
  5. Next Header—Uses the same values as the Protocol field in the IPv4 header. It identifies the type of header after the IPv6 header, i.e., an IPv6 extension header or an upper-layer protocol (e.g., TCP, UDP).
  6. Hop Limit—Similar to the TTL field in the IPv4 header. The TTL field initially related to time in theory but, as we know, practical implementations used TTL as hop counts. This is why the field was renamed in IPv6.
  7. Source Address—128-bit IPv6 address of the sender.
  8. Destination Address—128-bit IPv6 address (unicast, anycast, or multicast) of the destination.

Let’s now try to compare the IPv4 and IPv6 headers.

  1. Looking at the IPv6 header, the first thing you notice is that there are only 8 fields compared to the 14 fields in the IPv4 header; thus it is simpler.
  2. There is no header length field in the IPv6 header because it has a fixed value of 40 bytes.
  3. All fragmentation fields in the IPv4 header have been removed completely from the IPv6 header. They have been moved to an IPv6 extension header.
  4. The header checksum field has also been removed from the IPv6 header.
  5. As highlighted above, there is a new field in IPv6: Flow Label.
  6. Finally, all options have been moved away from the main IPv6 header to IPv6 extension headers.

IPv6 Extension Headers

All through this article, I have mentioned the IPv6 Extension headers, so let’s talk about them now. In IPv4, if options are present in the IP header, all intermediate routers must also process them, thereby slowing down packet forwarding. In IPv6, all options have been moved to the IPv6 extension headers and intermediate routers do not need to process these headers (with the exception of the hop-by-hop options header). This speeds up the IPv6 header processing and also the packet forwarding.

There are six IPv6 extension headers that must be supported by all implementations as defined by RFC 2460:

  1. Hop-by-hop options header
  2. Routing (Type 0) header
  3. Fragment header
  4. Destination options header
  5. Authentication header
  6. Encapsulating security payload header

Hint: We are already familiar with the authentication header (AH) and encapsulating security payload Header (ESP) from IPsec.

An IPv6 packet may or may not include any of these IPv6 Extension headers the same way an IPv4 packet may or may not have options specified in the IPv4 header.

We can also look at a Wireshark capture of a ping (ICMPv6) between two IPv6 hosts and see the fields in the IPv6 header.

Notice that the Next Header field in the IPv6 packet shown above contains the value “58,” which is the protocol number of ICMPv6. The table below shows common values (in decimal) that can be found in the Next Header field of an IPv6 header.

You can find a list of all the protocol numbers here. Also, you can find a list of the values for the IPv6 extension header types here.

Let us end this article with an example of the Next Header field values.

Using the Next header value table above, we can fill in the values for what the next header field will be in this diagram:

Below is a real capture of a fragmented ping between two hosts. Notice the IPv6 Fragment Header and also Next Header values as discussed above.


In this article, we have looked at the packet and header structures for IPv6. We saw that IPv6 headers have a fixed length of 40 bytes and options from IPv4 have been moved to extension headers in IPv6.

In the next article, we will discuss ICMPv6, which plays a very important role in IPv6. I hope you have found this article insightful.

References and Further Reading

  1. RFC 2460: Internet Protocol, Version 6 (IPv6) Specification: http://www.ietf.org/rfc/rfc2460.txt
  2. RFC 791: Internet Protocol: http://www.ietf.org/rfc/rfc791.txt
  3. Internet Protocol Version 6 (IPv6) Parameters: http://www.iana.org/assignments/ipv6-parameters/ipv6-parameters.xhtml