Why IPv6
IPv4's 4.3 billion addresses ran out years ago: the regional registries, including APNIC for Asia-Pacific, handed out their last normal blocks in the early 2010s. IPv6 fixes this permanently with 128-bit addresses: about 3.4 × 1038. That is enough to give every device on Earth billions of addresses.
| # | IPv4 (chapter 2) | IPv6 | |
|---|---|---|---|
| 1 | Size | 32 bits | 128 bits |
| 2 | Addresses | ~4.3 × 109 | ~3.4 × 1038 |
| 3 | Written as | 4 decimal numbers with dots | 8 hex groups with colons |
| 4 | Sharing addresses | NAT everywhere (chapter 10) | Not needed: every device gets public addresses |
| 5 | Getting an address | DHCP (chapter 27) | Usually self-configured (SLAAC, section 7) |
| 6 | Finding MACs | ARP broadcast (chapter 9) | NDP with multicast (section 8) |
| 7 | Broadcast | Yes | None: multicast replaces it |
| 8 | Header | 20-60 bytes, with a checksum | Fixed 40 bytes, no checksum (section 9) |
Writing an address
An IPv6 address is 128 bits, written as eight groups of four hex digits (chapter 7's hex), separated by colons. Each group is 16 bits: 8 × 16 = 128.
Shortening addresses
Two rules make addresses much shorter:
| Rule | Result | |
|---|---|---|
| 0 | Full form | 2001:0db8:0000:0000:0000:ff00:0042:8329 |
| 1 | Drop leading zeros in each group | 2001:db8:0:0:0:ff00:42:8329 |
| 2 | Replace one run of all-zero groups with :: | 2001:db8::ff00:42:8329 |
:: may appear only once: with two, you could not tell how many zero groups each one stands for. The standard short form uses the longest zero run, lowercase letters, and never uses :: for a single zero group.Try any address. The tool expands, shortens, and tells you what kind of address it is:
- Full form
- 2001:0db8:0000:0000:0000:ff00:0042:8329
- Short form
- 2001:db8::ff00:42:8329
- Type
- Documentation (2001:db8::/32) · reserved for examples; a global-unicast-style address
- 20010010 0000 0000 0001
- 0db80000 1101 1011 1000
- 00000000 0000 0000 0000
- 00000000 0000 0000 0000
- 00000000 0000 0000 0000
- ff001111 1111 0000 0000
- 00420000 0000 0100 0010
- 83291000 0011 0010 1001
Teal: the first 64 bits (network prefix of a /64). Highlighted: the last 64 bits (interface ID). Each group is 16 bits.
Prefixes: how addresses are handed out
IPv6 uses CIDR just like IPv4 (chapter 3), but the numbers are huge. An ISP gives each customer a whole block, and the customer cuts it into /64 networks:
| # | Prefix | Who | Contains |
|---|---|---|---|
| 1 | 2001:db8:5c00::/48 | Kadé office, from LankaNet | 65,536 networks of /64 |
| 2 | 2001:db8:5c00:1::/64 | Staff network (like 172.16.1.0/24) | 264 ≈ 18 billion billion addresses |
| 3 | 2001:db8:5c00:2::/64 | Warehouse network (like 172.16.2.0/24) | same |
| 4 | 2001:db8:4a1:1100::/56 | Your home, from your ISP | 256 networks of /64 |
Address types
| # | Type | Starts with | Meaning | IPv4 equivalent |
|---|---|---|---|---|
| 1 | Global unicast | 2000::/3 (2… or 3…) | Public, routable on the internet | public addresses |
| 2 | Link-local | fe80::/10 | Valid only on the local link, never routed. Every IPv6 interface creates one automatically. | 169.254.x.x, but always present |
| 3 | Unique local (ULA) | fc00::/7 (in practice fd…) | Private addresses for internal use | 10.x, 172.16.x, 192.168.x |
| 4 | Multicast | ff00::/8 | One sender to a group. ff02::1 = all devices on the link; ff02::2 = all routers. | replaces broadcast |
| 5 | Loopback | ::1 | This machine | 127.0.0.1 |
| 6 | Unspecified | :: | "No address yet" / "all interfaces" when listening | 0.0.0.0 |
| 7 | IPv4-mapped | ::ffff:0:0/96 | An IPv4 address inside an IPv6 socket, e.g. ::ffff:192.168.1.23 | - |
One interface, several addresses
In IPv4 your WiFi interface had one address. In IPv6 it normally has several at once, each with a job:
$ ifconfig en0 | grep inet6 inet6 fe80::a683:e7ff:fe2b:910c%en0 prefixlen 64 scopeid 0x6 ← link-local inet6 2001:db8:5c00:1:8a2f:31c4:77be:d201 prefixlen 64 autoconf secured ← stable global inet6 2001:db8:5c00:1:e91a:4c03:1f55:9a3b prefixlen 64 autoconf temporary ← temporary global
- Link-local for talking to the router and neighbours, including the gateway itself (routers are usually reached by their link-local address).
- Stable global for incoming connections, the same whenever you join this network.
- Temporary global, changed every day or so, used for outgoing connections so websites cannot track the device by its address ("privacy addresses").
Self-configuration: SLAAC
IPv6 devices usually configure themselves, with no DHCP server. This is SLAAC (stateless address autoconfiguration). The front desk PC joining the staff network:
The interface ID (the last 64 bits) can be made two ways:
| From the MAC (EUI-64) | Take the 48-bit MAC, insert ff:fe in the middle, and flip the "locally set" bit from chapter 7. The laptop's a4:83:e7:2b:91:0c becomes a683:e7ff:fe2b:910c. Easy, but the same on every network, so it can be used to track the device. Older systems and many routers still use it. |
| Random (privacy / stable) | What laptops and phones use for global addresses today: random-looking, stable per network or changing daily. |
| # | Step | Result |
|---|---|---|
| 1 | Split the MAC in half | a4:83:e7 | 2b:91:0c |
| 2 | Insert ff:fe in the middle (48 → 64 bits) | a4:83:e7:ff:fe:2b:91:0c |
| 3 | Flip bit 7 of the first byte (the U/L bit, chapter 7) | 10100100 → 10100110 · a4 → a6 |
| 4 | Interface ID (4 groups) | a683:e7ff:fe2b:910c |
| 5 | Link-local address | fe80::a683:e7ff:fe2b:910c |
| 6 | Global address on the staff /64 (if EUI-64 were used) | 2001:db8:5c00:1:a683:e7ff:fe2b:910c |
Anyone who sees the global address can read your MAC back out of it, on every network you join. That is why laptops and phones use random interface IDs for global addresses.
NDP: ARP's replacement
IPv6 finds MAC addresses with NDP (Neighbor Discovery Protocol), which runs over ICMPv6. Instead of broadcasting to everyone like ARP, it sends a Neighbor Solicitation to a special multicast group derived from the target's address (the "solicited-node" group, ff02::1:ff + the last 24 bits). Only devices whose address ends the same way listen, which in practice is almost always just the target.
| # | IPv4 (chapters 9, 27) | IPv6 with NDP (ICMPv6) |
|---|---|---|
| 1 | ARP request, broadcast "who has 172.16.1.20?" | Neighbor Solicitation, to the target's solicited-node multicast group |
| 2 | ARP reply | Neighbor Advertisement |
| 3 | Gateway from DHCP | Router Advertisement: routers announce themselves and the prefix |
| 4 | ARP check for a duplicate address | Duplicate Address Detection (DAD) |
| 5 | ICMP redirect | ICMPv6 Redirect |
A simpler header
The IPv6 header is a fixed 40 bytes, and has fewer fields than IPv4's (chapter 12):
Compare chapter 12’s IPv4 header: no IHL (always 40 bytes), no ID/flags/offset (no router fragmentation), no checksum, and no options in the main header. The addresses take 32 of the 40 bytes.
| No header checksum | Links (FCS) and TCP/UDP already check for errors, so routers no longer recompute a checksum every hop. This is why the UDP checksum becomes mandatory (chapter 15). |
| No fragmentation by routers | Only the sender may fragment; routers send ICMPv6 "Packet Too Big" instead (chapter 18). Every IPv6 link must carry at least 1,280 bytes. |
| Extension headers | Options, fragmentation info and more move into optional headers chained by the Next Header field, which otherwise says TCP (6), UDP (17) or ICMPv6 (58). |
| Hop Limit | IPv4's TTL, renamed to say what it really counts (chapter 12) |
| Flow Label | Marks packets of one flow so routers can keep them on the same path (ECMP, chapter 12) |
No NAT: end-to-end again
With addresses to spare, every device gets its own public address and no NAT is needed. The front desk PC and the packing PC reach kade-api with their own addresses, and chapter 10's port limits and "lost device in the logs" problems disappear.
Living with both: dual stack
The internet is in a long transition. Most devices run dual stack: IPv4 and IPv6 at the same time.
| DNS | A name can have A and AAAA records (chapter 23). A dual-stack client asks for both. |
| Happy Eyeballs | The client tries IPv6 first and starts IPv4 a fraction of a second later; whichever connects first wins. A broken IPv6 path then costs only a tiny delay. |
| NAT64 + DNS64 | Many mobile networks give phones only IPv6. To reach IPv4-only sites, the carrier's DNS invents an AAAA record that points to a translator (NAT64), which converts to IPv4. The rider's phone may reach an IPv4-only api.kade.lk this way. |
| Tunnels | Older ways to carry IPv6 inside IPv4 packets across networks that only speak IPv4 (6in4 and similar) |
IPv6 in the Kadé setup
| Public entry | GCP's external load balancers can take an IPv6 address. Add an AAAA record for api.kade.lk pointing to it, and IPv6 users connect natively, even if everything behind the load balancer stays IPv4. |
| Inside the VPC | GCP subnets can be dual-stack: each /64 IPv6 range sits beside the IPv4 range, internal (ULA) or external. VMs then get an IPv6 address too. |
| Firewalls | IPv6 needs its own rules: a rule for 0.0.0.0/0 does not cover ::/0. Check both. |
| URLs and logs | Addresses in URLs go in brackets because of the colons: https://[2001:db8::1]:443/. Link-local addresses need the interface: fe80::1%en0. Log parsers and allowlists written for IPv4 often break on these. |
Summary
| # | Idea | In one line | New terms |
|---|---|---|---|
| 1-2 | IPv6 | 128 bits, 8 hex groups; /64 networks: 64-bit prefix + 64-bit interface ID | IPv6, interface ID |
| 3 | Shortening | Drop leading zeros; one :: for the longest zero run | |
| 4 | Prefixes | ISPs hand out /48 or /56; each network is a /64 | prefix delegation |
| 5-6 | Types | Global, link-local, ULA, multicast, ::1, ::; several per interface; no broadcast | link-local, ULA, privacy address |
| 7 | SLAAC | Router Advertisements give the prefix; the device builds its own address; DHCPv6 optional | SLAAC, RA, EUI-64, DHCPv6 |
| 8 | NDP | ARP's replacement over ICMPv6 multicast; ICMPv6 must not be blocked | NDP, DAD, RA Guard |
| 9 | Header | Fixed 40 bytes; no checksum; no router fragmentation; extension headers | Next Header, Hop Limit, Flow Label |
| 10-11 | Transition | No NAT but a firewall; dual stack; Happy Eyeballs; NAT64/DNS64 | dual stack, NAT64 |
| 12 | Kadé | IPv6 load balancer + AAAA; dual-stack subnets; separate ::/0 rules |
Try it yourself
Your IPv6 addresses
- What to look for: A fe80:: address always; global ones if your ISP gives IPv6.
- Runs on: macOS · Linux: ip -6 addr · Windows: ipconfig
- From section: 6. One interface, several addresses
ifconfig en0 | grep inet6Your public IPv6 and IPv4 addresses
- Steps:
curl -6 https://ifconfig.coandcurl -4 https://ifconfig.co - What to look for: If -6 fails, your network has no working IPv6.
- From section: 11. Living with both: dual stack
curl -6 https://ifconfig.cocurl -4 https://ifconfig.coAn IPv6 DNS record
- What to look for: A 2404:… or 2607:… address.
- From section: 11. Living with both: dual stack
dig AAAA google.com +shortEvery IPv6 device on your link answers
- What to look for: Replies from several fe80:: addresses, including the router.
- Runs on: macOS · Linux: ping -6 ff02::1%eth0
- From section: 5. Address types
ping6 ff02::1%en0The NDP neighbour table (ARP's replacement)
- What to look for: IPv6 addresses with MACs, the router marked as router.
- Runs on: macOS · Linux: ip -6 neigh
- From section: 8. NDP: ARP's replacement
ndp -aIPv6 routes
- What to look for:
default via fe80::…: the gateway is a link-local address. - Runs on: Linux · macOS: netstat -rn -f inet6
- From section: 7. Self-configuration: SLAAC
ip -6 routeA full dual-stack check
- Steps: Visit
test-ipv6.com - What to look for: A score out of 10, and whether IPv6 is preferred.
- From section: 11. Living with both: dual stack
test-ipv6.com