IPv6

IPv6 is the next generation of IP which uses 128 bits to represent addresses rather than 32 bits as used in IPv4. It also adds some additional features to overcome some limitations in IPv4.

The 32 bit address space used in IPv4 allows for 4,294,967,296 (4.29 billion) addresses. With the growth in use of the internet these addresses are running out. Switching to a 128 bit address space gives 340 undecillion addresses. (That is the number 340, followed by 36 zeros)

IPv6 was first standardised in the late 1990s and since then has seen gradual but slow adoption. Network Address Translation which allows a single public IPv4 address to be shared by multiple devices such as all the computers, smartphones and set-top boxes in a house, has allowed IPv4 to continue longer than first anticipated.

Regional Internet Registries (RIR) are responsible for IP address allocations in different continents. IPv4 addresses ran out in all continents except Africa between 2011 and 2015. Africa is expected to run out of spare IPv4 addresses by 2020.


Addressing

Whereas IPv4 addresses are typically written as 4 groups of 3 digit decimal numbers, each group representing 1 byte, IPv6 is typically written in hexadecimal with each character representing 4 bits and the characters grouped in 4's separated by colons

For example: fdf2:1912:2734:1:44e3:2bf1:71c8:b0b3

Each group is called a hextet and can be written in uppercase or lowercase. Two rules can be applied to enable the address to be written in a shortened format.

1. All leading zeros in a hextet can be omitted

2. A group of all zeros can be omitted BUT you can only do this once. To omit multiple groups of all zeros they must all be next to each other

 

 

IPv6 addresses fall into one of 3 categories:

Unicast - uniquely identifies an interface on a device

Multicast - used to send a single packet to multiple destinations.

Anycast - any IPv6 unicast address that can be assigned to multiple devices. A packet sent to an anycast address is routed to the nearest device having that address

Unlike IPv4, IPv6 does not have a broadcast address. However, there is an all-nodes multicast address that gives the same result.

 

 

Prefix

The 128 bits of an IPv6 address can be split into several sections.The first section is called the prefix and identifies the network to which the address belongs. The prefix can be any length and is appended to the end of the address in slash notation

For example: fdf2:1912:2734:1:44e3:2bf1:71c8:b0b3/64 indicates that 64 bits are used for the prefix

The remaining bits are used for the Interface ID - this is the part which identifies the actual devices interface on that network

 

 

Unicast Addresses

A unicast address uniquely identifies an interface on a device. Packets sent to that address will be delivered to the corresponding devices interface. When a packet is sent the from address is ALWAYS a unicast address

A global unicast address is a standard public IPv6 address which is valid and routable across the internet.

A link-local unicast address is valid only on the local network segment/link i.e up as far as the nearest router. A router never forwards a packet with a link-local source or destination address. All IPv6 interfaces MUST have a link-local address even if they also have another address as well. The link-local address can be either manually assigned or automatically assigned. See the sidebar on EUI-64

A unique-local address (ULA) † is a private address not valid and routable across the internet. They can be used within an organisation but must be translated by a router at the network boundary for packets to traverse the internet. ULAs start with FDXX:XXXX:XXXX where the X's represent 40 bits generated pseudorandomly using the process defined in RFC4193. This process aims to make it unlikely that two networks will have the same 40 bit prefix. Although ULAs are private non globally routable addresses, hence there is not an issue if one network uses the same value, aiming to reduce the likely hood of a collision means less headaches if two private networks are linked, for example via a VPN.

Addresses starting FC were also intended to be in the ULA range but on a registration basis - organisations would purchase a block for their use only but this has never been implemented.

Both global unicast, link-local and unique-local addresses can either be manually assigned or assigned automatically. Like in IPv4, the Dynamic Host Configuration Protocol (DHCP) can be used to obtain an IPv6 address, as well as other information.

IPv6 also provides an alternative method called Stateless Auto Address Config (SLAAC). SLAAC allows a device to obtain its prefix, prefix length, default gateway address, and other information from an IPv6 router without the use of a DHCPv6 server. SLAAC can also be used in combination with DHCP (called stateless DHCP). This is where SLAAC is used to obtain an IP address and default gateway but other information such as DNS servers are obtained using DHCP. The side bar explains SLAAC in more detail.

† Unique Local Addresses have replaced an earlier range called Site Local Addresses. Site Local Addresses are now not recommended for use, Unique Local Addresses should be used instead.

 

SLAAC

Stateless Auto Address Configuration is a new feature in IPv6 which allows devices to obtain an IP address automatically by asking an IPv6 router for address information using ICMP (Internet Control Message Protocol) which is part of IP itself.

In IPv4 ICMP did not support anything like this and so automatic address configuration relied upon the application layer protocol DHCP (Dynamic Host Configuration Protocol).

DHCP can still be used in IPv6 and often is, either in conjunction with SLAAC or instead of. When used in conjunction it is called stateless DHCP, when used instead of it it called stateful DHCP. Stateful means the DHCP server maintains a record of which devices have been allocated which IP addresses. With stateless DHCP, the DHCP server is not responsible for handing out the IP addresses themselves, hence it maintains no record of who has what. In stateless mode the DHCP server is just used to give devices additional information such as DNS server addresses and a default domain name.

With SLAAC IPv6 routers send out ICMPv6 Router Advertisement (RA) messages, every 200 seconds, to all IPv6-enabled devices on the network. An RA message will also be sent in response to a host sending an ICMPv6 Router Solicitation (RS) message.

SLAAC is stateless which means there is no central record of who has what address. With SLAAC, the client device uses the information in the RA message to create its ownaddress. The network portion of the address is the same for all devices on that network and is given by the RA message.

A full RA message will contain the prefix (network portion) and prefix length and the default gateway address (the routers link local address which is the source of the RA message). The client then uses either the EUI-64 process or a random number to generate an interface ID.

Alternatively if the router has been configured to use SLAAC with stateless DHCP the RA message will contain the above information but also tell the client to contact a DHCP server.

If the router has been configured for SLAAC with stateful DHCP the RA message will only give the default gateway address (the routers link-local address which is the source of the RA message). The client will then contact a DHCP server.



EUI-64

The Extended Unique ID process is defined by the IEEE as a way of generating a unique 64 bit value for the interface ID portion of an IPv6 address.

The EUI-64 process uses the hardware address of the network interface called the Media Access Control (MAC) address. The MAC address is 48 bits, and a fixed 16 bit value is inserted into it. The MAC address consists of two parts -

  • the first part identifies the manufacturer (called an OUI Organisation Unique ID)
  • and the second part is the devices serial number (or some other sequential & unique ID assigned to each product that manufacturer produces).
  • The 7th bit of the OUI (sometimes called the U/L bit) is flipped and the 16 bit fixed value inserted between these two sections to pad it out to 64 bits which is used for the Interface ID portion of the address.

    If it is a link-local address the network portion of the address is all zeros as it is only valid on the one network and is not routed otherwise the Router Advertisement message will contain the network portion to be used.

    An important point to note is that EUI-64 can still be used on non-Ethernet interfaces which don't have a MAC address - the MAC address of any Ethernet interface the system has can be substituted without causing a conflict because even of that same Interface ID is used on the other interface they will be on different networks.


    Random numbers & DAD

    As an alternative to EUI-64 a system may choose instead to generate a random interface ID and then use Duplicate Address Detection (DAD) to ensure no one else is using it. DAD is similair to ARP in IPv4. A message is multicasted (broadcasted) to all interfaces asking who has the address in question. If there is no reply the address is not in use.

    Windows Vista and later uses this process rather then EUI-64, Windows XP and earlier used EUI-64. MacOS X 10.7 and later also use random numbers, earlier versions use EUI-64.