IPv6 Explained: Why We Need It and How It Works
A practical introduction to IPv6: the 128-bit address format, shortening rules, address types, SLAAC and how IPv6 compares with IPv4.
IPv6 is the successor to IPv4. It was designed mainly to solve one problem – running out of addresses – but it also cleans up several design decisions that made IPv4 networks complicated.
Why IPv6 exists#
IPv4 has about 4.3 billion addresses. With phones, laptops, servers and billions of IoT devices, that pool was exhausted at the regional registries years ago. Workarounds like NAT stretched IPv4, but they break end-to-end connectivity and add complexity. IPv6 uses 128-bit addresses, giving about 3.4 × 1038 addresses – enough to give every device its own globally unique IP.
Anatomy of an IPv6 address#
An IPv6 address is written as eight groups of four hexadecimal digits, separated by colons. A typical address splits into:
- Network prefix (usually 64 bits) – the global routing prefix assigned by your ISP plus your subnet ID.
- Interface ID (64 bits) – identifies the device on that subnet.
Shortening rules#
- Drop leading zeros in each group:
0db8→db8,0000→0. - Replace one run of consecutive zero groups with
::. You can use::only once per address.
Full: 2001:0db8:85a3:0000:0000:8a2e:0370:7334
Short: 2001:db8:85a3::8a2e:370:7334
Loopback: 0000:0000:0000:0000:0000:0000:0000:0001 → ::1IPv6 address types#
| Type | Prefix | Purpose |
|---|---|---|
| Global unicast | 2000::/3 | Public, internet-routable addresses |
| Link-local | fe80::/10 | Auto-configured on every interface, used on the local link only |
| Unique local | fc00::/7 | Private addressing, similar to RFC 1918 in IPv4 |
| Multicast | ff00::/8 | One-to-many delivery (IPv6 has no broadcast) |
| Loopback | ::1 | This host, like 127.0.0.1 |
What else changed?#
- No broadcast – replaced by multicast, reducing noise on the network.
- SLAAC – Stateless Address Autoconfiguration lets devices build their own address from the router's advertised prefix, no DHCP server required (DHCPv6 still exists).
- NDP replaces ARP – Neighbor Discovery Protocol uses ICMPv6 to find neighbours and routers.
- Simpler header – a fixed 40-byte header with optional extension headers makes routing faster.
- No fragmentation by routers – only the sender fragments, using Path MTU Discovery.
IPv4 vs IPv6#
IPv4 and IPv6 aren't directly compatible. Most networks today run dual stack – both protocols side by side – while translation mechanisms like NAT64 bridge IPv6-only clients to IPv4 services.
IPv6 for developers#
- Store IP addresses in fields large enough for IPv6 (at least 39 characters as text, or 16 bytes binary).
- In URLs, wrap IPv6 literals in brackets:
http://[2001:db8::1]:8080/. - Bind servers to
::to listen on all IPv6 (and often IPv4) interfaces. - Test your connectivity:
ping -6 google.comorcurl -6 https://ifconfig.co.
Key takeaways#
- IPv6 addresses are 128 bits, written as eight hex groups.
- Drop leading zeros and use
::once to shorten addresses. - Typical split: 64-bit network prefix + 64-bit interface ID.
- IPv6 removes broadcast, adds SLAAC and replaces ARP with NDP.
- Most networks run IPv4 and IPv6 together (dual stack).