IPv6 cheat-sheet, part 1: the IPv6 header & EUI-64
Let’s take a closer look at the IPv6 protocol!
Oct 4th, 2019
IPv6 is increasingly not an option but a fact of life. We’ve talked about it a lot (and some more and more) but this time we don’t want to discuss the merits or pitfalls of IPv6.
Instead, let’s take a closer look at the IPv6 protocol itself.
We’ll use our famed IPv6 cheat-sheet (also available as a lens cleaner — visit us at events to score one) as a guide, and examine each section in depth.
Let’s start with, just like an IPv6 packet does, the header.
The IPv6 header
When discussing the IPv6 header it’s inevitable to compare it to what came before:
This is of course the IPv4 header. It’s smaller in size: IPv4 uses 32 bit binary numbers whereas IPv6 uses 128-bit binary numbers. Size matters not, however. Or at least matters less.
The IPv6 header is more streamlined: it contains 8 fields, compared to IPv4’s 14 fields.
version: 4 bits long, and corresponds to IPv4’s field of the same name. It indicates the receiver the IP version to expect. In case of IPv6 that is of course 6, making this field’s binary value 0110.
traffic class: 8 bits long, and replaces IPv4’s ‘type of service’ field. The first 6 bits contain the differentiated services (DiffServ) designation of the packet, and is called differentiated services code point (DSCP). DSCP classifies the type of traffic carried by the packet for quality of service (QoS) purposes. For example, streaming media like video and audio on a conference call can enjoy lower latency than non-critical traffic, such as web browsing. The last two bits are for optional explicit congestion notifications (ECN). ECN can be used to signal congestion on the network by marking it in the IPv6 header. (Instead of dropping packets.)
flow label: 20 bits long, and new to IPv6. Useful for real-time applications, it signals the receiving node (routers or switches) to keep packets on the same path as to prevent them from being reordered.
payload length: 16-bits long. Contains the size of the payload in octets (remember those?) and can include extension headers. (Extensions headers replace the ‘options’ field known from IPv4.) It’s set to zero when the packet carries a jumbo payload.
next header: 8-bits long. It shares its function (and values) with IPv4’s ‘protocol’ field, and as the name suggests specifies the type of the next header.
hop limit: 8-bits long, formerly known in IPv4 as ‘time-to-live’. Decremented by one passing each node, and the packet is discarded when the value of hop limit reaches zero.
source address: 128 bits long, same function as in IPv4. Contains the IPv6 address of the node originally sending the packet.
destination address: 128 bits long, same function as in IPv4. Contains the IPv6 address of the destination node for which the packet is intended.
MAC to EUI-64 conversion
Extended Unique Identifier (EUI-64, because it’s 64-bits long) is a new method with which IPv6 hosts can be automatically configured in DHCP. The conversion is needed because hardware MAC addresses are 48-bits long.
This process is done in three steps:
First the 48-bit MAC address needs to be separated into two 24-bit parts: C0:A1:B2:C3:D4:E5 becomes C0:A1:B2 C3:D4:E5.
Then insert FF:FE between them, making it C0:A1:B2:FF:FE:C3:D4:E5.
Lastly, invert the 7th bit: convert the first byte (C0 in this case) to binary (resulting in 11000000), check the 7th bit (0) and flip it (to 1) and translate it back to hexadecimal (binary 11000010 becomes C2).
The final EUI-64 version of the MAC address C0:A1:B2:C3:D4:E5 thus becomes C0:A1:B2:FF:FE:C3:D4:E5.