Why IPv6?
Explain why the IPv4 address space ran out, using the size of the space and the RIR exhaustion timeline. Describe how NAT and carrier-grade NAT (CGNAT) stretched IPv4, and list at least three costs they impose. Compare the size of the IPv4 and IPv6 address spaces and calculate how many /64 subnets fit in a typical site prefix. Name the main design changes in IPv6 beyond bigger addresses (fixed header, no router fragmentation, SLAAC, mandatory ICMPv6). Explain why IPv6 is not backward compatible with IPv4 and name the three families of coexistence techniques. Check whether your own network has working IPv6 and whether your IPv4 is behind NAT or CGNAT.
Take the quiz · pass mark 70% · 9 questions
Explanation
The problem: 32 bits was never going to be enough
IPv4 (RFC 791, 1981) uses 32-bit addresses. That gives 2^32 = 4,294,967,296 addresses in total, but a large share can never be used as public unicast addresses:
| Block | Purpose | Addresses |
|---|---|---|
| 224.0.0.0/4 | Multicast | 268,435,456 |
| 240.0.0.0/4 | Reserved ("class E") | 268,435,456 |
| 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 | Private use (RFC 1918) | 17,891,328 |
| 127.0.0.0/8 | Loopback | 16,777,216 |
| 0.0.0.0/8 | "This network" | 16,777,216 |
| 100.64.0.0/10 | Shared address space for CGNAT (RFC 6598) | 4,194,304 |
After these and a few smaller reservations (link-local, documentation ranges from RFC 5737, and so on) roughly 3.7 billion public addresses are left. That is fewer than one per person on Earth, before you count phones, laptops, servers, cameras, cars and sensors.
Running out, region by region
IANA hands large blocks to the five Regional Internet Registries (RIRs), and they hand addresses to ISPs and organisations. IANA's free pool ran out in February 2011, when it gave the last five /8 blocks to the RIRs, one each. After that each RIR ran down its own stock and moved to strict "last block" rationing.
Drawing diagram…
Today, new networks mostly get IPv4 through small rationed allocations, waiting lists, or by buying or leasing addresses on the transfer market. That makes IPv4 a recurring cost.
The workaround: NAT, then NAT on NAT
Network Address Translation (NAT) lets many hosts with private addresses (RFC 1918) share one public address. Your home router does this: every device gets a 192.168.x.x address and the router rewrites source addresses and ports on the way out.
When ISPs could no longer give every customer a public IPv4 address, they added carrier-grade NAT (CGNAT): the customer's router gets an address from 100.64.0.0/10 (RFC 6598) and the ISP translates again. Traffic now goes through two layers of translation (NAT444).
Drawing diagram…
NAT bought about two decades, but it has real costs:
- No end-to-end reachability. Hosts behind NAT cannot easily accept inbound connections. Peer-to-peer apps, VoIP, gaming and remote access need NAT traversal tricks (STUN, TURN, relays) or port forwarding, which CGNAT customers usually cannot configure.
- State and cost in the network. Every flow uses a translation entry on the CGNAT box. These boxes are expensive, have to be sized for peak load, and are a single point of failure.
- Port exhaustion. A public address has only 65,535 TCP ports (64,512 above the well-known range). Sharing one address among many customers limits how many connections each can open. Pages that open many connections can break in strange ways.
- Logging and attribution. To identify who used a shared address, an ISP has to log address, port and time for every translation. Abuse reports and blocklists hit everyone sharing the address.
- Protocol breakage. Protocols that carry IP addresses inside the payload (FTP, SIP, some VPNs) need application-level gateways or break outright.
A common myth is that NAT is a security feature. Its "protection" comes from the stateful filtering that usually comes with it. An IPv6 router gives you the same protection with a stateful firewall and no address rewriting.
The fix: IPv6
IPv6 (now specified in RFC 8200) uses 128-bit addresses: 2^128, about 3.4 × 10^38 addresses. The point is not that we will "use them all". The point is that address scarcity stops being a design constraint:
- A normal LAN subnet is a /64 (the IPv6 addressing architecture, RFC 4291, fixes a 64-bit interface identifier for most unicast addresses): 2^64 addresses on one link, so hosts can choose their own addresses.
- A typical end site (a home, a branch office) gets a /56 (256 subnets) or a /48 (65,536 subnets).
- Addressing plans can follow structure (site, building, VLAN) instead of squeezing every bit.
IPv6 addresses are written as eight groups of 16 bits in hexadecimal, separated by colons. RFC 5952 sets one canonical text form. Leading zeros in a group are dropped, the longest run of all-zero groups becomes ::, and hex digits are lower-case. You will practise this in L1.02. As a preview:
2001:0db8:0000:0000:0000:ff00:0042:8329 (full form)
2001:db8::ff00:42:8329 (RFC 5952 canonical form)
The examples in this course use the documentation prefix 2001:db8::/32 (RFC 3849) and the IPv4 documentation ranges from RFC 5737, so they never clash with real networks.
More than bigger addresses
IPv6 also cleaned up lessons learned from IPv4:
| Area | IPv4 | IPv6 |
|---|---|---|
| Address size | 32 bits | 128 bits |
| Header | 20 to 60 bytes, variable, with options | Fixed 40 bytes; optional extension headers chained after it |
| Header checksum | Yes, recalculated at every hop | None (left to link and transport layers) |
| Fragmentation | Routers and senders | Senders only; routers send ICMPv6 "Packet Too Big" |
| Minimum link MTU | 68 bytes | 1280 bytes |
| Address configuration | Manual or DHCP | SLAAC (RFC 4862), DHCPv6, or manual |
| Address resolution | ARP (broadcast) | Neighbor Discovery over ICMPv6 multicast (RFC 4861) |
| Broadcast | Yes | No; multicast is used instead |
| ICMP | Can often be filtered heavily | ICMPv6 is essential; blocking it breaks NDP and Path MTU Discovery |
You will look at the header in detail in L1.04, and at NDP and SLAAC in L1.05 and L1.06.
Not backward compatible, so we coexist
An IPv4-only host cannot talk directly to an IPv6-only host. The headers are different and so are the address sizes. The transition therefore relies on three families of techniques:
- Dual stack. Hosts and networks run IPv4 and IPv6 side by side. This is the most common approach today.
- Tunnelling. IPv6 packets are carried inside IPv4, or the other way round, across parts of the network that support only one protocol.
- Translation. For example NAT64/DNS64 (RFC 6146 and RFC 6147) and 464XLAT (RFC 6877), widely used on mobile networks so IPv6-only phones can still reach IPv4-only services.
On a dual-stack host, the operating system and browsers use Happy Eyeballs (RFC 8305). They prefer IPv6 but quickly fall back to IPv4 if the IPv6 attempt is slow, so a broken IPv6 path does not stall the user.
Drawing diagram…
Where adoption stands
IPv6 is no longer experimental. Large mobile operators, content networks and cloud providers run it at scale, and public measurements, such as Google's IPv6 statistics and APNIC Labs, have shown a large and growing share of users reaching services over IPv6. Adoption is uneven by country and network, so check the live statistics instead of quoting a number from memory. For a network engineer the practical conclusion is simple: you will run IPv6, and you will run it alongside IPv4 for years. That is what this course prepares you for.
Worked examples
Example 1: How big is each address space?
Question: How many IPv4 addresses exist, how many IPv6 addresses exist, and how many times larger is IPv6?
Working:
- IPv4: 2^32 = 4,294,967,296 (about 4.3 × 10^9).
- IPv6: 2^128 = 340,282,366,920,938,463,463,374,607,431,768,211,456 (about 3.4 × 10^38).
- Ratio: 2^128 / 2^32 = 2^96, about 7.9 × 10^28.
Takeaway: For every single IPv4 address there are 2^96 IPv6 addresses. That is the same as saying the entire IPv4 Internet fits into one IPv6 address space 2^96 times over.
Example 2: How many subnets does a site get?
Question: Your ISP delegates 2001:db8:4a00::/48 to your office. Each LAN is a /64. How many LANs can you build? What if the ISP had given you a /56?
Working: The number of subnets is 2^(new prefix length − delegated prefix length).
- /48 to /64: 2^(64 − 48) = 2^16 = 65,536 subnets.
- /56 to /64: 2^(64 − 56) = 2^8 = 256 subnets.
Takeaway: Even a "small" /56 gives a home more subnets than most enterprises use in IPv4. Each of those subnets has 2^64 addresses.
Example 3: How far does CGNAT stretch one public address?
Question: A CGNAT gives each subscriber a fixed block of 1,000 ports out of the 64,512 ports above 1023 on a public IPv4 address. How many subscribers share one address, and what happens to a subscriber whose devices need 1,500 simultaneous connections?
Working:
- Subscribers per address: floor(64,512 / 1,000) = 64.
- A subscriber with 1,500 concurrent flows runs out of ports after about 1,000 of them, because each translated flow needs its own external port from the block. New connections fail or stall until old translations expire. Users see this as pages half-loading or apps timing out.
Takeaway: CGNAT trades address scarcity for port scarcity, extra state, and harder troubleshooting. With IPv6, every device has its own global address, so this problem does not exist.
Example 4: Recognising the address you were given
Question: A customer's router reports its WAN address as 100.72.14.9, but a "what is my IP" site shows 198.51.100.23. What is happening?
Working: 100.72.14.9 falls inside 100.64.0.0/10 (100.64.0.0 to 100.127.255.255), the RFC 6598 shared address space. The ISP is using CGNAT, and 198.51.100.23 is the shared public address of the CGNAT.
Takeaway: Inbound port forwarding on the customer's router will not work over IPv4. If the ISP provides IPv6, the customer can reach their devices directly over IPv6 by allowing the traffic in their firewall.
Lab
Goal: Find out whether your current network gives you working IPv6, and whether your IPv4 traffic is translated by NAT or CGNAT.
You need: Any computer on your normal network (home, office or a cloud VM) and a terminal. No configuration changes are made in this lab.
Step 1: Look for IPv6 addresses on your interfaces
| OS | Command |
|---|---|
| Linux | ip -6 addr show |
| macOS | ifconfig | grep inet6 |
| Windows (PowerShell) | Get-NetIPAddress -AddressFamily IPv6 (or ipconfig) |
Sort what you see into three groups:
::1: loopback, always present.- Addresses starting with
fe80:: link-local, always present when IPv6 is enabled. These alone do not give you Internet access. - Addresses starting with
2or3(inside2000::/3): global unicast. If you have one, your network is giving you IPv6.
Step 2: Check for an IPv6 default route
| OS | Command |
|---|---|
| Linux | ip -6 route show default |
| macOS | netstat -rn -f inet6 | grep default |
| Windows | route print -6 (look for ::/0) |
A default route usually points to your router's link-local address (fe80::…). That is normal in IPv6.
Step 3: Test end-to-end IPv6 reachability
# Linux / macOS (on older macOS use ping6)
ping -6 -c 3 2001:4860:4860::8888
# Windows
ping -6 2001:4860:4860::8888
Then check that DNS returns IPv6 addresses and that a real application connection works over IPv6:
dig +short AAAA www.google.com # Windows: Resolve-DnsName www.google.com -Type AAAA
curl -6 -sS https://ifconfig.co # Windows: curl.exe -6 -sS https://ifconfig.co
curl -6 prints the global IPv6 address the Internet sees for you. Compare it with the addresses from Step 1. Without NAT they match.
Step 4: Compare with IPv4 and look for NAT or CGNAT
curl -4 -sS https://ifconfig.co # your public IPv4 as seen by the server
Compare that public IPv4 address with:
- Your computer's own IPv4 address (
ip -4 addr,ifconfig,ipconfig). If it is in an RFC 1918 range, you are behind NAT. - If you can, your router's WAN IPv4 address (from its status page). If that is in
100.64.0.0/10, or is itself private, your ISP is also running CGNAT.
Step 5: Record your findings
Fill in this table and keep it. You will reuse it in later labs.
| Item | Your result |
|---|---|
| Global IPv6 address present? (yes/no, first 4 groups only) | |
| IPv6 default route via | |
ping -6 to 2001:4860:4860::8888 succeeds? | |
Public IPv6 seen by curl -6 matches a local address? | |
| Local IPv4 address and range | |
Public IPv4 from curl -4 | |
| Router WAN IPv4 (if known) | |
| Conclusion: native IPv6? NAT? CGNAT? |
If you have no IPv6: that is a valid result too. Record it, note your ISP, and see whether your router has an IPv6 or DHCPv6-PD setting that is switched off. Do not change it during this lab. In L1.07 you will build a dual-stack lab environment that works without ISP IPv6.
Privacy note: Your global IPv6 and public IPv4 addresses can identify your connection. If you share results with others, mask everything after the first three groups of the IPv6 address and the last octet of the IPv4 address.
Summary
- IPv4 has only 2^32 addresses, about 3.7 billion of them usable as public unicast. IANA ran out in 2011, and every RIR has since run out or moved to strict rationing. AFRINIC entered its final phase in 2020.
- NAT and CGNAT stretched IPv4, at the cost of end-to-end reachability, port exhaustion, costly state in the network, heavy logging needs, and broken protocols. NAT is not a security feature: stateful filtering is, and IPv6 firewalls provide it without translation.
- IPv6 uses 128-bit addresses (2^128, about 3.4 × 10^38). LANs are /64s, and sites typically get a /56 (256 subnets) or /48 (65,536 subnets).
- IPv6 also simplifies the header (fixed 40 bytes, no checksum), moves fragmentation to the sender, raises the minimum MTU to 1280 bytes, replaces ARP and broadcast with ICMPv6 Neighbor Discovery and multicast, and adds SLAAC. ICMPv6 must not be blocked wholesale.
- IPv6 is not backward compatible, so networks coexist through dual stack, tunnelling and translation (NAT64/DNS64, 464XLAT). Happy Eyeballs (RFC 8305) keeps dual-stack clients fast when one protocol misbehaves.
- Next lesson (L1.02): reading and writing IPv6 addresses, including the RFC 5952 canonical form.
Quiz imported · 9 questions · pass mark 70%. Lab questions are not auto-marked.