IPv4 has about 4.3 billion addresses; there are more connected devices than that. IPv6 fixes the shortage for good with 128-bit addresses, about 3.4 × 10^38 of them, and cleans up several IPv4 design decisions along the way. More than 45% of Google’s users reach it over IPv6, mobile networks run largely on it, and every major cloud supports it. If you run anything on the internet, you will meet it.
IPv4 vs IPv6
| Topic | IPv4 | IPv6 |
|---|---|---|
| Address size | 32 bits | 128 bits |
| Notation | Dotted decimal 192.0.2.10 | Hex groups 2001:db8::10 |
| Header | 20 to 60 bytes, variable | Fixed 40 bytes plus optional extension headers |
| Header checksum | Yes, recomputed every hop | None (layer 2 and 4 already check) |
| Fragmentation | Routers or hosts | Source host only |
| Address configuration | Manual or DHCP | SLAAC, DHCPv6 or manual |
| Address resolution | ARP (broadcast) | Neighbor Discovery (multicast ICMPv6) |
| Broadcast | Yes | No, multicast instead |
| NAT | Common, out of necessity | Not needed; every device can have a global address |
Writing IPv6 addresses
An address is eight groups of four hex digits:
2001:0db8:0000:0000:0000:ff00:0042:8329
Two rules shorten it:
- Drop leading zeros in each group:
0db8becomesdb8,0042becomes42. - Replace one run of consecutive all-zero groups with
::.
2001:db8::ff00:42:8329
:: may appear only once, otherwise you could not tell how many zeros each one hides. In URLs, put the address in brackets: http://[2001:db8::10]:8080/.
Address types
| Prefix | Type | Purpose |
|---|---|---|
2000::/3 | Global unicast | Public, routable addresses (like public IPv4) |
fe80::/10 | Link-local | Every interface has one; valid only on that link |
fc00::/7 (in practice fd00::/8) | Unique local (ULA) | Private addressing, like RFC 1918 |
ff00::/8 | Multicast | One to many; replaces broadcast |
::1/128 | Loopback | The host itself |
::/128 | Unspecified | “No address yet” |
2001:db8::/32 | Documentation | Examples, like this course |
64:ff9b::/96 | NAT64 | IPv4 addresses embedded for IPv6-only networks |
An interface normally has several IPv6 addresses at once: a link-local, one or more global, and often temporary privacy addresses.
$ ip -6 addr show enp3s0
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP
inet6 2001:db8:4a:10:8f2e:61c4:b7a2:93d1/64 scope global temporary dynamic
valid_lft 86188sec preferred_lft 14188sec
inet6 2001:db8:4a:10:3e2c:4aff:fe1b:9c10/64 scope global dynamic mngtmpaddr
valid_lft 86188sec preferred_lft 14188sec
inet6 fe80::3e2c:4aff:fe1b:9c10/64 scope link
valid_lft forever preferred_lft forever
The temporary address changes regularly and is used for outgoing connections, so websites cannot track the device by its address.
The /64 rule and site planning
In IPv6 the split is nearly always the same: the first 64 bits are the network (prefix + subnet) and the last 64 bits are the interface ID. LANs are /64, full stop: SLAAC depends on it.
A typical allocation chain:
| Who | Gets | Number of /64 subnets |
|---|---|---|
| Regional registry to ISP | /32 | 4,294,967,296 |
| ISP to business site | /48 | 65,536 |
| ISP to home | /56 (sometimes /60 or /48) | 256 |
| One LAN or VLAN | /64 | 1 |
With a /48 like 2001:db8:4a::/48, the fourth group is your subnet number: 2001:db8:4a:10::/64 for VLAN 10, 2001:db8:4a:20::/64 for VLAN 20. A nice habit is to match the subnet number to the VLAN ID so the plan reads itself.
The IPv6 header
A fixed 40-byte header with just eight fields:
| Field | Purpose |
|---|---|
| Version | 6 |
| Traffic class | QoS (same role as DSCP/ECN) |
| Flow label | Marks packets of one flow for load balancers |
| Payload length | Size after the header |
| Next header | What follows: 6 TCP, 17 UDP, 58 ICMPv6, or an extension header |
| Hop limit | Same role as IPv4 TTL |
| Source and destination | 128 bits each |
Options moved into optional extension headers, chained by the Next header field, so routers can process the common case quickly.
How hosts get addresses
- SLAAC (stateless address autoconfiguration): the router sends Router Advertisements (RAs) with the /64 prefix. The host builds its own address from the prefix plus an interface ID (random or derived from the MAC), and uses the router’s link-local address as its default gateway.
- DHCPv6: a server hands out addresses (stateful) or just extra settings such as DNS servers (stateless). Note: the default gateway always comes from RAs, never from DHCPv6.
- DHCPv6 prefix delegation: your home router asks the ISP for a /56 and carves /64s out of it for each LAN.
- Manual: for servers and routers.
Neighbor Discovery (NDP)
ICMPv6 does the jobs that ARP and ICMP router discovery did in IPv4:
| Message | Purpose |
|---|---|
| Router Solicitation / Advertisement | Find routers and the prefix |
| Neighbor Solicitation / Advertisement | Find a neighbor’s MAC address; detect duplicate addresses |
| Redirect | Point a host to a better first hop |
$ ip -6 neigh
fe80::1 dev enp3s0 lladdr 00:1a:2b:3c:4d:5e router REACHABLE
2001:db8:4a:10::25 dev enp3s0 lladdr 52:54:00:7a:11:02 STALE
$ ip -6 route show default
default via fe80::1 dev enp3s0 proto ra metric 100 expires 1781sec pref medium
Never block all ICMPv6. IPv6 cannot even resolve neighbors or find routers without it, and path MTU discovery depends on “packet too big” messages. Allow at least the NDP types and “packet too big” in every firewall.
Testing IPv6
$ ping -6 -c 2 one.one.one.one
64 bytes from one.one.one.one (2606:4700:4700::1111): icmp_seq=1 ttl=57 time=12.4 ms
$ curl -6 -s https://ifconfig.me ; echo
2001:db8:4a:10:8f2e:61c4:b7a2:93d1
$ dig +short AAAA example.com
AAAA records map names to IPv6 addresses, the same way A records do for IPv4.
Dual stack and transition
Most networks run dual stack: every host has both IPv4 and IPv6, and applications prefer IPv6 when a name has an AAAA record. Browsers use Happy Eyeballs: they try both and use whichever connects first, so a broken IPv6 path costs only a few hundred milliseconds.
Other transition tools:
- NAT64 + DNS64: an IPv6-only network reaches IPv4-only sites through a translator. Many mobile networks work this way.
- 464XLAT: adds a small translator on the device so IPv4-only apps still work on an IPv6-only network.
- Tunnels (6in4, and historically 6to4 and Teredo): carry IPv6 inside IPv4 where the path has no IPv6.
Exercise
What is the correct short form of 2001:0db8:0000:0000:0001:0000:0000:0001?
Show answer
Answer: B. :: can replace only one run of zero groups. Replacing the first run gives 2001:db8::1:0:0:1 (replacing the second, 2001:db8:0:0:1::1, is also valid but not offered). Two :: would be ambiguous.
Exercise
A host has only an fe80:: address on its LAN interface. What does that tell you?
Show answer
Answer: D. Every IPv6 interface gets a link-local address automatically. A global address needs a prefix from a router (SLAAC) or DHCPv6, so check that the router sends RAs.
Exercise
Your ISP gives your site a /56. How many /64 networks can you create?
Show answer
Answer: C. From /56 to /64 is 8 bits, and 2^8 = 256. A /48 would give 65,536.
Key takeaways
- IPv6 addresses are 128 bits; drop leading zeros and use
::once. - Global (
2000::/3), link-local (fe80::/10), unique local (fd00::/8) and multicast replace IPv4’s classes and broadcast. - LANs are /64; sites get /48 or /56.
- SLAAC builds addresses from Router Advertisements; the gateway always comes from RAs.
- NDP uses ICMPv6, so firewalls must allow it.
FAQ
Do I need NAT with IPv6?
No. There are enough addresses for every device to have a global one. Security comes from a stateful firewall that blocks unsolicited inbound connections, which is what NAT was doing by accident in IPv4.
Why is my IPv6 address changing every day?
That is a temporary privacy address (RFC 8981), rotated so sites cannot track your device over time. The stable address is still there for incoming connections.
Should I disable IPv6 if I do not use it?
Generally no. Modern systems expect it, some features break without it, and many of your users already reach you over IPv6. Learn it and firewall it properly instead.
Is IPv6 faster than IPv4?
Not by itself. It can be slightly faster when it avoids carrier-grade NAT boxes on the IPv4 path, which is common on mobile networks.