Catalog My learning Blog
Computer Networking for Developers: TCP, DNS, HTTP, TLS · Phase 1 · Lesson 7 · 3 min read

IPv6 vs IPv4: What Changed and Why

On this page
  1. Why IPv6 exists
  2. How to read and shorten an IPv6 address
  3. IPv6 vs IPv4: what changed besides size
  4. Dual-stack and Happy Eyeballs
  5. Testing IPv6 with dig and curl
  6. Check yourself

Why IPv6 exists

IPv4's 32 bits give about 4.3 billion addresses. The regional registries ran out of fresh blocks between 2011 and 2019, and NAT (Day 6) has been stretching the supply ever since. IPv6 uses 128-bit addresses: about 3.4 × 10^38, enough that every device can have a globally unique address and NAT becomes unnecessary.

IPv6 isn't a future plan; it's in heavy use. Google measures roughly half of its users reaching it over IPv6, and most mobile networks run IPv6 natively.

How to read and shorten an IPv6 address

Eight groups of four hex digits, separated by colons:

Code
2606:4700:0010:0000:0000:0000:6814:179a

Two shortening rules:

  • Drop leading zeros in each group: 0010 becomes 10.
  • Replace one run of all-zero groups with ::.

So the address above is 2606:4700:10::6814:179a, which is one of example.com's real IPv6 addresses. In URLs, wrap it in brackets: https://[2606:4700:10::6814:179a]/.

Address types you'll meet:

AddressMeaning
::1Loopback (IPv4's 127.0.0.1)
fe80::/10Link-local; every interface has one, valid only on its link
fc00::/7 (in practice fd00::/8)Unique local addresses, the private-range equivalent
2000::/3Global unicast, the public internet

Networks are usually allocated as a /48 or /56 to a site and /64 per subnet. A single /64 subnet holds 2^64 addresses, so you never run out of host addresses.

IPv4 and IPv6 compared: a far larger address space and a simpler fixed-size header.
IPv4 and IPv6 compared: a far larger address space and a simpler fixed-size header.

IPv6 vs IPv4: what changed besides size

  • A simpler, fixed 40-byte header. Rarely used options moved to extension headers, and the header checksum is gone (link and transport layers already check).
  • No fragmentation by routers. Only the sender fragments; routers send back "packet too big" so senders adjust. Blocking that ICMPv6 message breaks connections in confusing ways, so don't filter all ICMPv6.
  • No ARP. Neighbor Discovery (over ICMPv6) finds MAC addresses and routers.
  • Automatic addressing. With SLAAC, hosts build their own address from the network prefix the router announces, with no DHCP server needed.
  • No NAT needed, so devices are globally addressable. Security comes from firewalls with default-deny inbound rules, not from address translation.

Dual-stack and Happy Eyeballs

Most networks run dual-stack: IPv4 and IPv6 side by side. DNS returns both A (IPv4) and AAAA (IPv6) records. Clients use Happy Eyeballs (RFC 8305): try IPv6 first, and if it doesn't connect within a short delay (about 250 ms is typical), race IPv4 too and use whichever connects first. So a broken IPv6 path usually means slightly slower connections rather than failures.

Testing IPv6 with dig and curl

Shell
dig +noall +answer example.com AAAA
curl -6 -s -o /dev/null -w 'ipv6 %{remote_ip} %{http_code}\n' https://example.com/
curl -4 -s -o /dev/null -w 'ipv4 %{remote_ip} %{http_code}\n' https://example.com/
Code
example.com.   136  IN  AAAA  2606:4700:10::6814:179a
example.com.   136  IN  AAAA  2606:4700:10::ac42:93f3
ipv6 2606:4700:10::ac42:93f3 200
ipv4 104.20.23.154 200

Forcing each protocol with -6 and -4 isolates problems that only affect one. If users report intermittent slowness, test both: a site with a published AAAA record but broken IPv6 routing is a classic cause.

Check yourself

2001:db8::1. Drop leading zeros in each group, so 0db8 becomes db8 and 0001 becomes 1, then replace the single longest run of all-zero groups with ::. That can be done only once per address.

There are enough addresses for every device to have a global one; a stateful firewall blocking unsolicited inbound traffic provides the protection.

Happy Eyeballs: the client starts an IPv6 connection, and if it doesn't connect within a short delay, around 250 ms, it races an IPv4 connection and uses whichever succeeds first. Users see a small delay instead of a failure.

Neighbor Discovery, which uses ICMPv6 messages to find neighbors' link-layer addresses, discover routers and support address autoconfiguration. That's one reason blocking all ICMPv6 breaks IPv6 networks.

dig AAAA example.com checks that it publishes an IPv6 address, then curl -6 https://example.com forces an IPv6 connection. If the record exists but curl fails, the IPv6 path or server configuration is broken.