Skip to content
Documentation Background

IPv6

IPv6 replaces the 32-bit IPv4 address space, which ran out of new allocations at the regional registries between 2011 and 2015, with 128-bit addresses. The larger space is the main reason it exists. The protocol also removed IPv4 features that slowed routers down and replaced broadcast-based discovery with multicast.


IPv6 Address Format

An IPv6 address is 128 bits, written as eight groups of four hex digits.

Full: 2001:0db8:0000:0000:0000:ff00:0042:8329
Short: 2001:db8::ff00:42:8329

Two rules shorten it:

  1. Drop leading zeros in each group: 0db8 becomes db8, 0042 becomes 42.
  2. Replace one run of all-zero groups with ::. Use it once only, or the address is ambiguous.

IPv6 has no broadcast. Its place is taken by multicast groups, and a new type, anycast, delivers to the nearest member of a group.

TypeDelivered toExample
UnicastOne interface2001:db8:abcd:1::10
MulticastEvery member of a groupff02::1 (all nodes on the link), ff02::2 (all routers)
AnycastThe nearest interface sharing the addressSame address on several servers, routing picks the closest
PrefixPurpose
::1/128Loopback (equivalent to 127.0.0.1)
fe80::/10Link-local. Auto-configured on every interface, never routed
fc00::/7Unique local addresses (fd00::/8 in practice). The counterpart of RFC 1918 private space
ff00::/8Multicast
2000::/3Global unicast, the routable public range
2001:db8::/32Documentation, never routed
::ffff:0:0/96IPv4-mapped addresses, used by dual-stack sockets

The first 64 bits identify the network and the last 64 bits identify the interface. A typical allocation is a /48 or /56 per site, split into /64 subnets. Always use a /64 for a subnet. SLAAC (below) depends on it, and there is no address shortage to justify anything smaller.

2001:db8:abcd:0001:5054:00ff:fe12:3456
|---- /48 site ----|subnet|---- interface ID ----|

IPv6 Header vs IPv4

The base header is a fixed 40 bytes. IPv4’s is 20 bytes or more, with options.

FieldSizePurpose
Version4 bits6
Traffic Class8 bitsSame role as IPv4 DSCP and ECN
Flow Label20 bitsMarks packets of one flow so routers can treat them together without reading the transport header
Payload Length16 bitsBytes after the base header
Next Header8 bitsUpper-layer protocol (6 TCP, 17 UDP, 58 ICMPv6), or the next extension header
Hop Limit8 bitsThe TTL equivalent. Decremented per hop, dropped at 0
Source and Destination128 bits eachAddresses

Three IPv4 features were removed on purpose:

RemovedWhyWhat replaces it
Header checksumLink layer and transport layer already check, and the router would otherwise recompute it at every hopNothing. UDP over IPv6 must therefore use its own checksum
Fragmentation by routersSplitting packets slows the forwarding pathThe source fragments, using a Fragment extension header. A router that cannot forward a packet drops it and sends ICMPv6 “Packet Too Big”
Options in the base headerVariable length complicates hardwareExtension headers chained through Next Header

Every IPv6 link must support an MTU of at least 1280 bytes. Hosts discover the path MTU from Packet Too Big messages, so unlike IPv4 there is no option to fall back on fragmenting in the middle of the path.


An IPv6 interface normally holds several addresses at once: a link-local address, one or more global addresses, and often a temporary one. Three mechanisms provide them.

Stateless address autoconfiguration lets a host build its own global address without a server that tracks leases.

  1. The host creates a link-local address (fe80:: plus an interface ID).
  2. It sends a Router Solicitation to ff02::2.
  3. A router replies with a Router Advertisement (RA) carrying the /64 prefix, the default router lifetime, and flags that say what else to ask for.
  4. The host combines the prefix with an interface ID and checks that nobody else uses the address (see Neighbor Discovery below).
  5. The default route is learned from the RA’s source, which is why ip -6 route shows a link-local next hop.

Routers also send unsolicited RAs periodically. A host’s DNS server can come from the RA itself (the RDNSS option) or from DHCPv6.

The interface ID used to be derived from the MAC address (EUI-64), which exposed the hardware address and let a device be tracked across networks. Modern systems use a stable random ID per network (RFC 7217) and rotate temporary addresses (RFC 4941) for outbound connections. That is why one interface shows several global addresses.

DHCPv6 works in two modes, selected by flags in the RA:

ModeRA flagWhat DHCPv6 provides
StatelessO (other config)DNS servers and similar options. The address still comes from SLAAC
StatefulM (managed)The address itself, with leases and reservations, like DHCPv4

DHCPv6 does not carry a default gateway. The router address always comes from the RA. Android does not support stateful DHCPv6, so a network with Android clients needs SLAAC.

Neighbor Discovery Protocol (NDP) runs over ICMPv6 and replaces ARP. It uses multicast, not broadcast, so uninterested hosts are not interrupted.

ICMPv6 typeMessageUsed for
133Router Solicitation”Is there a router here?“
134Router AdvertisementPrefix, default router, flags
135Neighbor Solicitation”Who has this address?” Also duplicate address detection
136Neighbor AdvertisementThe answer, with the MAC address

A Neighbor Solicitation for address X goes to the solicited-node multicast address ff02::1:ff plus the last 24 bits of X, so only hosts with a matching suffix listen. Before using a new address, the host sends a solicitation for it from the unspecified address ::. If no one answers, the address is unique. This is duplicate address detection.

Because NDP is the equivalent of ARP, it has the equivalent weakness: any host on the link can claim to be the router or a neighbor. Switch features such as RA Guard address this. See Network hardening.

Terminal window
# Addresses on an interface
ip -6 addr show dev eth0
# inet6 2001:db8:abcd:1:5054:ff:fe12:3456/64 scope global dynamic mngtmpaddr
# inet6 fe80::5054:ff:fe12:3456/64 scope link
# Default route learned from a Router Advertisement
ip -6 route show default
# default via fe80::1 dev eth0 proto ra metric 1024 expires 1790sec
# Neighbor cache (the IPv6 ARP table)
ip -6 neigh show
# fe80::1 dev eth0 lladdr 00:00:5e:00:02:01 router REACHABLE
# Watch NDP and other ICMPv6 on the wire
sudo tcpdump -i eth0 -n icmp6
# Link-local addresses need the interface name
ping -6 fe80::1%eth0

In IPv4, many networks block ICMP wholesale and survive. In IPv6 that breaks the protocol, because address resolution, router discovery, and path MTU discovery all use ICMPv6.

Terminal window
sudo nft add rule inet filter input icmpv6 type \
{ destination-unreachable, packet-too-big, time-exceeded, parameter-problem, \
nd-router-solicit, nd-router-advert, nd-neighbor-solicit, nd-neighbor-advert } accept

IPv4 to IPv6 Transition

A single cutover is impossible, so the two protocols coexist. Three approaches exist, and most networks use the first.

MethodHow it worksWhen to use
Dual-stackEvery device runs IPv4 and IPv6 at onceDefault choice. Native IPv6 where available
TunnelingAn IPv6 packet is carried inside an IPv4 packet (IP protocol 41)Two IPv6 sites connected over an IPv4-only path
Translation (NAT64)A gateway converts between IPv6 and IPv4IPv6-only clients that must reach IPv4-only services

The tunnel entrance wraps the whole IPv6 datagram as the payload of an IPv4 datagram. The outer source and destination are the two tunnel endpoints. Routers in between forward it as ordinary IPv4. At the exit, the endpoint sees protocol 41, strips the outer header, and forwards the IPv6 packet on.

IPv6 host A -> [ tunnel entrance ] ==== IPv4 network ==== [ tunnel exit ] -> IPv6 host B
outer: IPv4 src = entrance, dst = exit, protocol = 41
inner: the original IPv6 datagram

The extra 20-byte header reduces the MTU, with the same black-hole risk described earlier. Static 6in4 tunnels are predictable but do not work through NAT. Tunnel brokers use protocols such as AYIYA when NAT is in the way. Automatic mechanisms such as 6to4 and Teredo are deprecated.

In an IPv6-only network, a DNS64 resolver invents AAAA records for IPv4-only names by embedding the IPv4 address in a 64:ff9b::/96 prefix. The client sends IPv6 to that address, and the NAT64 gateway translates the packet to IPv4. Mobile carriers use this widely, so IPv6-only clients can still reach the whole internet.

A dual-stack client that resolves both A and AAAA records does not wait for IPv6 to fail. It starts an IPv6 connection, starts IPv4 a few hundred milliseconds later if IPv6 has not completed, and uses whichever connects first (RFC 8305). A broken IPv6 path therefore shows up as small delays and not as an outage, which makes it easy to miss.


  • AWS allocates a /56 IPv6 block per VPC and a /64 per subnet. IPv6 addresses are globally routable, so there is no NAT. An egress-only internet gateway gives private subnets outbound-only access, which is the IPv6 equivalent of a NAT gateway for policy purposes.
  • Security groups and network ACLs have separate IPv6 rules. A rule for 0.0.0.0/0 does not cover ::/0.
  • Kubernetes supports dual-stack pods and Services (stable since 1.23). Each pod gets its own IPv6 address, so pods and Services can be reached without NAT. See Kubernetes Services.

Terminal window
# Does the name have an IPv6 address?
dig AAAA app.example.com +short
# Force one family
curl -4 -sI https://app.example.com/ | head -1
curl -6 -sI https://app.example.com/ | head -1
# Path and reachability over IPv6
ping -6 -c 3 app.example.com
traceroute -6 app.example.com
mtr -6 -rwc 10 app.example.com
# Routes and sockets
ip -6 route show
ss -6 -tlnp
SymptomLikely causeFix
Site is slow, but fast with curl -4The IPv6 path is broken and clients wait before falling backTest with curl -6, then fix the route, firewall, or remove the AAAA record
Host has fe80:: only, no global addressNo Router Advertisement receivedCheck the router’s RA config and that RAs are not filtered. Check net.ipv6.conf.eth0.accept_ra
Local IPv6 works, off-link failsNo default route, or the upstream does not route the prefixCheck ip -6 route show default and the upstream allocation
Large transfers stall, small ones workICMPv6 Packet Too Big is blockedAllow ICMPv6 types 1 to 4
ping fe80::1 says invalid argumentLink-local needs a scopeUse ping fe80::1%eth0
Service reachable on IPv4 onlyDaemon listens on 0.0.0.0, not ::Bind to :: (a dual-stack socket also accepts IPv4)
Cloud instance has no IPv6 inboundSecurity group has no ::/0 ruleAdd the IPv6 rule