Every address in the first three guides was IPv4: four numbers with dots. The Internet is running out of those, and has been for years. IPv6 is the replacement, and your laptop is very likely using it already. The addresses look alarming (2001:db8:abcd:12::1), but the ideas are ones you already know: a street and a house, a gateway, a way to hand out addresses. This guide shows how to read and shorten an IPv6 address, what the famous /64 is, where each of your several IPv6 addresses comes from, and why IPv6 doesn't need NAT.
An IPv4 address is 32 bits, so there are 232 of them: 4,294,967,296. That sounded like plenty in 1981. It isn't enough for eight billion people with a phone, a laptop and a smart TV each. The central pool of unassigned IPv4 addresses ran dry in February 2011, and the regional registries that hand them out have run out since. Today IPv4 addresses are bought and sold second-hand.
The Internet has survived mostly through NAT, the trick from the Introduction where a whole house shares one public address. NAT works, but it's a patch. It breaks anything that needs to be reached from outside, and some providers now put hundreds of customers behind one address.
IPv6 fixes the shortage by making the address 128 bits long. That gives 2128 addresses, about 340 followed by 36 zeros (3.4 × 1038). It's enough to give every grain of sand on Earth billions of billions of addresses, and it means address shortages simply stop being a design constraint.
ping -6 2606:4700:4700::1111
That's the IPv6 address of the same Cloudflare server you pinged as 1.1.1.1 in the Introduction. Replies mean your provider, your router and your laptop all speak IPv6. If you get Destination net unreachable or No route to host, you're IPv4-only at the moment. That's still common, and everything on this page still applies; the practice problems work on paper either way.
Writing 128 bits as dotted decimals would take sixteen numbers, so IPv6 uses hexadecimal instead: counting in sixteens. Hex has sixteen digits: 0–9 as usual, then a=10, b=11, c=12, d=13, e=14, f=15. One hex digit is exactly 4 bits, which is why it's used: four digits make one 16-bit group, and eight groups separated by colons make the whole address.
The split is almost always exactly down the middle. The first 64 bits are the network, the street. On a home connection that's usually a block your provider gave you, plus a subnet number. The last 64 bits are the interface ID, the house, and the device chooses it itself (Step 05 shows how).
2001:db8::/32 is reserved for documentation, the way 203.0.113.x was in the earlier guides. It never appears on the real Internet, so examples can't accidentally point at somebody's machine. Your own addresses will start with something else, usually 2 or 3.
Nobody writes all 32 digits. Two rules shorten almost every address, and every tool uses them:
0db8 becomes db8, 0042 becomes 42, and 0000 becomes 0. Only leading zeros: ff00 stays ff00.::, and only once per address. If there are two runs, shorten the longer one; if they're the same length, the first.To expand an address, work backwards: count the groups you can see, and the :: hides however many all-zero groups it takes to make eight. 2001:db8::1 shows three groups, so :: is five groups of zeros: 2001:0db8:0000:0000:0000:0000:0000:0001. That's also why :: can only appear once. In 2001::1::1 there'd be no way to know how many zeros each one hides.
Two you'll see constantly: ::1 is seven groups of zeros and a 1, which is IPv6's loopback address (“this computer”, like 127.0.0.1). :: on its own is all zeros, meaning “no address” or “any address”.
In IPv4, the subnetting guide spent an hour on masks, block sizes and the −2. IPv6 makes most of that go away, because of one rule: every LAN is a /64. Your home network, an office floor and a guest Wi-Fi are each a /64, whether they hold two devices or two thousand.
A /64 leaves 64 bits for devices: 264, about 18 billion billion addresses on one street. Nobody will ever fill it, and that's deliberate. It leaves room for devices to make up their own addresses at random without colliding. There's no broadcast address in IPv6 either, so there's nothing to subtract.
Subnetting moves to the subnet ID, the fourth group. Providers give a home a /56 or a /48, and you count through the subnet ID in hex:
| You're given | /64 networks inside it | Your subnets look like |
|---|---|---|
/64 | 1 | just the one; common on mobile |
/56 | 256 | …:1200::/64, …:1201::/64 … …:12ff::/64 |
/48 | 65,536 | 2001:db8:abcd:0::/64 … 2001:db8:abcd:ffff::/64 |
With the /48 2001:db8:abcd::/48, your networks are 2001:db8:abcd:1::/64, 2001:db8:abcd:2::/64, and so on. Want a subnet per VLAN? Use the VLAN number: VLAN 10 is 2001:db8:abcd:10::/64. There's no block-size arithmetic at all; you just pick the fourth group. (It's hex, so after 9 comes a: …:9::, …:a::, … …:f::, …:10::.)
A /64 has room for 18 billion billion devices, and a house has twenty. Isn't giving every home network a /64 a huge waste, after IPv4 ran out?
It would be a waste if addresses were still scarce, but at 2128 they aren't, so IPv6 spends them on convenience instead. A street that long means every device can pick its house number at random and be almost certain nobody else has it. No DHCP server keeping a list, no running out, no renumbering when you add a device. It's like numbering houses with a random 20-digit code instead of 1, 2, 3: wasteful on paper, but no two houses will ever clash, and nobody has to keep the register. The waste is the feature.
In IPv4, your laptop had one address per connection. In IPv6 it normally has several at once, each for a different job. Look at yours:
ipconfig
Mac: ifconfig en0 | grep inet6. Linux: ip -6 addr. You'll see the same kinds of address. Here's what each one is, with its closest IPv4 equivalent:
| Kind | Starts with | What it's for | IPv4 cousin |
|---|---|---|---|
| Global | 2 or 3 (2000::/3) | Reachable across the Internet. Your real, public address. | a public address |
| Temporary | same prefix | A second global address with a random ID that changes every day or so. Used for outgoing connections, for privacy. | — |
| Link-local | fe80:: | Talking to neighbours on the same street only. Every IPv6 interface always has one, even with no router. | 169.254.x.x, but normal here, not a failure |
| Unique local | fd | Private addresses for inside a network, never routed on the Internet. | 10.x, 192.168.x |
| Loopback | ::1 | This computer, talking to itself. | 127.0.0.1 |
| Multicast | ff | One message to a group: ff02::1 is “everyone on this street”, ff02::2 is “all routers here”. | broadcast (which IPv6 doesn't have) |
Two details in that output are worth a second look. The default gateway is a link-local address: devices reach their router by its fe80:: address, which never changes even if your provider changes your prefix. And the %12 after each link-local address is the zone index, meaning which network adapter. Every adapter has its own fe80:: street, so the computer needs to know which one you mean.
Early IPv6 built the interface ID from the device's MAC address. The Introduction's router MAC a4-2b-b0-5c-19-e2 becomes a62b:b0ff:fe5c:19e2: the same digits with ff:fe in the middle and one bit flipped. That's exactly the gateway address above. It meant your laptop carried the same ID onto every network it joined, so websites could follow it from home to work to café. Modern systems use random IDs instead, and add a temporary one that changes regularly for outgoing traffic. Routers often still use the MAC-based kind.
In IPv4, a DHCP server keeps a list and hands out addresses. IPv6 usually skips it. The router just announces the street name, and each device makes up its own house number. This is SLAAC (stateless address autoconfiguration, pronounced “slack”):
Routers also repeat their Router Advertisement every few minutes, so devices that were already on the street keep hearing it. The advertisement can also say “ask a DHCPv6 server for extra settings”. Some networks use DHCPv6 for DNS server addresses or for full address assignment, but at home SLAAC does the work.
Your laptop has a link-local fe80:: address before it has heard from any router. Why does IPv6 bother giving it one?
Because it needs some address to ask for directions. When you move into a new street you don't yet know the street's official name, but you can still knock on your neighbour's door and ask. The fe80:: address is that: good for talking to anyone on the same street, useless beyond it. The laptop uses it to shout “any routers here?”, the router uses its own fe80:: address to answer, and from then on the router is reached by that same neighbourly address, which is why your default gateway starts with fe80.
The Introduction's ARP shouted “who is 192.168.1.1?” to every device on the street, a broadcast. IPv6 has no broadcast at all. The same jobs are done by Neighbor Discovery (NDP), which uses multicast: messages addressed to a group, so only the devices that care have to listen. The router solicitation and the duplicate-address check in Step 06 were both NDP. So is finding a neighbour's MAC address:
netsh interface ipv6 show neighbors
Mac: ndp -a. Linux: ip -6 neigh. The first line is the router, found by its link-local address, with the same MAC as in the Introduction's ARP table: one box, two protocols. The ff02:: lines are multicast groups, which map to special 33-33-… hardware addresses so the network card itself can ignore groups it hasn't joined.
With IPv4, NAT did two things: it let a whole house share one address, and, as a side effect, it blocked strangers from starting connections to your devices, because they had no address to aim at. IPv6 doesn't need the first job, so it drops NAT entirely. Every device gets its own global address.
The second job, protection, is done properly by a firewall. Almost every home router with IPv6 support ships with a rule that allows replies to conversations your devices started and blocks new connections from outside. The result feels the same as NAT from the outside, with none of NAT's breakage: video calls, games and home servers work directly, and you open exactly the doors you choose.
A friend says IPv6 is less safe because “every device is on the Internet with a real address.” What's wrong with that argument?
It mixes up having an address with having an open door. Every house on your street has a real, public address, and anyone can look it up, but that doesn't mean anyone can walk in: you have locks. NAT was like having no house numbers at all, so strangers couldn't find the door, which helped by accident. IPv6 gives every house a number and puts a proper lock on the front door: the router's firewall lets in replies you asked for and refuses everyone else. A lock is a better defence than an unlabelled door, because it still works when someone finds the door anyway.
IPv4 isn't going away soon, so almost every network runs both side by side. This is dual stack, and it's what your ipconfig showed: an IPv4 address and IPv6 addresses on the same adapter. DNS keeps two kinds of record, A for IPv4 and AAAA (“quad-A”) for IPv6. Look at both:
nslookup -type=AAAA one.one.one.one
When a name has both records, your browser tries IPv6 first and IPv4 a split second later, and uses whichever connects first (the nickname is Happy Eyeballs). You never notice which one won.
Now try it on this site: nslookup -type=AAAA bozcode.com. You'll get the name back with no IPv6 address, because bozcode.com doesn't publish an AAAA record yet, so every visit here uses IPv4. That's how you tell whether any website supports IPv6: look for its AAAA record. Plenty of large sites have one, and plenty of sites don't.
The 1921 speaks IPv6 too. Two extra lines on top of the First Network setup turn it on: ipv6 unicast-routing globally, and ipv6 address 2001:DB8:ABCD:10::1/64 on the LAN interface. The router starts sending Router Advertisements straight away, and your laptop configures itself by SLAAC. show ipv6 interface brief is the IPv6 version of the command you already know.
Work each on paper before you open the answer.
Shorten 2001:0db8:abcd:0012:0000:0000:0000:0001.
Drop leading zeros: 2001:db8:abcd:12:0:0:0:1. Replace the run of three zero groups: 2001:db8:abcd:12::1.
Shorten 2001:0db8:0000:0000:0001:0000:0000:0001. Watch out: there are two zero runs.
After dropping leading zeros: 2001:db8:0:0:1:0:0:1. Both zero runs are two groups long, so the rule is to shorten the first: 2001:db8::1:0:0:1. (2001:db8:0:0:1::1 means the same address, but the standard form shortens the first of equal runs.) You can't use :: for both.
Expand 2001:db8::1 to all 32 digits. How many groups is the :: hiding?
Three groups are visible, so :: stands for five zero groups: 2001:0db8:0000:0000:0000:0000:0000:0001.
Why is 2001:db8::abcd::1 not a valid address?
It uses :: twice. Six groups are missing in total, but there's no way to tell whether that's one and five, two and four, or any other split, so the address is ambiguous. One :: per address, always.
Are 2001:db8:abcd:12:3c1f:9a2e:7b40:d51c and 2001:db8:abcd:13::5 on the same street (the same /64)?
No. A /64 is the first four groups. The first is 2001:db8:abcd:12, the second is 2001:db8:abcd:13. Different subnet IDs mean different streets, so their traffic goes through a router. In IPv6 you can answer this just by comparing the first four groups, with no block-size arithmetic.
Your provider gives you 2001:db8:abcd::/48. How many /64 networks can you make, and what are the first two?
From /48 to /64 is 16 bits of subnet ID, so 216 = 65,536 networks. The first two are 2001:db8:abcd::/64 (subnet ID 0) and 2001:db8:abcd:1::/64. A /56 would have given you 28 = 256.
What kind of address is each? fe80::1, ::1, fd12:3456:789a:1::20, 2606:4700:4700::1111, ff02::1.
fe80::1: link-local, only valid on its own street. ::1: loopback, this computer. fd12:3456:789a:1::20: unique local, private and never routed on the Internet. 2606:4700:4700::1111: global, a real public address (Cloudflare's DNS). ff02::1: multicast, every device on this street.
| IPv4 | IPv6 | |
|---|---|---|
| Size | 32 bits, about 4.3 billion | 128 bits, about 3.4 × 1038 |
| Written as | 192.168.1.23 | 2001:db8:abcd:12::1 |
| A normal LAN | usually /24, 254 devices | always /64 |
| Getting an address | DHCP | SLAAC (DHCPv6 optional) |
| Finding a neighbour's MAC | ARP (broadcast) | Neighbor Discovery (multicast) |
| Broadcast | yes | no, multicast instead |
| NAT | almost everywhere | not needed; firewall instead |
| Loopback | 127.0.0.1 | ::1 |
| Private | 10.x, 172.16–31.x, 192.168.x | fd00::/8 |
| DNS record | A | AAAA |
:: appears onceNetworking Basics Guide 5, the last in the series: turn everything from Guides 1–4 into a method for finding any fault.
IPv4 subnetting still matters: almost every network is dual stack, and the IPv4 side is where masks and block sizes live.
Build a real network, then add the two lines from Step 09 and watch your laptop configure itself with SLAAC.