IPv4 vs IPv6: Address Length, Header, Address Configuration, NAT and IPsec
IPv4 and IPv6 are both network-layer protocols for delivering packets to their destination. IPv4 addresses are 32 bits, giving only about 4.3 billion addresses, so it became common for many devices to share one global address using private addresses and NAT. IPv6 extends addresses to 128 bits, simplifies the header to a fixed 40 bytes and removes packet splitting (fragmentation) by routers along the path. The two are not compatible, however: an IPv4-only device and an IPv6-only device cannot talk to each other directly. The transition therefore combines dual stack (running both at once), tunneling (carrying packets of one inside packets of the other) and address translation such as NAT64.
| Aspect | IPv4 | IPv6 |
|---|---|---|
| Address length and count | 32 bits: 2 to the 32nd power (about 4.3 billion) addresses | 128 bits: 2 to the 128th power (about 3.4×10^38) addresses |
| Notation | Four 8-bit decimal numbers separated by dots (e.g. 192.0.2.1) | Eight 16-bit hexadecimal groups separated by colons; leading zeros in each group, and one run of zero groups as ::, can be omitted (e.g. 2001:db8::1) |
| Header | Variable length, 20 to 60 bytes, with options and a header checksum | Fixed 40 bytes with no checksum; options are chained after it as extension headers; the TTL equivalent is the hop limit |
| Fragmentation | Routers along the path, not just the source, can split packets (unless the DF bit is set) | Routers do not fragment; only the source splits packets, using an extension header; link MTU is at least 1280 bytes |
| Automatic address configuration | Assigned by DHCP (or set manually) | SLAAC, where the host builds its own address from router advertisement (RA) information, or DHCPv6; a link-local address is always created automatically |
| MAC address resolution | ARP, which queries by broadcast | ICMPv6 Neighbor Discovery (NDP), which queries by multicast |
| NAT | To make up for the address shortage, sharing one global address via private addresses and NAPT is common | Designed so every device gets a global address and communicates end to end with the same address, since addresses are plentiful; NAT is generally not used |
| Destination types | Unicast, broadcast, multicast | Unicast, multicast, anycast; there is no broadcast, and multicast takes its place |
| IPsec | Optional, added when needed | Early requirements made implementation mandatory; current requirements (RFC 8504) make it recommended. Whether it is actually used depends on configuration for both |
Figures are typical orders of magnitude and vary by process generation and product.