| |

Internet Backend 03 ๐ŸŒ IPv4, IPv6, and NAT

โฑ๏ธ Estimated read: 12 min | |

IPv4 and IPv6 are not two versions of the same protocol. They are two different addressing architectures, and the difference is the size of the address. IPv4 uses a 32-bit address, which yields approximately 4.3 billion unique addresses. IPv6 uses a 128-bit address, which yields 340 undecillion addressesโ€”enough to assign an address to every atom on the surface of the Earth many times over. The exhaustion of the IPv4 address space was the event that forced the transition, and NAT was the workaround that extended the life of IPv4 for two decades. IPv6 is the structural solution, and NAT is the workaround that IPv6 does not need.

The transition is not a switch that flips. It is a coexistence period, and the coexistence is managed by a set of transition mechanisms: dual-stack, NAT64, DNS64, 464XLAT, and DS-Lite. Each mechanism makes a different trade-off between the cost of operating two networks and the compatibility with the IPv4-only hosts that still exist. The global IPv6 adoption crossed the 50% threshold in March 2026, which is the symbolic point where IPv6 became the majority protocol for the first time . The remaining work is the long tail: the enterprises, the small ISPs, and the legacy systems that have not yet deployed it.

Key point: IPv4 is a 32-bit address space that was exhausted in 2019. NAT extended its life by sharing public addresses among many private hosts, but NAT breaks the end-to-end principle and creates the stateful middlebox problems. IPv6 is a 128-bit address space that restores the end-to-end model. The transition uses dual-stack, NAT64/DNS64, 464XLAT, and DS-Lite, and the global adoption crossed 50% in 2026.


Why NAT was the workaround and IPv6 is the solution

The exhaustion problem. IPv4 was standardized in the 1980s with a 32-bit address space, and the designers did not anticipate the scale of the public Internet, the mobile devices, and the cloud services. The IANA ran out of the unallocated IPv4 /8 blocks in February 2011, and the RIPE NCC, the registry for Europe and the Middle East, ran out of its allocation on November 25, 2019 . The IPv4 addresses became a traded commodity, with the prices rising as the scarcity increased. A /24 block was priced at roughly $10.50 per IP in 2014, and the market has only tightened since .

The NAT workaround. Network Address Translation is the mechanism that lets many private hosts share a single public IPv4 address. The home router assigns the private addresses from the RFC 1918 space (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16), and it translates the source address of each outbound packet to the public address. The return packets are matched to the original connection by the port number, and the translation is reversed. The NAT device maintains a state table, and the state is the mechanism that makes the sharing work .

The carrier-grade NAT. The home NAT was not enough. The ISPs also ran out of the public addresses, and they deployed the Carrier-Grade NAT (CGN) to share the public addresses among many subscribers. The CGN uses the 100.64.0.0/10 shared address space (RFC 6598), and the subscriber’s home router is assigned an address from that space. The result is the NAT444: the subscriber’s private network, the carrier’s private network, and the public Internet. The subscriber’s traffic passes through three addressing domains, and the CGN is the second NAT layer .

The NAT costs. NAT breaks the end-to-end principle. A host behind NAT cannot be reached from the outside without the port forwarding, and the port forwarding is often blocked by the CGN. The peer-to-peer applications, the VoIP, the online gaming, and the home security systems all suffer. The CGN also creates the logging problems: the ISP must log every connection to map the public address and port back to the subscriber, and the logging volume is enormous. The address sharing also causes the reputation problems: a spammer and a legitimate user share the same public IP, and the ban on the spammer blocks the legitimate user .


a. The IPv6 addressing and the end-to-end restoration

IPv6 is not just a larger address space. It is a different addressing model. The 128-bit address is divided into a 64-bit network prefix and a 64-bit interface identifier. The interface identifier is typically derived from the MAC address or generated randomly, and the host can auto-configure its own address using the Stateless Address Autoconfiguration (SLAAC). The host sends a Router Solicitation, the router responds with a Router Advertisement that contains the network prefix, and the host combines the prefix with its interface identifier to form the full address. The auto-configuration removes the need for the DHCP in many cases, and it is the mechanism that makes the IPv6 network plug-and-play .

The IPv6 header is simpler than the IPv4 header. It has the fixed 40-byte header with the version, the traffic class, the flow label, the payload length, the next header, and the hop limit. The fragmentation and the options are moved to the extension headers, which are processed only by the endpoints. The simplification reduces the router processing, and the hop limit replaces the TTL with the same function. The IPv6 header does not have the checksum, because the link layer and the transport layer already provide the error detection, and the removal reduces the per-hop processing .

The end-to-end restoration is the key benefit. With IPv6, every device can have a globally unique address, and the NAT is not needed. The peer-to-peer applications work, the inbound connections work, and the logging is simpler because the address identifies the subscriber. The IPv6 does not have the NAT by design, and the firewalls provide the stateful filtering without the address translation. The stateful firewall is the mechanism that provides the security that the NAT provided as a side effect, and the two are separate concerns .


b. The transition mechanisms

The transition from IPv4 to IPv6 is not a flag day. It is a coexistence period, and the mechanisms are the ways the two protocols interoperate.

Dual-stack is the simplest and the most common. The device has both an IPv4 address and an IPv6 address, and the application chooses the protocol based on the destination. The DNS returns both the A record (IPv4) and the AAAA record (IPv6), and the client prefers the IPv6 if it is available. The dual-stack works, but it requires operating two networks in parallel, and the cost is the double infrastructure. The IPv4 network still needs the NAT and the CGN, and the IPv6 network needs its own routing and management .

NAT64 and DNS64 are the mechanisms for the IPv6-only network to reach the IPv4-only hosts. The NAT64 gateway has a pool of IPv4 addresses, and it translates the IPv6 packets to the IPv4 packets and back. The DNS64 is the companion: when the client asks for the AAAA record of a domain that only has an A record, the DNS64 server synthesizes an AAAA record that embeds the IPv4 address in the IPv6 prefix. The client connects to the synthesized IPv6 address, and the NAT64 gateway translates it to the real IPv4 address. The combination is the mechanism that lets the IPv6-only clients reach the IPv4-only servers without the dual-stack .

464XLAT is the mechanism that handles the applications that use the IPv4 literals. The DNS64 does not help when the application connects to a hardcoded IPv4 address, because there is no DNS query to synthesize. The 464XLAT adds the CLAT function to the client’s network stack. The CLAT translates the IPv4 packets from the application to the IPv6 packets, and the NAT64 gateway translates them back to the IPv4. The application sees an IPv4 interface, and the network sees the IPv6-only traffic. The 464XLAT is the mechanism that makes the IPv6-only network compatible with the legacy applications that have the IPv4 literals .

DS-Lite is the mechanism that tunnels the IPv4 traffic over the IPv6 network. The subscriber’s home router encapsulates the IPv4 packets in the IPv6 packets, and the CGNAT gateway decapsulates them and performs the NAT. The DS-Lite removes the need for the IPv4 routing in the access network, and the NAT is shifted to the gateway. The trade-off is the encapsulation overhead and the complexity of the tunnel .


Complete Example Session

// ============================================
// PART 1: THE IPv4 ADDRESS SPACE
// ============================================

// The 32-bit address: 4,294,967,296 addresses.
// The private space: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16.
// The CGN shared space: 100.64.0.0/10 (RFC 6598).
// The exhaustion: IANA 2011, RIPE NCC 2019.

// ============================================
// PART 2: THE NAT MECHANISM
// ============================================

// The home router translates the private address to the public address.
// The state table maps the (private IP, private port) to (public IP, public port).
// The return packets are matched by the port and translated back.

// ============================================
// PART 3: THE NAT444
// ============================================

// The subscriber's private network โ†’ the carrier's private network โ†’ the public Internet.
// The home router does the first NAT.
// The CGN does the second NAT.
// The CGN uses the 100.64.0.0/10 space.

// ============================================
// PART 4: THE IPv6 ADDRESS SPACE
// ============================================

// The 128-bit address: 340 undecillion addresses.
// The /64 prefix for the network, the 64-bit interface identifier.
// The SLAAC: the host auto-configures from the router advertisement.

// ============================================
// PART 5: THE DUAL-STACK
// ============================================

// The device has both an IPv4 and an IPv6 address.
// The DNS returns both the A and the AAAA records.
// The client prefers the IPv6 if it is available.

// ============================================
// PART 6: THE NAT64 AND DNS64
// ============================================

// The IPv6-only client wants to reach the IPv4-only server.
// The DNS64 synthesizes the AAAA record from the A record.
// The client connects to the synthesized IPv6 address.
// The NAT64 gateway translates to the real IPv4 address.

// ============================================
// PART 7: THE 464XLAT
// ============================================

// The application uses the IPv4 literal.
// The CLAT on the client translates the IPv4 to the IPv6.
// The NAT64 gateway translates the IPv6 to the IPv4.
// The application sees the IPv4 interface.

// ============================================
// PART 8: THE DS-LITE
// ============================================

// The home router encapsulates the IPv4 in the IPv6.
// The CGNAT gateway decapsulates and performs the NAT.
// The IPv4 routing is removed from the access network.

// ============================================
// PART 9: THE ADOPTION
// ============================================

// The global IPv6 adoption: 50.10% on March 28, 2026 (Google).
// The leaders: France 73%, India 72%, Saudi Arabia 65%.
// The laggards: Italy 17%, Spain 10%, Egypt 4%.
// The mobile networks lead, the fixed-line and the enterprises lag.

// ============================================
// PART 10: THE CHECKLIST
// ============================================

// [ ] The IPv4 exhaustion is understood.
// [ ] The NAT and CGN mechanisms are understood.
// [ ] The NAT costs (end-to-end break, logging, reputation) are understood.
// [ ] The IPv6 addressing and SLAAC are understood.
// [ ] The dual-stack, NAT64/DNS64, 464XLAT, and DS-Lite are understood.
// [ ] The adoption statistics are understood.
// [ ] The transition strategy for the specific network is chosen.

The ten parts covered the IPv4 address space, the NAT, the NAT444, the IPv6 address space, the dual-stack, the NAT64/DNS64, the 464XLAT, the DS-Lite, the adoption, and the checklist. The through-line is that NAT was the workaround, IPv6 is the solution, and the transition is the coexistence.


Quick Reference

The address space

ProtocolAddress sizeTotal addresses
IPv432 bits~4.3 billion
IPv6128 bits~340 undecillion

The NAT types

TypeLayersAddress spaceUse case
NAT441RFC 1918Home router
NAT4442RFC 1918 + RFC 6598CGN
DS-Lite2IPv6 tunnelCGN over IPv6
NAT641IPv6 to IPv4IPv6-only network

The transition mechanisms

MechanismIPv6-only clientIPv4-only serverIPv4 literals
Dual-stackYesYesYes
NAT64/DNS64YesYesNo
464XLATYesYesYes
DS-LiteNo (IPv4 tunnel)YesYes

The adoption (March 2026)

CountryIPv6 adoption
France73%
India72%
Saudi Arabia65%
Global50.10%
Italy17%
Spain10%

Best Practices

โœ… Do This:

// Use the dual-stack for the transition if the cost is acceptable.
// Use the NAT64/DNS64 for the IPv6-only network.
// Use the 464XLAT for the IPv4 literals.
// Use the DS-Lite for the IPv6-only access network with the IPv4 tunnel.

โŒ Don’t Do This:

// Assume the NAT provides security.
// The NAT provides the stateful filtering as a side effect.
// The stateful firewall is the correct mechanism.

// Assume the IPv4 addresses are still available.
// The IPv4 market is a traded commodity with rising prices.

Common Pitfalls

PitfallWhy It HappensFix
The CGN breaks the port forwardingThe CGN does not forward the inbound portsUse the PCP or the IPv6
The CGN causes the reputation problemsThe subscribers share the public IPUse the IPv6 or the dedicated IP
The IPv6-only network cannot reach the IPv4 literalsThe DNS64 does not helpUse the 464XLAT
The dual-stack cost is highTwo networks in parallelUse the IPv6-only underlay with the IPv4aaS

Summary

ItemValue
IPv432-bit, exhausted, traded commodity
NATThe workaround, breaks the end-to-end principle
CGNThe carrier-grade NAT, NAT444, RFC 6598
IPv6128-bit, restores the end-to-end, SLAAC
Dual-stackBoth protocols, the simplest, the most expensive
NAT64/DNS64IPv6-only to IPv4, no literals
464XLATIPv6-only to IPv4, with literals
DS-LiteIPv4 tunnel over IPv6
Adoption50.10% global, March 2026

Key takeaways:

  • IPv4 was exhausted, and NAT was the workaround. The 32-bit address space ran out, and the NAT extended its life by sharing the public addresses among the private hosts. The CGN extended the sharing to the ISP level, but the NAT breaks the end-to-end principle and creates the stateful middlebox problems .
  • IPv6 is the structural solution. The 128-bit address space restores the end-to-end model, and the SLAAC auto-configures the hosts. The IPv6 does not need the NAT, and the stateful firewall provides the security that the NAT provided as a side effect .
  • The transition uses multiple mechanisms. The dual-stack is the simplest but the most expensive. The NAT64/DNS64 handles the IPv6-only to the IPv4-only, and the 464XLAT handles the IPv4 literals. The DS-Lite tunnels the IPv4 over the IPv6 .
  • The adoption crossed 50% in 2026. The global IPv6 adoption reached 50.10% on March 28, 2026. The mobile networks lead, and the fixed-line and the enterprises lag. The long tail is the remaining challenge .
  • The CGN creates the operational costs. The logging volume, the reputation problems, and the port forwarding limitations are the costs that the ISPs pay for the address sharing. The IPv6 removes these costs, and the transition is the path to the end-to-end restoration .

Remember: IPv4 and IPv6 are not two versions of the same protocol. IPv4 is the exhausted 32-bit address space, and IPv6 is the 128-bit address space that restores the end-to-end model. NAT was the workaround that extended the IPv4 life, but it broke the end-to-end principle and created the CGN costs. The transition is the coexistence, and the mechanisms are the dual-stack, the NAT64/DNS64, the 464XLAT, and the DS-Lite. The adoption crossed 50% in 2026, and the remaining work is the long tail.

Was this helpful?


Stop using slow, ad-bloated tool sites! ๐Ÿคฎ

๐Ÿ”Ž Search “KandZ Tools” on Google to use many professional utilities for free.

KandZ.me is the ultimate minimalist hub for:
โœ… Finance (Mortgage, Interest, Inflation)
โœ… Tech (Base64, JSON, Dev Suite, IP)
โœ… Health (BMI, BMR, TDEE)
โœ… Productivity (Timer, Workspace, QR)

โšก๏ธ Fast & Private
๐Ÿ”’ No data leaves your device
๐Ÿ’Ž 100% Free

๐Ÿ”— Use it now: https://tools.kandz.me
๐Ÿ”– Bookmark itโ€”youโ€™ll need it later!