5. IPv6: The 128-Bit Internet
Four times the bits, a /64 for every LAN, and hosts that pick their own addresses
Imagine a phone network where you plug in a brand-new phone and it picks its own number.
The local exchange keeps announcing, every few minutes, "this street's numbers all start
with +46 8 555". The phone hears that, sticks its own serial number on the end, then calls
out once: "is anyone already using this number?" Silence. So it starts taking calls. No
operator, no paperwork, no clash.
That only works if numbers are absurdly plentiful. If the exchange had to ration them, it couldn't let phones help themselves, and it certainly couldn't afford to burn a whole serial number's worth of digits on every street. IPv6 is what addressing looks like when you stop rationing. Addresses are 128 bits long instead of 32, every local network gets more addresses than the entire IPv4 Internet many times over, and that abundance changes the design: hosts build their own addresses, broadcast disappears, and NAT stops being necessary.
In the IPv4 Addressing article we drew a line between the network and host parts of a 32-bit address and watched the world run out. This article picks up from there. Everything about prefixes carries over unchanged; the new parts are the notation, the address types, and how a host configures itself. Our home network gets an IPv6 prefix alongside its old IPv4 addresses:
| Device | IPv4 | IPv6 link-local |
|---|---|---|
| Router | 192.168.1.1 |
fe80::ff:fecc:dd02 |
| Laptop | 192.168.1.10 |
fe80::ff:feaa:bb01 |
| Printer | 192.168.1.20 |
fe80::ff:feaa:bb03 |
| NAS | 192.168.1.30 |
fe80::ff:feaa:bb04 |
The MAC addresses are the ones from the Ethernet article: the router is
02:00:00:cc:dd:02, and the laptop, printer and NAS are 02:00:00:aa:bb:01, …:03 and …:04. The LAN's
global prefix is 2001:db8:1234:1::/64, and the web server out on the Internet,
203.0.113.80 in the IPv4 articles, now also has the address 2001:db8:113::80. By the
end you'll be able to read every one of those strings, and work out the right-hand column
yourself from the MAC addresses.
Why a New Protocol?
IPv4's 4.3 billion addresses ran out at the top in 2011, when IANA handed its last /8s to
the regional registries, and the registries ran dry over the following decade (the
timeline is in the IPv4 article). The Internet kept growing
anyway, mostly by hiding whole networks behind one public address with
NAT. That works, but it breaks the original idea that any machine can reach any
other: a device behind NAT can't easily be contacted from outside, and protocols for calls,
games and peer-to-peer file transfer need elaborate workarounds to get through.
The IETF saw this coming early. By 1994 it was clear the address space would not last, and the "IP next generation" effort settled on a design that became RFC 1883 in December 1995. The current specification is RFC 8200 (2017). The designers took the chance to fix a few other things while they were at it: a simpler header, no fragmentation by routers, built-in autoconfiguration, and multicast in place of broadcast. We'll meet each of those.
What happened to IPv5?
The 4-bit version field at the start of every IP header had already given the number 5 to the experimental Internet Stream Protocol (ST-II), a connection-oriented protocol for real-time audio and video. It never caught on, but the number was taken, so the next IP became version 6.
How Big Is 128 Bits?
An IPv6 address is a 128-bit number. Each extra bit doubles the count, so 96 extra bits over IPv4 multiply it by 296:
Written out in full, that's:
340,282,366,920,938,463,463,374,607,431,768,211,456
Numbers that size are hard to feel, and the popular comparisons ("an address for every grain of sand") rest on estimates nobody can check. Comparisons with IPv4 itself are easier to trust:
- The whole IPv6 space holds 296 complete copies of the IPv4 Internet. All
4.3 billion IPv4 addresses would fit in a
/96, a sliver you'd never notice. - A single LAN is a
/64, leaving 64 bits for hosts: 264, about 1.8 × 1019 addresses. That's 232, about 4.3 billion times the entire IPv4 Internet, on one home network. - Even the part in use is huge. Only one eighth of the space,
2000::/3, is currently handed out for ordinary addresses. It contains 245, about 35 trillion,/48blocks (a/48is a typical allocation for a whole organisation, as we'll see). That's more than 4,000 for every person alive.
So IPv6 isn't designed to be used up address by address. It's designed so that the interesting question is never "how many addresses can we spare?" but "how many networks do we need?" That shift is why the rest of this article spends so little time on counting hosts.
Writing an Address Down
Thirty-two bits fit comfortably in four decimal bytes. 128 bits in decimal bytes would be sixteen numbers long, so IPv6 uses hexadecimal instead: eight groups of 16 bits, each written as four hex digits, separated by colons. Here's the laptop's global address in full:
2001:0db8:1234:0001:0000:00ff:feaa:bb01
Each group is 16 bits, so each hex digit is 4 bits (a nibble). That's 8 × 4 = 32 hex digits, which is still a lot of typing, so two shortening rules apply.
Rule 1: drop leading zeros in each group. 0db8 becomes db8, 0001 becomes 1,
0000 becomes 0. Only leading zeros go: ff00 stays ff00, because those zeros carry
meaning.
Rule 2: replace one run of all-zero groups with ::. The double colon means "as many
0000 groups as it takes to make eight". You can only do it once per address, because two
:: would be ambiguous: 2001::1::1 shows three groups, so five zero groups are missing,
but are there one on the left and four on the right, or two and three, or three and two?
There's no way to tell, so the address is invalid.
Here's a fuller example, step by step:
To expand an address, run the steps backwards: count the groups you can see (here five),
fill the :: with enough 0000 groups to make eight (three), and pad every group back out
to four digits.
One address, one spelling
The rules above leave choices: you may compress, and an address with two zero runs could
have either one compressed. That made life miserable for anyone searching logs or comparing
configuration files, since 2001:DB8:0:0::1, 2001:db8::1 and 2001:0db8::0001 are all
the same address. So
RFC 5952
(2010) defined one canonical form that software should print:
-
Always drop leading zeros
2001:0db8::0001must be written2001:db8::1. -
Use
::on the longest run, as much as possibleIf two runs tie for longest, compress the first.
2001:db8:0:0:1:0:0:1becomes2001:db8::1:0:0:1, not2001:db8:0:0:1::1. -
Never use
::for a single zero groupIt would save just one character, so
2001:db8:0:1::1keeps its lone:0:. The laptop's address,2001:, has only one zero group, so it gets nodb8: 1234: 1: 0: ff: feaa: bb01 ::at all. -
Lowercase hex
2001:DB8::FF00is written2001:db8::ff00.
Software must still accept every valid spelling; the canonical form is about what it prints. Here's the whole compression algorithm:
function compress(groups): # groups: eight 16-bit numbers
best_start, best_len = -1, 0
i = 0
while i < 8: # find the longest run of zero groups
if groups[i] == 0:
j = i
while j < 8 and groups[j] == 0: j += 1
if j - i > best_len: # strictly longer: ties keep the first run
best_start, best_len = i, j - i
i = j
else:
i += 1
text = [hex(g) for g in groups] # lowercase, no leading zeros
if best_len < 2: # never compress a single zero group
return join(text, ":")
left = join(text[0 : best_start], ":")
right = join(text[best_start + best_len : 8], ":")
return left + "::" + right # "::1", "fe80::" and "::" fall out naturally
IPv4 inside IPv6, and addresses in URLs
Two more spellings turn up often enough to know.
Embedded IPv4. When the last 32 bits of an IPv6 address hold an IPv4 address, you may
write them as a dotted quad. The common case is the IPv4-mapped address
::ffff:192.0.2.1, which is how a program using one IPv6 socket for both protocols sees an
IPv4 client. It's the same 128 bits as ::ffff:c000:201 (192 = c0, 0 = 00,
2 = 02, 1 = 01), just easier to read.
Brackets in URLs. A colon already means "port number follows" in a URL, so an IPv6 address in a URL goes in square brackets:
http://[2001:db8:113::80]/ the web server, port 80
http://[2001:db8:113::80]:8080/ the same server, port 8080
2001:db8:113::80:8080 NOT this: it's just a different address
The same bracket convention is used wherever an address and port share a string, such as
[2001:db8:113::80]:443 in a configuration file or log.
Prefix, Subnet, Interface
Everything from the IPv4 article about prefixes carries over: /64 means "the first 64 bits
are the network", routers pick the longest matching prefix, and blocks aggregate in exactly
the same way. What's different is that IPv6 has a strong convention about where the lines
fall. A global address has three parts:
- The global routing prefix is what the rest of the Internet routes on. Our ISP owns a
big block and delegated
2001:db8:1234::/56to our home router (usually with DHCPv6 prefix delegation, which we'll come to). - The subnet ID is the site's own business: which of its LANs this is. With a
/56, the home has 8 bits of subnet ID, so 256 possible/64LANs. Ours uses subnet01. A guest Wi-Fi network might be2001:db8:1234:2::/64. - The interface ID (IID) identifies the device on its LAN. It's always 64 bits.
Why every LAN is a /64
In IPv4, you sized a subnet to fit its hosts. In IPv6 you don't: every ordinary LAN is a
/64, whether it holds two devices or two thousand. The
addressing architecture
fixes interface IDs at 64 bits, and the self-configuration mechanism we'll meet,
SLAAC, only works when the host has exactly 64 bits to fill in. Use a /80 on a
LAN and SLAAC simply won't run.
That sounds wasteful, and by IPv4 standards it is outrageous: a two-device LAN holding
264 addresses. But the scarce resource in IPv6 is no longer addresses, it's
networks, and a fixed size buys a lot of simplicity: no subnet calculator, no
renumbering because a LAN outgrew its /26, and room for hosts to pick random interface
IDs without collisions. (Point-to-point links between routers are the main exception; they
often use a /127, the IPv6 cousin of IPv4's /31.)
How much a site gets
If every LAN is a /64, a site needs a block that's shorter than /64 to have more than
one. The bits between the site's prefix and bit 64 are its subnet ID, and counting LANs is
a single power of two:
| Delegated block | Subnet ID bits | /64 LANs |
Typical holder |
|---|---|---|---|
/48 |
16 | 65,536 | A business or campus |
/56 |
8 | 256 | A home (common) |
/60 |
4 | 16 | A home (stingier ISPs) |
/64 |
0 | 1 | One LAN only: no room to subnet |
Early guidance said every site should get a /48;
RFC 6177
(2011) relaxed that, and today many ISPs hand homes a /56, which is what ours did. The
same arithmetic works one level up: an ISP holding a /32 can hand out
248 − 32 = 65,536 /48s, or 256 − 32 = 16,777,216 /56s.
Which LANs live in 2001:db8:1234::/56?
2001:0db8:1234:0000::/64 subnet 00 2001:db8:1234::/64
2001:0db8:1234:0001::/64 subnet 01 2001:db8:1234:1::/64 ← our LAN
2001:0db8:1234:0002::/64 subnet 02 2001:db8:1234:2::/64 ← guest Wi-Fi?
…
2001:0db8:1234:00ff::/64 subnet ff 2001:db8:1234:ff::/64
The ISP's 56 bits end
halfway through the fourth group; the
subnet ID is the two
hex digits after them. The next home along might have 2001:db8:1234:100::/56,
covering 2001:db8:1234:100::/64 through 2001:db8:1234:1ff::/64.
Notice that /48, /56, /60 and /64 all fall on hex-digit boundaries (multiples of
4 bits). That's deliberate: on a
nibble boundary
you can read the prefix straight off the text, no binary needed. Prefixes like /50 are
legal, but they bring back exactly the in-a-byte arithmetic from the IPv4 article, so
network plans avoid them.
Kinds of Address
An IPv4 interface usually has one address. An IPv6 interface routinely has three or four at once, each with a different job. Here's what our laptop might show (lifetimes trimmed):
$ ip -6 addr show eth0
inet6 2001:db8:1234:1:9c4e:21f7:3b0a:6d15/64 scope global temporary dynamic
inet6 2001:db8:1234:1:0:ff:feaa:bb01/64 scope global dynamic mngtmpaddr
inet6 fe80::ff:feaa:bb01/64 scope link
A temporary global address, a stable global address, and a link-local address. The
scope says how far each one is meaningful: link means "only on this LAN", global
means "anywhere on the Internet". Here are the kinds you'll meet.
Global unicast: 2000::/3
Ordinary, globally routable addresses, the IPv6 equivalent of a public IPv4 address. Every
global address handed out today starts with the bits 001, which in hex means the first
digit is 2 or 3. That's one eighth of the whole space; the other seven eighths are held
in reserve. Our LAN's 2001:db8:1234:1::/64 and the server's 2001:db8:113::80 are
global unicast addresses, though they come from 2001:db8::/32, a block reserved for
documentation by
RFC 3849,
just as 203.0.113.0/24 is in IPv4.
Link-local: fe80::/10
Every IPv6 interface has a link-local address, always, even if there's no router and no
Internet. It starts with fe80, followed by 54 zero bits and a 64-bit interface ID, so in
practice it lives in fe80::/64. Routers never forward packets with a link-local source or
destination: they only mean something on the wire they came from.
That sounds like IPv4's 169.254.x.x, but there's a big difference in attitude. In IPv4,
a link-local address means "DHCP failed". In IPv6 it's essential plumbing: Neighbor
Discovery runs over link-local addresses, routers announce themselves from them, and the
laptop's default gateway is the router's link-local address, fe80::ff:fecc:dd02, not its
global one. The router's global address could change when the ISP renumbers; its link-local
address doesn't.
Unique local: fc00::/7
Unique local addresses (ULAs) are IPv6's answer to the RFC 1918 private ranges: addresses
for internal use that are never routed on the public Internet. The block is fc00::/7,
but only the half with the eighth bit set, fd00::/8, is in use. The next 40 bits are a
Global ID that each site is supposed to choose at random:
fd 5e:a7c9:1b2f 0001 0000:0000:0000:0010
8 bits 40 bits 16 bits 64 bits
ULA global ID subnet interface ID
(random) ID
→ fd5e:a7c9:1b2f:1::10
The randomness is the point, and the improvement over RFC 1918. When two companies that
both use 10.0.0.0/8 merge, their networks clash and someone has to renumber. Two sites
that each picked a random 40-bit global ID are overwhelmingly likely to have different
ones, so they can be joined without conflict. Don't pick something memorable like
fd00::/48; that defeats the purpose. (ULA has no reserved documentation range, so the
fd5e:a7c9:1b2f::/48 here is simply a made-up random value.)
Loopback and unspecified
::1is loopback, IPv4's127.0.0.1. IPv6 has exactly one loopback address, not a whole/8.::(all zeros) is the unspecified address: "I don't have an address yet". It only ever appears as a source, for example while a host checks that its new address is free (below), playing the same role as0.0.0.0in IPv4.
Multicast: ff00::/8, and no broadcast
IPv6 has no broadcast. None. Everything IPv4 did with broadcast, IPv6 does with
multicast: a packet addressed to a group, delivered to every interface that has joined
it. Multicast addresses start with ff, followed by a nibble of flags and a nibble of
scope, which says how far the packet may travel:
| Prefix | Scope | Example |
|---|---|---|
ff01:: |
Interface-local | Loopback-only multicast |
ff02:: |
Link-local | Neighbor Discovery, DHCPv6 |
ff05:: |
Site-local | ff05::1:3, all DHCP servers |
ff0e:: |
Global | Internet-wide groups |
(The flags nibble is 0 for permanent, well-known groups; a 1 there, as in ff12::…,
marks a group created on the fly.) The ones you'll see constantly are all link-scope:
ff02::1, all nodes on the link. The closest thing to a broadcast, used sparingly (routers send their periodic announcements here).ff02::2, all routers on the link.ff02::1:ffXX:XXXX, the solicited-node groups that replaced ARP's broadcast, which the ARP article introduced. Every address an interface holds joins the group named after its last 24 bits.ff02::16, where hosts report their group memberships (MLDv2), the IPv6 twin of the224.0.0.22IGMPv3 group that showed up in the ARP article's Windows cache.
On Ethernet, every IPv6 multicast maps to a MAC address that is 33:33 followed by the
last 32 bits of the group, the 33:33:… family from the Ethernet article:
ff02::1 goes to 33:33:00:00:00:01.
The laptop's solicited-node group, step by step
laptop link-local fe80::ff:feaa:bb01
last 24 bits aa bb 01
solicited-node group ff02::1:ffaa:bb01
= ff02:0000:0000:0000:0000:0001:ffaa:bb01
last 32 bits ff aa bb 01
Ethernet MAC 33:33:ff:aa:bb:01
Its global address 2001: ends in the same 24
bits, so it joins the same group: one group covers both. The router's group is
ff02::1:ffcc:dd02 on MAC 33:33:ff:cc:dd:02, exactly as the
ARP article worked out.
Zone IDs: which link?
Link-local addresses have a quirk. A laptop with both Wi-Fi and Ethernet has a fe80::/64
on each interface, so "send to fe80::ff:fecc:dd02" is ambiguous: out of which one? You
answer with a zone ID after a %:
$ ping fe80::ff:fecc:dd02%eth0 # Linux and macOS: interface name
C:\> ping fe80::ff:fecc:dd02%12 # Windows: interface number
The zone ID is local to your machine; it never appears in a packet. One practical wrinkle: web browsers don't accept zone IDs in URLs, and in 2025 RFC 9844 withdrew the earlier attempt to standardise a syntax for them. To open a device's web page by link-local address, you're out of luck; use its global or ULA address instead.
The Special Ranges
As with IPv4, the IETF keeps a registry of special-purpose blocks. The ones worth recognising, in numerical order:
| Block | What it's for |
|---|---|
::/128 |
Unspecified: "no address yet". Only ever a source |
::1/128 |
Loopback (IPv4's 127.0.0.1) |
::ffff:0:0/96 |
IPv4-mapped, e.g. ::ffff:192.0.2.1 |
64:ff9b::/96 |
NAT64 well-known prefix (below) |
2000::/3 |
Global unicast: everything handed out today |
2001::/32 |
Teredo tunnelling (legacy) |
2001:db8::/32 |
Documentation (RFC 3849) |
2002::/16 |
6to4 tunnelling (deprecated) |
3fff::/20 |
Documentation, added 2024 (RFC 9637) |
fc00::/7 |
Unique local; fd00::/8 in practice |
fe80::/10 |
Link-local; every interface has one |
ff00::/8 |
Multicast (ff02::/16 is link scope) |
(One historical ghost: fec0::/10 was meant to be "site-local", a private range, but the
idea of a "site" proved too fuzzy to define and it was deprecated in 2004. ULAs replaced it.)
Try the rules out. Every address in this section, and every spelling from the notation section, should behave the way you now expect.
Address
Any spelling works: with or without leading zeros, upper or lower case, with a /prefix length, a %zone ID, or an IPv4 dotted quad in the last 32 bits.
Compressing it
All 128 bits
What kind of address
Where the Interface ID Comes From
The bottom 64 bits identify a device on its LAN, and nobody hands them out: the host chooses them itself. The original recipe was to derive them from the MAC address, which was already unique. A MAC is only 48 bits, so it needs stretching to 64, using a format called modified EUI-64.
Worked example: the router
The router's MAC is 02:00:00:cc:dd:02. Three steps:
-
Split and insert
ff:feCut the six bytes into two halves of three and put the two fixed bytes
ff febetween them:02 00 00 ff fe cc dd 02. Eight bytes, 64 bits. -
Flip the U/L bit
Bit 1 of the first byte is the Universal/Local bit from the Ethernet article. Our MACs start with
02=0000 0010: U/L = 1, locally administered. Flipping it (XOR with02) gives0000 0000=00. The bytes are now00 00 00 ff fe cc dd 02. -
Write it as four groups and add a prefix
0000:00ff:fecc:dd02. Putfe80:0000:0000:0000in front and compress: the first five groups arefe80then four zeros, the zero run is squeezed to::, and00ffloses its leading zeros. Result:fe80::ff:fecc:dd02, the address the ARP article used. With the LAN prefix instead, the router's EUI-64 global address would be2001:.db8: 1234: 1: 0: ff: fecc: dd02
The laptop works the same way. 02:00:00:aa:bb:01 → insert → 02 00 00 ff fe aa bb 01 →
flip → 00 00 00 ff fe aa bb 01 → IID 0000:00ff:feaa:bb01. Its link-local address is
fe80::ff:feaa:bb01 and its EUI-64 global address 2001:db8:1234:1:0:ff:feaa:bb01, the
one we've been using all along. The printer and NAS get …:feaa:bb03 and …:feaa:bb04.
A real, factory-assigned MAC goes the other way. The Apple card from the Ethernet article,
00:03:93:12:34:56, starts with U/L = 0; flipping gives 02, so its IID is
0203:93ff:fe12:3456 and its link-local address fe80::203:93ff:fe12:3456.
Why flip the bit at all?
In the 64-bit form, the meaning of the bit is inverted: 1 means "universal, came from
real hardware", 0 means "local, someone made it up". That way, the IIDs people type by
hand, like the ::1 in a router's 2001:db8:1234:1::1, already
have the bit at 0 and correctly say "local". Without the flip, an honest hand-written IID
would have to be …:200:0:0:1. Our locally administered MACs get the same
treatment in reverse, which is why 02:… turned into 00:….
The privacy problem
EUI-64 has a serious flaw: the interface ID is the same on every network. Your laptop's
global address changes its first 64 bits as you move from home to office to café, but the
last 64 bits, …:0:ff:feaa:bb01, follow it everywhere, and every website you visit sees
them. That's a tracking cookie built into the network layer. Worse, a factory MAC embeds
the manufacturer's OUI, so …:203:93ff:fe… announces "Apple hardware" to the world.
Two fixes are now standard, and modern desktop and phone operating systems use them instead of EUI-64 for global addresses:
Stable, opaque IIDs (RFC 7217)
Hash the prefix, the interface, a network identifier and a secret key kept on the machine. The IID is stable on one network, so the same laptop gets the same address every time it comes home (handy for firewall rules and logs), but completely different on another network, and it reveals nothing about the hardware.
Temporary addresses (RFC 8981)
Pick a random IID, use it for outgoing connections for a while, then retire it and
make a new one. RFC 8981 (2021) suggests a new one each day, each staying valid for
two days, so a laptop typically holds a couple at once. This is the
9c4e:21f7:3b0a:6d15 address in the listing above, and it's what the
laptop uses as a source when it browses.
You'll still see EUI-64 on routers, printers, embedded devices, and anything configured by an administrator who wants predictable addresses, which is why our router and printer keep theirs. We'll keep the laptop on EUI-64 too, so every byte can be checked by hand. And note the overlap with the Ethernet article's MAC randomisation: if a phone already uses a random MAC per Wi-Fi network, even an EUI-64 address built from it changes per network.
Is an address with a random 64-bit IID safe from scanning? Much safer than IPv4, where a
/24 can be swept in seconds. At a million probes a second, trying every address in one
/64 would take over half a million years. Attackers find IPv6 hosts in other ways
instead: DNS names, logs, guessable patterns like ::1, and EUI-64 addresses with known
vendor prefixes. Random IIDs defeat the guessing; they can't hide an address that is published
in DNS or already sitting in someone's logs, though temporary addresses at least make old log
entries go stale.
SLAAC: A Host Configures Itself
Now for the phone that picks its own number. Stateless Address Autoconfiguration (SLAAC, RFC 4862) lets a host go from "cable plugged in" to "on the Internet" with no server keeping track of who has what. "Stateless" means exactly that: the router doesn't remember which addresses it gave out, because it didn't give any out. It just announces the prefix.
-
Make a link-local address
As soon as the interface comes up, the laptop builds
fe80::plus an interface ID. It's tentative: the laptop won't use it until it has checked nobody else has it. -
Duplicate Address Detection
The laptop joins the tentative address's solicited-node group, then sends a Neighbor Solicitation asking for that very address, from
::(it can't use the address it's testing) toff02::1:ffaa:bb01. If anyone answers, the address is taken. If a second passes in silence (the default), it's ours. This is exactly the ACD probe from the ARP article, where the sender IP was0.0.0.0for the same reason. The difference is that IPv4 bolted ACD on in 2008; in IPv6 it was there from the start. -
Ask for a router
Routers announce themselves every few minutes anyway, but nobody wants to wait, so the laptop sends a Router Solicitation (ICMPv6 type 133) to
ff02::2, all routers. -
The Router Advertisement
The router answers with a Router Advertisement (type 134), sent from its link-local address and usually to
ff02::1, so every host hears it. It carries the prefix2001:db8:1234:1::/64with the A (autonomous) flag set, meaning "build your own addresses from this", plus how long the prefix stays valid, a router lifetime (non-zero: "use me as your default gateway"), the link MTU, and often the address of a DNS server. The laptop installs its default route right away, pointing atfe80::ff:fecc:dd02, the router's link-local address, learned from the RA's source. -
Build global addresses, check them, use them
Prefix plus interface ID gives the global addresses. Each goes through DAD, then becomes preferred, ready to use as a source address.
Here is SLAAC as the host sees it:
function slaac(iface):
ll = fe80::/64 + make_iid(iface) # EUI-64, RFC 7217 or random
if not dad(iface, ll): give up on IPv6 for this interface
ra = wait_for(router_advertisement) # after sending RS to ff02::2
if ra.router_lifetime > 0:
add default route via ra.source # the router's link-local address
for prefix in ra.prefixes:
if prefix.length == 64 and prefix.A:
for iid in [stable_iid(prefix), random_iid()]: # stable + temporary
addr = prefix + iid
if dad(iface, addr): assign(iface, addr, prefix.lifetimes)
if ra.M: start DHCPv6 for addresses # see below
elif ra.O: ask DHCPv6 for other settings only
#
function dad(iface, addr): # Duplicate Address Detection
join(iface, solicited_node(addr))
send NS(target = addr) from :: to solicited_node(addr)
return no NA for addr within 1 second
Where DHCPv6 fits
SLAAC hands out addresses (and, with the RDNSS option, a DNS server), but nothing else, and it keeps no record of who's using what. Networks that want more control use DHCPv6, and the Router Advertisement tells hosts which approach to take with two flags:
| RA flags | Hosts get addresses from | And other settings from |
|---|---|---|
| M=0, O=0 | SLAAC | The RA itself (or nowhere) |
| M=0, O=1 | SLAAC | Stateless DHCPv6 |
| M=1 | Stateful DHCPv6 (and SLAAC if A=1) | DHCPv6 |
M ("managed") says a DHCPv6 server hands out addresses and keeps track of them, as
DHCPv4 does. O ("other") says addresses come from SLAAC, but ask DHCPv6 for settings
like DNS servers. Our home router sends M=0, O=0 and puts its DNS server in the RA (an
RDNSS option naming the router itself, 2001:), the
simplest setup.
Two practical wrinkles. First, unlike DHCPv4, DHCPv6 doesn't tell hosts their default gateway: that always comes from Router Advertisements, so even a fully "managed" network needs RAs. Second, support is uneven: Android, notably, has never implemented stateful DHCPv6 addresses, so a network that relies on M=1 alone leaves Android phones without an IPv6 address.
DHCPv6 has one job that's essential even on SLAAC networks: prefix delegation. That's
how our home router got 2001:db8:1234::/56 in the first place. It asked the ISP's DHCPv6
server, "may I have a prefix?", got a /56, and carved its LAN's /64 out of it. The
DHCP article covers both versions in detail.
Now build some addresses yourself. Every value from the last two sections should appear.
Interface and network
Build the interface ID
Same device, another network
Watch SLAAC run
When ticked, another host on the LAN already uses the address being tested, so it answers the DAD probe with a Neighbor Advertisement. What happens next depends on how the interface ID was made.
Neighbor Discovery, Revisited
Router Solicitations, Router Advertisements and DAD are all part of Neighbor Discovery, the protocol the ARP article introduced as ARP's replacement. The full cast is five ICMPv6 messages:
| Type | Message | Job |
|---|---|---|
| 133 | Router Solicitation | "Any routers here?" |
| 134 | Router Advertisement | "I'm a router; here's the prefix" |
| 135 | Neighbor Solicitation | "Who has this address?" (and DAD) |
| 136 | Neighbor Advertisement | "That's me; here's my MAC" |
| 137 | Redirect | "Use a better first hop" |
The ARP article covered 135 and 136, and the neighbour cache states (REACHABLE,
STALE, DELAY, PROBE) that ARP borrowed from here. A few things are new.
Solicited-node multicast is cheap for everyone. We worked out the laptop's group above.
When the router wants the laptop's MAC, its Neighbor Solicitation goes to
33:33:ff:aa:bb:01. The printer and NAS listen on …ff:aa:bb:03 and …ff:aa:bb:04, so
their network cards discard the frame in hardware. Switches can do better still: hosts
announce which groups they've joined using
MLD,
and a switch with MLD snooping forwards each solicitation only to the ports that asked for
it. With ARP, every broadcast reached every port.
Routers advertise; hosts don't need to be told. In IPv4 the default gateway is a setting someone (or DHCP) types in. In IPv6 a router announces itself, and hosts build their routing table from what they hear. Two routers on one LAN, or a router being replaced, just work. The same mechanism is a weakness, as we'll see.
Redirects. If a host sends a packet to its default router and the router knows a better
first hop on the same link, it forwards the packet and sends back a Redirect (type 137):
"next time, send that straight to fe80::…". IPv4 has ICMP Redirects too (the IPv4
article's misconfigured /28 laptop may well have received one). IPv6 additionally uses Redirect to say "that
destination is on your link; talk to it directly".
A built-in sanity check. Every Neighbor Discovery message must be sent with a hop limit of 255, and receivers discard any that arrive with less. A router decrements the hop limit when it forwards a packet, so 255 on arrival proves the message was sent by something on the same link, not injected from across the Internet.
Rogue routers, and why ICMPv6 isn't optional
Anyone on the LAN can send a Router Advertisement. A misconfigured device (classically, a laptop sharing its connection) or an attacker can announce itself as a router with a different prefix, and hosts will happily use it, sending traffic through it just as ARP spoofing did. The defences mirror the ARP article's: RA Guard on switches drops RAs from ports that shouldn't have routers, ND inspection checks solicitations and advertisements, and encryption protects the content either way.
The opposite mistake is just as common. Firewall administrators used to IPv4 sometimes block all ICMP, reasoning that ping is a reconnaissance tool. In IPv6 that breaks everything: Neighbor Discovery is ICMPv6, so blocking it on a LAN stops hosts finding the router or each other. On the Internet side, blocking the ICMPv6 Packet Too Big message (type 2) silently breaks large transfers, for reasons we'll see in the header section. Filter ICMPv6 carefully, by type, following guidance like RFC 4890; never block it wholesale.
The IPv6 Header
In the Layers article we read a 20-byte IPv4 header byte by byte. The IPv6 header is twice as long, 40 bytes, yet it's simpler: fewer fields, and every one at a fixed position.
Here's the header our laptop would send from 2001:db8:1234:1:0:ff:feaa:bb01 to
2001:db8:113::80, carrying the same 57-byte
TCP segment as the Layers article (a 20-byte TCP header plus GET / HTTP/1.1…):
| Bytes | Field | Our value | Meaning |
|---|---|---|---|
| 0 (4 bits) | Version | 6 |
IPv6 |
| 0–1 (8 bits) | Traffic class | 00 |
DSCP + ECN, as in IPv4; 0 = ordinary |
| 1–3 (20 bits) | Flow label | 7a3c1 |
Same value on every packet of this connection |
| 4–5 | Payload length | 00 39 = 57 |
Bytes after this header |
| 6 | Next header | 06 = TCP |
What follows; same numbers as IPv4's Protocol |
| 7 | Hop limit | 40 = 64 |
IPv4's TTL, honestly named |
| 8–23 | Source | The laptop | 128 bits, written out below |
| 24–39 | Destination | The server | 128 bits, written out below |
(The 80 at the end of the server's address is a nod to its IPv4 address, 203.0.113.80.
In hex it's 128, not 80. A real laptop would also send from its temporary address; we're
using the EUI-64 one so you can check every byte.)
What changed, and why:
- No header length field. The header is always 40 bytes, so a router never has to work out where the addresses are or skip variable options. IPv4's IHL is gone.
- Payload length, not total length. It counts only what comes after the 40-byte header: 57 here, where IPv4's Total Length said 77.
- No header checksum. Ethernet's CRC already protects every frame on the wire, and TCP and UDP checksum their own data (with a pseudo-header that includes the addresses, so a misdelivered packet is still caught). IPv4 made every router recompute a checksum at every hop, just because the TTL changed; IPv6 dropped it. In exchange, the UDP checksum, optional in IPv4, is mandatory in IPv6.
- The flow label is new: a 20-bit tag the sender keeps the same for all packets of one connection. Routers that spread traffic over several parallel links can hash it (with the addresses) to keep a connection's packets on one path, in order, without digging into the TCP header. Many operating systems fill it in automatically.
- Next header replaces Protocol, with a twist: it can point at an extension header instead of TCP or UDP.
No fragmentation by routers
In IPv4, a router that receives a packet too big for the next link can chop it into fragments (unless Don't Fragment is set, as it was in the Layers article's packet). In IPv6, routers never fragment. A router with a too-big packet drops it and sends the source an ICMPv6 Packet Too Big message saying what MTU would fit. The sender then sends smaller packets. This is Path MTU Discovery, and it's mandatory in IPv6. That's why blocking Packet Too Big is so harmful: the sender never learns, and every large packet vanishes. The connection opens fine (small packets), then hangs the moment real data flows, a classic "black hole" that's miserable to debug.
To make this workable, IPv6 guarantees a floor: every link must carry packets of at least 1,280 bytes, compared with IPv4's 68. A sender that doesn't want to bother with discovery can just stay at 1,280. If a host really must send something bigger than the path allows, it fragments the packet, using a Fragment extension header, and only the final destination reassembles it.
Extension headers
The Fragment header is one of a handful of extension headers that sit between the IPv6 header and the payload, chained together by Next header fields:
IPv6 header Fragment header TCP header
next header = 44 → next header = 6 → (data…)
The common ones are Hop-by-Hop Options (0, the only one routers along the way are expected to read), Routing (43), Fragment (44), Destination Options (60), and IPsec's ESP (50) and AH (51). Ordinary traffic carries none at all, and that's just as well: in practice, many networks drop packets with extension headers, because some routers can only handle them slowly. Whatever IPv4 did with options, IPv6 moves out of the fixed header, so the common case stays fast.
The whole frame, byte by byte
Here's the complete 115-byte Ethernet frame. Compare it with the 95-byte IPv4 frame in the Layers article: the TCP segment and HTTP request are byte-for-byte identical except for the TCP checksum, and the IP header is 20 bytes longer.
Hex dump: 115 bytes
0000 02 00 00 cc dd 02 02 00 00 aa bb 01 86 dd 60 07 ..............`.
0010 a3 c1 00 39 06 40 20 01 0d b8 12 34 00 01 00 00 ...9.@ ....4....
0020 00 ff fe aa bb 01 20 01 0d b8 01 13 00 00 00 00 ...... .........
0030 00 00 00 00 00 80 c7 38 00 50 1a 2b 3c 4d 5e 6f .......8.P.+<M^o
0040 70 81 50 18 fa f0 55 3a 00 00 47 45 54 20 2f 20 p.P...U:..GET /
0050 48 54 54 50 2f 31 2e 31 0d 0a 48 6f 73 74 3a 20 HTTP/1.1..Host:
0060 65 78 61 6d 70 6c 65 2e 63 6f 6d 0d 0a 0d 0a 72 example.com....r
0070 20 2f 47 /G
Ethernet bytes 0–13 and 111–114 · IPv6 bytes 14–53 · TCP bytes 54–73 · HTTP bytes 74–110
-
Offset 0x00: Ethernet
Destination
02:00:00:cc:dd:02(the router: the laptop learned it with a Neighbor Solicitation, not ARP), source02:00:00:aa:bb:01, then EtherType86 dd: "an IPv6 packet starts at offset 14". -
Offset 0x0e: IPv6
60 07 a3 c1is the first 32 bits: version6, traffic class00, flow label7a3c1. Payload length00 39= 57, next header06(TCP), hop limit40= 64. Then 16 bytes of source,20 01 0d b8 12 34 00 01 00 00 00 ff fe aa bb 01, and 16 of destination,20 01 0d b8 01 13followed by nine zero bytes and80. The header always ends 40 bytes in, at offset 54. -
Offset 0x36: TCP
Identical to the IPv4 version except bytes 70–71, the checksum:
55 3ainstead of81 1c. TCP's checksum covers a pseudo-header containing the source and destination addresses, and those are now 128 bits each. -
Offset 0x4a: HTTP, then the FCS
The same 37 bytes of
GET / HTTP/1.1…. The last four bytes are the CRC-32,0x472F2072, sent least-significant byte first as72 20 2f 47.
Twenty bytes of extra overhead per packet is the price of 128-bit addresses: on a full-size 1,500-byte packet it's about 1.3%.
Living Alongside IPv4
IPv6 and IPv4 can't talk to each other directly: an IPv4-only host has no way to address an IPv6-only one. Nobody could switch the whole Internet over on one day, so for decades the two have to coexist. There are three broad strategies.
Dual stack
The simplest and most common: run both. Our laptop has 192.168.1.10 and its IPv6
addresses; the router routes both; the web server listens on 203.0.113.80 and
2001:db8:113::80. When the browser looks up the server's name, DNS returns an
A record (IPv4) and an AAAA record (IPv6), and the browser has to choose.
Preferring IPv6 blindly would be a disaster wherever IPv6 is broken (a firewall dropping it, a tunnel that's down): every connection would hang until it timed out. So browsers and operating systems use Happy Eyeballs:
-
Ask for both
Send the AAAA and A queries at the same time. If the A answer comes back first, wait briefly (50 ms is suggested) for the AAAA.
-
Try IPv6 first
Start connecting to
2001:db8:113::80. -
Don't wait long
If it hasn't connected within about 250 ms, start connecting to
203.0.113.80as well, in parallel. -
Keep the winner
Whichever connection completes first is used; the other is abandoned.
The result: IPv6 is used whenever it works, and when it doesn't, the user loses a quarter of a second instead of a minute. Happy Eyeballs is a big reason dual-stack deployment was safe to roll out at all.
IPv6-only, with translation
Dual stack still needs an IPv4 address for every device, which is exactly what's scarce. So many mobile networks give phones IPv6 only, and translate at the edge when they need to reach an IPv4-only server. Suppose our server had no AAAA record:
-
DNS64 makes up an address
The phone asks for the server's AAAA record. There isn't one, so the network's DNS64 resolver takes the A record,
203.0.113.80=cb 00 71 50, and synthesises an IPv6 address by putting it after the well-known prefix64:ff9b::/96:64:ff9b::cb00:7150, which can also be written64:ff9b::. (Illustration only: a real DNS64 won't synthesise an address from a documentation or other non-global IPv4 address like this one; RFC 6052 forbids it with the well-known prefix.)203.0.113.80 -
NAT64 translates
The phone sends ordinary IPv6 packets to that address. They're routed to a NAT64 gateway, which rewrites them as IPv4 packets from one of its own public IPv4 addresses to
203.0.113.80, and translates the replies back.
That handles anything that uses DNS names. For apps that use IPv4 literals or IPv4-only sockets, 464XLAT adds a small translator (the CLAT) on the phone itself, which turns the app's IPv4 into IPv6 before it leaves the device; the network's NAT64 turns it back. Several large mobile operators run their networks this way, and their customers rarely notice.
Tunnels
The third approach carries one protocol inside the other. 6in4 wraps IPv6 packets in IPv4
(IP protocol number 41) to cross an IPv4-only network; automatic schemes like 6to4
(2002::/16) and Teredo (2001::/32) tried to do it with no configuration and are now
deprecated or retired, having caused more breakage than they solved. Today the direction has
reversed: ISPs with IPv6-only core networks tunnel their customers' IPv4 across them, with
schemes like DS-Lite and MAP.
How far along are we?
Slower than anyone in 1995 imagined, and further than many expected a decade ago. Google has measured the share of its users who reach it over IPv6 since 2008, and on 28 March 2026 that figure passed 50% for the first time. Other measurements, weighted differently, put it lower: APNIC Labs reported around 42% at the same time. Weekends tend to read higher than weekdays, because home and mobile networks have adopted IPv6 faster than offices.
The picture varies enormously by country. In spring 2026, measurements put France and India above 70%, the United States a little above 50%, and countries such as Italy and Spain below 20%. Numbers move every month, so treat these as a snapshot and check Google's statistics page for the current figures.
What about NAT?
With a /64 per LAN and a /56 per home, there's no shortage to paper over, so IPv6
doesn't need NAT. Every device gets a global address, and connections work end to end,
which is a large part of the point. But "globally addressable" isn't the same as "reachable".
A home router still runs a stateful firewall that, by default, lets replies to outgoing
connections in and blocks unsolicited incoming ones. NAT used to provide that as a side
effect; in IPv6 it's an explicit rule, and a deliberate choice. The NAT article
looks at what NAT does, what it breaks, and why the firewall was always the part that
mattered for security.
Where to Go Next
- VLANs: one switch, many LANs, each with its own
/64, its own broadcast domain and its own Router Advertisements. - DNS: AAAA records, how names map to both kinds of address, and the DNS64 trick in detail.
- DHCP: DHCPv4 and DHCPv6 side by side, including the prefix delegation that gave our router its
/56. - NAT: why IPv4 needed it, why IPv6 doesn't, and the firewall that remains.
- Routing Basics: routing tables and longest-prefix match, which work identically for 128-bit prefixes.
- ARP and IPv4 Addressing: the IPv4 halves of Neighbor Discovery and prefixes, if you skipped them.
Key Takeaways
- An IPv6 address is 128 bits, written as eight 16-bit hex groups. There are about 3.4 × 1038; one
/64LAN holds 232 times the whole IPv4 Internet. - Shorten by dropping leading zeros and replacing one run of zero groups with
::. RFC 5952's canonical form: compress the longest run (the first, on a tie), never a single group, lowercase.2001:→0db8: 0000: 0000: 0000: ff00: 0042: 8329 2001:db8::ff00:42:8329. - Use brackets for addresses with ports:
[2001:db8:113::80]:8080. Link-local addresses need a zone ID locally:fe80::ff:fecc:dd02%eth0. - A global address is routing prefix + subnet ID + 64-bit interface ID. Every LAN is a
/64; a site gets a/48(65,536 LANs) or/56(256 LANs). - Address types: global
2000::/3, link-localfe80::/10(on every interface), unique localfd00::/8, loopback::1, unspecified::, multicastff00::/8. There is no broadcast;ff02::1is all nodes andff02::1:ffXX:XXXXthe solicited-node groups. - Modified EUI-64 builds an interface ID from a MAC: insert
ff:fein the middle and flip the U/L bit.02:00:00:cc:dd:02→0000:00ff:fecc:dd02→fe80::ff:fecc:dd02. Modern hosts prefer stable opaque (RFC 7217) and temporary (RFC 8981) IIDs for privacy. - SLAAC: build a link-local address, check it with DAD (an NS from
::), send a Router Solicitation (133), receive a Router Advertisement (134) with the prefix, build and check global addresses. The M and O flags point hosts at DHCPv6; prefix delegation is how the router got its/56. - Neighbor Discovery (ICMPv6 133–137) replaces ARP and router configuration. Never block ICMPv6 wholesale: ND and Packet Too Big depend on it.
- The IPv6 header is a fixed 40 bytes with no checksum and no router fragmentation; Path MTU Discovery is mandatory and every link carries at least 1,280 bytes. EtherType is
86dd. - Dual stack with Happy Eyeballs, NAT64/DNS64 with 464XLAT, and tunnels let IPv6 and IPv4 coexist. Google's IPv6 share first passed 50% in March 2026. IPv6 needs no NAT, but still needs a firewall.
Every device on our LAN now has addresses to spare. But they all still share one LAN: one broadcast domain for IPv4, one set of Router Advertisements for IPv6, and nothing stopping a guest's phone from seeing the NAS. Next up: VLANs, which carve one physical network into several separate ones.