The IPv6 address space

One IPv6 subnet holds four billion IPv4 internets

addresses, as a power of 2 (each step right doubles)2^02^322^642^962^128The whole IPv4 internet4.3 billionOne IPv6 subnet (/64)18 billion billionOne site’s allocation (/48)65,536 subnets of /64All of IPv63.4 × 10³⁸One IPv6 subnet holds 2^32 times the whole IPv4 internet: about 4.3 billion IPv4 internets.IPv4’s 4.3 billion addresses ran out: IANA handed out its last blocks in February 2011, and the regional registries followed(ARIN in 2015, RIPE NCC in 2019). IPv6 widens the address to 128 bits. Every subnet is a /64 by convention, a home orsite is given a /48 or /56, and about half of Google’s users reach it over IPv6 today.

IPv6 addresses are 128 bits. A single /64 subnet has 2^64 addresses, 2^32 times all of IPv4.

Writing IPv6 addresses

Drop leading zeros, then fold one run of zero groups into ::

In full: eight groups of four hex digits, 16 bits each20010db8000000000000ff0000428329Rule 1: drop the leading zeros in each group2001db8000ff00428329Rule 2: replace one run of all-zero groups with ::, once per address2001:db8::ff00:42:8329Drop the leading zeros, then replace one run of zero groups with a double colon.2001:0db8:0000:0000:0000:ff00:0042:8329 becomes 2001:db8::ff00:42:8329.The :: can appear only once, because a reader works out how many groups it hides by counting the rest. When two runs are equally long, compress the first; never compress a single group. Writeaddresses in lowercase. 2001:db8::/32 is reserved for documentation, as 192.0.2.0/24 is in IPv4.

2001:0db8:0000:0000:0000:ff00:0042:8329 shortens to 2001:db8::ff00:42:8329. The double colon may appear only once.

Prefix and interface ID

The first 64 bits choose the subnet; the last 64 choose the interface

2001:db8:acadglobal routing prefix48 bits: from your provider0001subnet16 bits: yours0000:0000:0000:0001interface ID64 bits: one device on the subnet04864128Written: 2001:db8:acad:1::1/64. The /64 is the prefix length, exactly as in IPv4 CIDR.A /48 leaves 16 subnet bits: 65,536 subnets of /64 for one site. A home on a /56 gets 256.The first 64 bits choose the subnet; the last 64 choose the interface on it.Nobody subnets IPv6 by counting hosts: every LAN is a /64, because SLAAC and neighbour discovery assume it. Planning meansnumbering subnets inside the provider’s prefix, often by site and VLAN (2001:db8:acad:10::/64 for VLAN 10). Point-to-pointlinks may use /127 (RFC 6164). There is no broadcast address to lose and no network address to reserve.

A global address is a global routing prefix (often /48), a 16-bit subnet ID and a 64-bit interface ID.

Prefix and interface ID · Going deeper

Address types: global, unique local, link-local, multicast

TypePrefixExampleUseGlobal unicast2000::/32001:db8:acad:1::10routable on the internet, like a public IPv4Unique localfc00::/7fd12:3456:789a:1::10private, like RFC 1918; not routed outsideLink-localfe80::/10fe80::21a:2bff:fe3c:4d5eevery interface has one; never leaves the linkMulticastff00::/8ff02::1, ff02::2replaces broadcast; all nodes, all routersSolicited-nodeff02::1:ff/104ff02::1:ff3c:4d5elast 24 bits of an address; used by NDPLoopback::1/128::1this host; :: (unspecified) means no address yetAnycastany unicast prefixthe subnet-router addressone address on many devicesAn IPv6 interface always has several addresses at once: a link-local, usually a global, and its multicast groups.Routers use link-local addresses as next hops; OSPFv3 neighbours talk over them. A packet to fe80:: must name the interface(fe80::1%eth0) because every link uses the same prefix. ff02:: addresses stay on the link; ff05:: covers a site.

Global unicast is 2000::/3, unique local fc00::/7, link-local fe80::/10 and multicast ff00::/8. IPv6 has no broadcast.

SLAAC

A host builds its own address from the router’s advertised prefix

New hostRouterRouter Solicitation to ff02::2: any routers here?Router Advertisement: prefix 2001:db8:acad:1::/64, gateway is me (fe80::1)builds 2001:db8:acad:1:21a:2bff:fe3c:4d5eNeighbour Solicitation: is anyone already using it? (silence = no)With SLAAC a host builds its own global address from the prefix the router advertises. No server needed.The router advertisement (ICMPv6 type 134) carries the /64 prefix and makes the router the default gateway; the host addsits interface ID and checks for duplicates (duplicate address detection) before using it. Routers send advertisementsevery few minutes anyway, and a new host can ask with a solicitation (type 133). ipv6 unicast-routing turns this on in IOS.

SLAAC: the router advertisement gives the prefix and gateway; the host adds its interface ID and checks for duplicates.

SLAAC · Going deeper · 1 of 2

SLAAC or DHCPv6, and the NDP messages

MethodRA flagsAddress fromDNS servers fromSLAAC onlyM=0, O=0the host (prefix + ID)the RA itself (RDNSS option)SLAAC + stateless DHCPv6M=0, O=1the hosta DHCPv6 serverStateful DHCPv6M=1a DHCPv6 serverthe DHCPv6 serverNDP messageICMPv6 typeDoes the job ofRouter Solicitation / Advertisement133 / 134finding the gateway and the prefixNeighbour Solicitation / Advertisement135 / 136ARP: finding a neighbour’s MAC; duplicate address detectionRedirect137ICMP redirectNeighbour discovery replaces ARP, and the router advertisement’s flags tell hosts where to get the rest.A neighbour solicitation goes to the target’s solicited-node multicast group, not to everyone, so only one or two hostsare disturbed. Android does not support stateful DHCPv6, which is why most networks advertise prefixes for SLAAC.

The RA’s M and O flags choose SLAAC, stateless or stateful DHCPv6. Neighbour discovery (ICMPv6 133 to 137) replaces ARP.

SLAAC · Going deeper · 2 of 2

Insert FFFE in the MAC and flip the seventh bit

MAC address001a2b3c4d5e1 Split it, insert FFFE001a2bfffe3c4d5e2 Flip bit 7 of the first byte000000000000001000 becomes 023 Interface ID21a:2bff:fe3c:4d5ewith a prefix: 2001:db8:acad:1:21a:2bff:fe3c:4d5eModified EUI-64 builds a 64-bit interface ID from a 48-bit MAC: insert FFFE in the middle and flip the seventh bit.The flipped bit is the universal/local bit; flipping it makes manually chosen IDs like ::1 come out “local”. Routers andswitches often use EUI-64 (ipv6 address 2001:db8:acad:1::/64 eui-64). Laptops and phones use random IDs instead (RFC 8981),because an ID made from the MAC follows a device from network to network and makes it trackable.

EUI-64 turns MAC 00:1a:2b:3c:4d:5e into interface ID 21a:2bff:fe3c:4d5e.

IPv4 to IPv6 transition

Most networks run both for years and translate at the edges

Dual stack192.168.1.102001:db8:1::10both protocols on every link;the host prefers IPv6TunnellingIPv6 packetIPv4 header in frontcarries IPv6 across an IPv4-onlynetwork (6in4, GRE)NAT64 + DNS64IPv6 onlyIPv4 onlytranslates at the edge; the normon mobile networks (64:ff9b::/96)The move takes decades, so most networks run IPv4 and IPv6 side by side and translate at the edges.Dual stack is the default design: every interface has both, DNS returns both A and AAAA records, and the client tries IPv6first with a quick fallback (Happy Eyeballs). Tunnels cross islands of IPv4. Mobile carriers run IPv6 only and reachIPv4 sites through NAT64. Firewalls must have IPv6 rules too, or IPv6 becomes the open back door.

Dual stack runs IPv4 and IPv6 together; tunnelling carries IPv6 across IPv4; NAT64 lets IPv6-only hosts reach IPv4 servers.

Lesson complete

You finished “IPv6”

Nicely done.

Open in a new tab