What an IP address is, and how IPv4 and IPv6 differ
An IP address identifies a network interface so packets can be delivered to it. IPv4 addresses are 32 bits long, which allows about 4.3 billion addresses. IPv6 addresses are 128 bits long, which allows 2 to the power of 128, a number with 39 digits.
The two versions are separate protocols. An IPv4-only device cannot talk directly to an IPv6-only one, so most networks that use IPv6 run both.
Addresses belong to network interfaces rather than whole devices. A laptop with Wi-Fi and Ethernet has an address on each, and devices usually hold several IPv6 addresses at once. Private addresses are not unique either, since the same ranges are reused in home networks everywhere.
How IPv4 and IPv6 addresses are written
IPv4 uses dotted-decimal notation: four numbers from 0 to 255, one per byte, such as 192.0.2.10. IPv6 uses eight groups of four hexadecimal digits separated by colons.
Two rules shorten IPv6 addresses. Leading zeros in a group can be dropped, and one run of all-zero groups can be replaced with a double colon. The double colon may appear only once, or the address would be ambiguous.
In a URL, an IPv6 address goes in square brackets so its colons are not mistaken for a port, as in http://[2001:db8::1]:8080/. The loopback address, which a machine uses to reach itself, is 127.0.0.1 in IPv4 and ::1 in IPv6. The ranges 192.0.2.0/24 and 2001:db8::/32 are reserved for documentation, which is why examples use them.
Full form: 2001:0db8:0000:0000:0000:ff00:0042:8329
Drop leading zeros: 2001:db8:0:0:0:ff00:42:8329
Compress zero run: 2001:db8::ff00:42:8329Public and private address ranges
Public addresses are globally unique and routed across the internet; regional internet registries assign them to ISPs and organizations. Private addresses can be used by anyone inside their own network. They are not routed on the public internet and reach it through NAT.
- 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 are the private IPv4 ranges defined in RFC 1918.
- 100.64.0.0/10 is shared address space for carrier-grade NAT (RFC 6598), used between an ISP's NAT and its customers' routers.
- 169.254.0.0/16 is IPv4 link-local. A device gives itself one of these addresses when it cannot get one from DHCP, so seeing one usually means DHCP failed.
- fc00::/7 holds IPv6 unique local addresses (RFC 4193), the closest IPv6 match for private ranges. In practice they start with fd, followed by a random 40-bit prefix that makes clashes between networks unlikely.
- fe80::/10 is IPv6 link-local. Every IPv6 interface has one, used to talk to neighbors and routers on the same link.
- Global IPv6 addresses are currently assigned from 2000::/3, so public IPv6 addresses start with 2 or 3.
Why IPv4 ran out
About 4.3 billion addresses cannot cover every phone, laptop, server and connected device, and large blocks went to early networks. IANA, which supplies address blocks to the five regional internet registries, handed out its last free IPv4 blocks in 2011. The registries then used up their general pools over the following years.
The internet kept growing on IPv4 through workarounds. NAT puts a whole home or office behind one public address, and carrier-grade NAT adds a second layer at the ISP. Addresses are also bought and transferred between organizations. Each workaround adds cost or complexity, which is the main case for IPv6.
What IPv6 changes
With 128-bit addresses, every device can have a globally routable address again, so IPv6 networks do not need NAT. A stateful firewall on the router is what decides whether outside hosts can open connections to your devices, so check that yours blocks unsolicited inbound IPv6 traffic.
Devices usually configure their own IPv6 addresses. With SLAAC (stateless address autoconfiguration), the router advertises a /64 prefix and each device builds the rest of the address itself; DHCPv6 is an alternative. Phones and desktop systems commonly add temporary addresses that change over time, so one address does not track a device across sites.
Some changes are in the plumbing. Neighbor Discovery replaces ARP, multicast replaces broadcast, and routers no longer fragment packets, so any fragmenting is done by the sender.
Dual stack: running IPv4 and IPv6 together
The usual way to run both is dual stack: hosts have an IPv4 and an IPv6 address, and DNS publishes both. An A record holds a name's IPv4 address and an AAAA record holds its IPv6 address.
When a name has both, browsers use Happy Eyeballs (RFC 8305). They try IPv6 first and start an IPv4 attempt if IPv6 has not connected after a short delay. Whichever succeeds first is used, so a broken IPv6 path costs a short delay rather than a failure.
Some mobile networks are IPv6-only and reach IPv4-only sites through NAT64 and DNS64 translation. To see which versions a site supports, look up its A and AAAA records; with no AAAA record, the name is reachable over IPv4 only.