Free lesson · Computer Networking
Ipv6 The Next Generation
Why IPv4 Ran Out
The IPv4 address space contains 4.3 billion addresses. In 1981, when IPv4 was standardized, the entire internet had fewer than 300 computers. 4.3 billion seemed infinite. It was not.
The explosive growth of the internet - personal computers, smartphones, tablets, IoT devices, cloud servers, containers - consumed IPv4 addresses far faster than anyone anticipated. Classful addressing wasted enormous blocks (as you learned in Topic 2), and even after CIDR improved allocation efficiency, the fundamental problem remained: 32 bits is not enough for a world with tens of billions of connected devices.
IANA distributed the last blocks of IPv4 addresses to regional registries in February 2011. Each regional registry has since exhausted its allocation. New IPv4 addresses are available only through market transfers (buying from organizations willing to sell) at prices that have risen to $40-50+ per address. IPv4 scarcity is a real economic constraint affecting cloud providers, ISPs, and any organization that needs public internet presence.
IPv6 (Internet Protocol version 6) was designed to solve this problem permanently. With 128-bit addresses providing approximately 3.4 × 10^38 possible addresses - roughly 340 undecillion, or 340 trillion trillion trillion - IPv6 offers enough address space to assign a unique address to every atom on the surface of the Earth and still have addresses left over. IPv6 is not a temporary fix; it is the long-term future of internet addressing.
IPv6 Address Format
An IPv6 address is 128 bits long - four times the length of an IPv4 address. It is written as eight groups of four hexadecimal digits, separated by colons:
Full form: 2001:0db8:85a3:0000:0000:8a2e:0370:7334
Each group represents 16 bits (2 bytes). Eight groups × 16 bits = 128 bits total.
Simplification Rules
Because IPv6 addresses are long and often contain many zeros, two simplification rules make them more readable:
Rule 1: Leading zeros in any group can be omitted.
2001:0db8:0001:0000:0000:0000:0000:0001 becomes 2001:db8:1:0:0:0:0:1
Rule 2: One sequence of consecutive all-zero groups can be replaced with ::.
2001:db8:1:0:0:0:0:1 becomes 2001:db8:1::1
The :: can appear only once in an address - if it appeared twice, you could not determine how many zero groups each :: replaces.
Some more examples:
| Full Form | Simplified |
|---|---|
2001:0db8:0000:0000:0000:0000:0000:0001 |
2001:db8::1 |
fe80:0000:0000:0000:0000:0000:0000:0001 |
fe80::1 |
0000:0000:0000:0000:0000:0000:0000:0001 |
::1 (the IPv6 loopback address) |
0000:0000:0000:0000:0000:0000:0000:0000 |
:: (the unspecified address) |
2001:0db8:aaaa:bbbb:cccc:dddd:eeee:ffff |
2001:db8:aaaa:bbbb:cccc:dddd:eeee:ffff (no zeros to simplify) |
Tip: The IPv6 loopback address is
::1- the equivalent of IPv4's127.0.0.1. When configuring services to listen on localhost in an IPv6 environment, you bind to::1. Some applications bind to both127.0.0.1and::1for dual-stack compatibility.
IPv6 Address Types
IPv6 addresses are categorized by their scope and delivery behavior:
Unicast Addresses
A unicast address identifies a single interface. A packet sent to a unicast address is delivered to exactly one device.
Global Unicast Addresses (GUA): The IPv6 equivalent of public IPv4 addresses. They are globally routable and unique across the entire internet. GUAs begin with 2000::/3 (any address starting with 2 or 3 in the first hex digit). Most IPv6 addresses you encounter are global unicast.
The structure of a global unicast address is typically:
- Routing prefix (first 48 bits): Assigned by the ISP to the organization
- Subnet ID (next 16 bits): Used by the organization for internal subnetting
- Interface ID (last 64 bits): Identifies the specific device on the subnet
This structure provides 16 bits for subnetting within each /48 allocation - that is 65,536 subnets per organization, each with 2^64 possible host addresses. The abundance is staggering compared to IPv4.
IPv6 Subnetting
Subnetting in IPv6 is conceptually identical to IPv4 subnetting - you divide a larger prefix into smaller prefixes by extending the network portion. But the numbers are so large that the constraints are entirely different.
A typical organization receives a /48 from their ISP. The standard practice is to create /64 subnets (using the 16 bits between /48 and /64 for the subnet ID). Each /64 subnet has 2^64 = 18.4 quintillion possible host addresses - so there is never a question of "how many hosts can fit." Subnet design in IPv6 focuses on logical organization (which departments, services, or VLANs get which subnets), not on address conservation.
The /64 boundary is significant because SLAAC (Stateless Address Autoconfiguration) requires a /64 prefix to generate interface IDs. Using subnets smaller than /64 breaks SLAAC and is generally not recommended except for point-to-point links (/127, similar to IPv4's /30).
IPv6 in URLs
When writing an IPv6 address in a URL, you must enclose it in square brackets to distinguish the colons in the address from the colon that separates the address from the port number:
http://[2001:db8::1]:8080/api/data
Without the brackets, the browser cannot determine where the address ends and the port begins. This syntax is used in web browsers, configuration files (Nginx, Apache), and programming language network libraries. It is a common source of configuration errors when engineers accustomed to IPv4 URLs first work with IPv6.
Link-Local Addresses: Every IPv6 interface automatically generates a link-local address in the fe80::/10 range. Link-local addresses are used for communication on the local network segment only - they are not routable beyond the local link. They are the IPv6 equivalent of IPv4's 169.254.x.x auto-configuration addresses, but unlike IPv4 link-local addresses (which indicate a DHCP failure), IPv6 link-local addresses are always present and serve essential functions like neighbor discovery and router solicitation.
Unique Local Addresses (ULA): The IPv6 equivalent of RFC 1918 private addresses. ULAs use the fd00::/8 prefix and are not routable on the public internet. Organizations use them for internal communication that should never traverse the public internet. Unlike IPv4 private addresses, ULAs are less commonly used because IPv6's vast address space often makes NAT unnecessary - every device can have its own globally unique public address.
Multicast Addresses
Multicast addresses begin with ff00::/8. IPv6 uses multicast extensively for functions that IPv4 handled with broadcast. There is no broadcast in IPv6 - broadcast is entirely replaced by multicast, which is more efficient because only devices interested in specific multicast traffic process it, rather than every device on the network processing every broadcast frame.
Anycast Addresses
An anycast address is assigned to multiple interfaces (typically on different devices), and a packet sent to an anycast address is delivered to the nearest one (in terms of routing distance). Anycast is used for load balancing and redundancy - DNS root servers use anycast so that your DNS query reaches the closest root server instance rather than a specific one.
graph TD
subgraph AddressTypes["IPv6 Address Types"]
direction TB
GUA["Global Unicast<br/>2000::/3<br/>Publicly routable<br/>(like public IPv4)"]
LL["Link-Local<br/>fe80::/10<br/>Local segment only<br/>(auto-configured)"]
ULA["Unique Local<br/>fd00::/8<br/>Private networks<br/>(like RFC 1918)"]
MC["Multicast<br/>ff00::/8<br/>One-to-many delivery<br/>(replaces broadcast)"]
AC["Anycast<br/>(same as unicast format)<br/>One-to-nearest delivery"]
end
style GUA fill:#4f46e5,stroke:#4338ca,color:#fff
style LL fill:#7c3aed,stroke:#6d28d9,color:#fff
style ULA fill:#8b5cf6,stroke:#7c3aed,color:#fff
style MC fill:#a78bfa,stroke:#8b5cf6,color:#fff
style AC fill:#c4b5fd,stroke:#a78bfa,color:#000
This diagram shows the five IPv6 address types. Global Unicast addresses use the 2000::/3 prefix and are publicly routable, like public IPv4 addresses. Link-Local addresses use fe80::/10 and work on the local segment only, auto-configured on every interface. Unique Local Addresses use fd00::/8 for private networks, similar to RFC 1918 in IPv4. Multicast addresses use ff00::/8 for one-to-many delivery, replacing IPv4 broadcast entirely. Anycast addresses use the same format as unicast but are assigned to multiple interfaces, with packets delivered to the nearest one.
IPv6 vs IPv4 - Key Differences Beyond Address Size
IPv6 is not simply "IPv4 with longer addresses." Several fundamental design decisions make it a genuinely different protocol:
No broadcast. IPv6 eliminates broadcast entirely, replacing it with multicast. This reduces unnecessary traffic on the network - instead of every device processing every broadcast frame, only devices subscribed to relevant multicast groups receive the traffic.
Simplified header. The IPv6 header is fixed at 40 bytes and contains fewer fields than the IPv4 header. Options that were part of the IPv4 header (fragmentation, header checksum, options) are moved to optional extension headers. This simplification allows routers to process IPv6 packets faster because the fixed-size header eliminates per-packet header length calculations. Notably, IPv6 removes the header checksum entirely - the rationale is that Link-layer protocols (Ethernet) and Transport-layer protocols (TCP, UDP) already have their own checksums, so the IP-layer checksum is redundant computation at every router hop.
No fragmentation by routers. In IPv4, any router along the path can fragment an oversized packet. In IPv6, only the source device can fragment - routers that encounter an oversized packet drop it and send an ICMPv6 "Packet Too Big" message back to the sender. This forces the sender to use Path MTU Discovery (PMTUD) and size packets correctly from the start, which is more efficient than mid-path fragmentation.
Neighbor Discovery Protocol (NDP). IPv6 replaces ARP with NDP (Neighbor Discovery Protocol), which uses ICMPv6 messages instead of broadcast ARP requests. NDP handles address resolution (like ARP), router discovery (finding the local router), prefix discovery (learning which network prefixes are available), duplicate address detection (ensuring no two devices share an address), and redirect notifications. NDP is more capable and more secure than ARP, though it remains vulnerable to certain spoofing attacks without additional protections like SEND (Secure Neighbor Discovery).
No NAT (by design). IPv6's address space is large enough that every device can have a globally unique public address. NAT - which was a workaround for IPv4 address scarcity - is unnecessary and generally discouraged in IPv6 networks. This simplifies networking by eliminating the complexity of address translation and restoring true end-to-end connectivity. Applications that struggled with NAT traversal (P2P, VoIP, gaming) work more naturally on IPv6.
Built-in auto-configuration. IPv6 supports SLAAC (Stateless Address Autoconfiguration), where a device can automatically configure its own IPv6 address without a DHCP server. The device combines the network prefix (learned from router advertisements) with a self-generated interface identifier (derived from the MAC address or randomly generated for privacy) to create a complete address. DHCP is still available in IPv6 (DHCPv6) but is optional rather than required.
Mandatory IPsec support. The IPv6 specification originally required IPsec support in all implementations, providing built-in encryption and authentication at the network layer. In practice, this mandate has been relaxed, but IPsec support remains more universal in IPv6 implementations than in IPv4.
The Transition - Dual-Stack, Tunneling, and Translation
graph TD
subgraph Transition["IPv4 to IPv6 Transition Mechanisms"]
direction TB
DS["Dual-Stack<br/>Run both IPv4 + IPv6<br/>simultaneously<br/>(most common)"]
TUN["Tunneling<br/>Encapsulate IPv6<br/>inside IPv4 packets<br/>(transitional)"]
TRANS["Translation (NAT64)<br/>Convert between<br/>IPv6 and IPv4<br/>(IPv6-only networks)"]
end
style DS fill:#4f46e5,stroke:#4338ca,color:#fff
style TUN fill:#7c3aed,stroke:#6d28d9,color:#fff
style TRANS fill:#8b5cf6,stroke:#7c3aed,color:#fff
This diagram shows three mechanisms for transitioning from IPv4 to IPv6. Dual-stack runs both protocols simultaneously on the same devices and is the most common approach today. Tunneling encapsulates IPv6 packets inside IPv4 packets to traverse legacy networks, and is a transitional mechanism being phased out. Translation using NAT64 converts between the two protocols, enabling IPv6-only networks to reach IPv4-only servers.
The internet cannot switch from IPv4 to IPv6 overnight. Billions of devices, routers, and applications use IPv4, and a flash cutover would break everything. Instead, the transition uses several coexistence mechanisms:
Dual-stack is the most common approach: devices and networks run both IPv4 and IPv6 simultaneously. A server has both an IPv4 address and an IPv6 address. DNS returns both A records (IPv4) and AAAA records (IPv6). The client chooses which protocol to use - modern clients prefer IPv6 when available using an algorithm called Happy Eyeballs (RFC 8305), which initiates connection attempts on both IPv4 and IPv6 simultaneously and uses whichever connection succeeds first. This ensures users get the fastest connection without being penalized if one protocol is slower or broken on their network. Most major websites, cloud providers, and ISPs now support dual-stack.
Tunneling encapsulates IPv6 packets inside IPv4 packets to traverse IPv4-only networks. Technologies like 6in4, 6to4, and Teredo wrap IPv6 traffic in IPv4 headers so it can cross legacy infrastructure. Tunneling is a transitional mechanism that becomes unnecessary as native IPv6 deployment spreads. Most tunnel technologies are being deprecated as native IPv6 becomes widely available - Google deprecated its 6to4 relay in 2022, and Teredo usage has declined as direct IPv6 connectivity has improved.
Translation (NAT64/DNS64) allows IPv6-only devices to communicate with IPv4-only servers. A NAT64 gateway translates between the two protocols by mapping IPv4 addresses into a special IPv6 prefix (typically 64:ff9b::/96) and performing protocol translation. DNS64 synthesizes AAAA records for IPv4-only domains by embedding the IPv4 address within the IPv6 prefix. This enables networks to deploy IPv6-only internally while maintaining access to the IPv4 internet - a model increasingly adopted by mobile carriers that want to eliminate the operational complexity of maintaining dual-stack on their internal infrastructure.
Current Adoption Status
IPv6 adoption has reached a tipping point after decades of gradual deployment. Google's IPv6 statistics show that approximately 45% of traffic to Google services uses IPv6 as of 2025. Countries like India (over 70% IPv6), the United States (over 50%), Germany, France, and Brazil have high adoption rates driven primarily by mobile carriers. Countries like China and Russia have lower adoption but are accelerating deployment through government mandates.
Mobile networks have been particularly aggressive in deploying IPv6 because the explosion of smartphones made IPv4 scarcity most acute for mobile carriers - each smartphone needs a routable address, and carrier-grade NAT (CGNAT) for IPv4 adds latency, breaks certain applications, and increases operational complexity. T-Mobile in the US and Reliance Jio in India run predominantly IPv6-only networks with NAT64 for backward compatibility with the remaining IPv4 internet.
Major cloud providers fully support IPv6: AWS offers IPv6 in VPCs, ALBs, CloudFront, and most services. GCP and Azure provide similar support. Running IPv6-only infrastructure in the cloud is increasingly practical, though many organizations still maintain dual-stack for backward compatibility with IPv4-only clients and services.
Interview: IPv6 questions in System Design interviews typically test awareness rather than deep protocol knowledge:
"Should your service support IPv6?" - Yes, and it should be straightforward if you are behind a load balancer - the LB handles dual-stack, and your application sees standard TCP connections regardless of the underlying IP version.
"How does IPv6 affect your system design?" - The elimination of NAT simplifies peer-to-peer connectivity. The vast address space eliminates IP address management as a scaling constraint. SLAAC reduces DHCP dependency for auto-scaling infrastructure.
"What is the IPv6 loopback address?" -
::1. This is a quick-answer question that demonstrates basic IPv6 literacy.
What Comes Next
The next topic covers NAT (Network Address Translation) - the technology that allowed IPv4 to survive decades beyond its natural expiration by letting multiple devices share a single public IP address. Understanding NAT is essential because it is ubiquitous in today's networks and introduces important constraints that affect application design.
Exercise: Starter: Simplify these IPv6 addresses using both rules (drop leading zeros, compress zero groups with
::): (a)2001:0db8:0000:0000:0000:0000:0000:0001, (b)fe80:0000:0000:0000:0218:e7ff:fe3c:9a2b, (c)0000:0000:0000:0000:0000:ffff:c0a8:0101. For (c), research what this specific format represents (hint: it is an IPv4-mapped IPv6 address).Intermediate: Check if your device has an IPv6 address. Run
ifconfig(Mac/Linux) oripconfig(Windows) and look forinet6entries. You should see at least a link-local address (fe80::...). If you have internet connectivity over IPv6, you will also see a global unicast address starting with2or3. Visittest-ipv6.comto check your IPv6 connectivity score.Advanced: Research SLAAC (Stateless Address Autoconfiguration) in detail. How does a device generate its interface ID from its MAC address using EUI-64? What is the privacy concern with EUI-64 (hint: your MAC address becomes part of your public IP), and how do Privacy Extensions (RFC 4941) address it by generating randomized interface IDs? Most modern operating systems enable privacy extensions by default - verify this on your device.