Login »

IPv6 is the next generation of IP, which uses 128 bits to represent addresses rather than the 32 bits used in IPv4. It also adds some additional features to overcome 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's 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 — all the computers, smartphones and set-top boxes in a house, for example — has allowed IPv4 to continue longer than first anticipated.

Simplified map of Regional Internet Registries

Regional Internet Registries (RIR) are responsible for IP address allocations on different continents. IPv4 addresses ran out in every continent 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 four groups of decimal numbers, each group representing 1 byte, IPv6 is typically written in hexadecimal, with each character representing 4 bits, grouped in fours and 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 let the address 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 only once. To omit multiple groups of all zeros, they must all be next to each other.

For example, the address 2001:0db8:0000:0000:0000:0000:0000:0001 shortens first to 2001:db8:0:0:0:0:0:1 by dropping leading zeros within each hextet, then to 2001:db8::1 by collapsing the run of all-zero hextets into a double colon.

IPv6 addresses fall into one of three categories:

  • Unicast — uniquely identifies an interface on a device.
  • Multicast — used to send a single packet to multiple destinations. Multicast addresses always begin ff00::/8.
  • 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.

A few addresses worth knowing: ::1 is the loopback address (IPv6's equivalent of IPv4's 127.0.0.1). :: on its own is the unspecified address, used before a device has an address of its own. ff02::1 reaches all nodes on the local link; ff02::2 reaches all routers on the local link.

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 — the part identifying the device's actual interface on that network.

Unicast Addresses

A unicast address uniquely identifies an interface on a device. Packets sent to that address are delivered to the corresponding device's interface. When a packet is sent, the "from" address is always a unicast address.

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

A link-local unicast address is valid only on the local network segment/link — up as far as the nearest router. Link-local addresses always begin fe80::/10. 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. A link-local address can be manually or automatically assigned.

A unique-local address (ULA)† is a private address, not valid or routable across the internet. ULAs 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 Xs represent 40 bits generated pseudorandomly using the process defined in RFC 4193 — designed to make it unlikely that two networks will have the same 40-bit prefix. Although ULAs are private, non-globally-routable addresses (so there's no real issue if two unrelated networks happen to use the same value), reducing the likelihood of a collision means fewer headaches if two private networks are later linked, for example via a VPN. Addresses starting FC were also intended for the ULA range, but on a registration basis — organisations would purchase a block for their own use — though this has never been implemented.

Global unicast, link-local and unique-local addresses can each be manually assigned or assigned automatically. As in IPv4, the Dynamic Host Configuration Protocol (DHCP) can be used to obtain an IPv6 address, along with other information. IPv6 also provides an alternative method called Stateless Address Autoconfiguration (SLAAC), letting a device obtain its prefix, prefix length, default gateway address and other information from an IPv6 router without a DHCPv6 server. SLAAC can also be combined with DHCP (called "stateless DHCP"), where SLAAC obtains the IP address and default gateway while other information, such as DNS servers, comes from DHCP.

† Unique Local Addresses have replaced an earlier range called Site Local Addresses. Site Local Addresses are no longer recommended; Unique Local Addresses should be used instead.

SLAAC

Stateless Address Autoconfiguration is a feature in IPv6 that lets devices 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 didn't support anything like this, so automatic address configuration relied on the application-layer protocol DHCP.

DHCP can still be used in IPv6, and often is — either alongside SLAAC or instead of it. Used alongside, it's called stateless DHCP; used instead of SLAAC, it's called stateful DHCP. Stateful means the DHCP server keeps a record of which devices have been allocated which IP addresses. With stateless DHCP, the server isn't responsible for handing out the IP addresses themselves, so it keeps no such record — 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 is also sent in response to a host sending an ICMPv6 Router Solicitation (RS) message.

SLAAC is stateless, meaning there's no central record of who has what address. The client device uses the information in the RA message to create its own address. The network portion of the address is the same for all devices on that network, and comes from the RA message.

A full RA message contains the prefix (network portion), prefix length, and the default gateway address (the router's 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.

If the router is configured for SLAAC with stateless DHCP, the RA message contains the above, but also tells the client to contact a DHCP server. If configured for SLAAC with stateful DHCP, the RA message only gives the default gateway address, and the client contacts a DHCP server for the rest.

EUI-64

The Extended Unique Identifier 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.

EUI-64 uses the hardware address of the network interface — its Media Access Control (MAC) address. The MAC address is 48 bits, and a fixed 16-bit value is inserted into it. The MAC address itself consists of two parts: the first identifies the manufacturer (called an OUI, Organisationally Unique Identifier), and the second is the device's serial number (or some other sequential, unique ID assigned to each product that manufacturer makes).

The 7th bit of the OUI (sometimes called the U/L bit) is flipped, and the fixed 16-bit value is inserted between the two sections, padding it out to 64 bits — used as the Interface ID portion of the address. For a link-local address, the network portion is all zeros, since it's only valid on the one network and not routed; otherwise, the Router Advertisement message contains the network portion to use.

EUI-64 can still be used on non-Ethernet interfaces that don't have a MAC address — the MAC address of any Ethernet interface the system has can be substituted without causing a conflict, since even if the same Interface ID ends up on another interface, they'll be on different networks.

Random numbers & DAD

As an alternative to EUI-64, a system may instead generate a random interface ID and use Duplicate Address Detection (DAD) to make sure no one else is using it. DAD works by multicasting a Neighbor Solicitation message to all interfaces, asking who has the address in question; if there's no reply, the address isn't in use.

IPv6 has no ARP at all — unlike IPv4, where ARP is a separate, bolted-on mechanism. In IPv6, address resolution, duplicate detection and router discovery are all handled by a single protocol called Neighbor Discovery Protocol (NDP), built on ICMPv6. The Router Advertisement and Router Solicitation messages used by SLAAC, and the Neighbor Solicitation messages used by DAD, are all part of this same NDP suite, rather than separate, unrelated mechanisms.

Windows Vista and later use this random-number process rather than EUI-64; Windows XP and earlier used EUI-64. macOS 10.7 and later also use random numbers; earlier versions used EUI-64.