Skip to main content
1:1 mock interviews with Sumit, scored on a real hiring rubric.Book a slot →

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.

JioCoderUpdated Oct 11, 20262 min readNetworking
IPv6 Explained: Why We Need It and How It Works

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#

Structure of an IPv6 address: 64-bit network prefix and 64-bit interface ID, with shortened notation

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#

  1. Drop leading zeros in each group: 0db8 → db8, 0000 → 0.
  2. Replace one run of consecutive zero groups with ::. You can use :: only once per address.
Text
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  →  ::1

IPv6 address types#

TypePrefixPurpose
Global unicast2000::/3Public, internet-routable addresses
Link-localfe80::/10Auto-configured on every interface, used on the local link only
Unique localfc00::/7Private addressing, similar to RFC 1918 in IPv4
Multicastff00::/8One-to-many delivery (IPv6 has no broadcast)
Loopback::1This 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 vs IPv6 comparison: address size, address count, notation, NAT, IPsec and configuration
Note

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.com or curl -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).