Back to Networking Examples
Networking Basics · Guide 4

IPv6, without the fear

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.

The finish line — you'll read this without flinching
IPv6 Address. . . . . . . . . . . : 2001:db8:abcd:12:3c1f:9a2e:7b40:d51c Temporary IPv6 Address. . . . . . : 2001:db8:abcd:12:b5e2:4417:c0d9:6a2f Link-local IPv6 Address . . . . . : fe80::8d4c:2e1f:a7b3:5e90%12 Default Gateway . . . . . . . . . : fe80::a62b:b0ff:fe5c:19e2%12
Time needed ~50 min · hardware your laptop
IPv6 scares people because the addresses are long, not because the ideas are hard. The 💡 Explain it simply prompts are placed on the three ideas that are genuinely new. Answer each out loud first. If you can explain why IPv6 doesn't need NAT, you've understood the whole point of it.
STEP 01

Why IPv4 ran out.

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.

Do you have IPv6?

Windows · Linux: ping -6 · Mac: ping6
ping -6 2606:4700:4700::1111
Pinging 2606:4700:4700::1111 with 32 bytes of data: Reply from 2606:4700:4700::1111: time=13ms Reply from 2606:4700:4700::1111: time=12ms

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.

STEP 02

Reading an address: hex and colons.

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 address 2001:0db8:abcd:0012:3c1f:9a2e:7b40:d51c as eight groups of four hex digits. The first three groups, 2001:0db8:abcd, are the site prefix, a /48 from your provider. The fourth group, 0012, is the subnet ID, 16 bits you choose. Together these first four groups are the /64 network, the street. The last four groups are the 64-bit interface ID the device picks for itself, the house.
Same street-and-house idea as IPv4. The street is the first half; the house is the second half.

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).

Why every example here starts 2001:db8

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.

STEP 03

Shortening: two rules.

Nobody writes all 32 digits. Two rules shorten almost every address, and every tool uses them:

  1. Drop leading zeros in each group. 0db8 becomes db8, 0042 becomes 42, and 0000 becomes 0. Only leading zeros: ff00 stays ff00.
  2. Replace one run of all-zero groups with ::, and only once per address. If there are two runs, shorten the longer one; if they're the same length, the first.
Full: 2001:0db8:0000:0000:0000:ff00:0042:8329, with leading zeros marked. Step 1, drop leading zeros: 2001:db8:0:0:0:ff00:42:8329, with the run of zero groups marked. Step 2, replace that run with a double colon: 2001:db8::ff00:42:8329. The double colon may appear only once.
32 digits down to 16, and it still means exactly the same address.

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”.

STEP 04

The /64, and subnetting made easy.

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 itYour subnets look like
/641just the one; common on mobile
/56256…:1200::/64, …:1201::/64 … …:12ff::/64
/4865,5362001: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::.)

💡 Explain it simply

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?

Reveal a plain-language answer

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.

STEP 05

One device, several addresses.

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:

Windows — PowerShell
ipconfig
Wireless LAN adapter Wi-Fi: IPv6 Address. . . . . . . . . . . : 2001:db8:abcd:12:3c1f:9a2e:7b40:d51c Temporary IPv6 Address. . . . . . : 2001:db8:abcd:12:b5e2:4417:c0d9:6a2f Link-local IPv6 Address . . . . . : fe80::8d4c:2e1f:a7b3:5e90%12 IPv4 Address. . . . . . . . . . . : 192.168.1.23 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : fe80::a62b:b0ff:fe5c:19e2%12 192.168.1.1

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:

KindStarts withWhat it's forIPv4 cousin
Global2 or 3 (2000::/3)Reachable across the Internet. Your real, public address.a public address
Temporarysame prefixA second global address with a random ID that changes every day or so. Used for outgoing connections, for privacy.—
Link-localfe80::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 localfdPrivate addresses for inside a network, never routed on the Internet.10.x, 192.168.x
Loopback::1This computer, talking to itself.127.0.0.1
MulticastffOne 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.

Why the temporary address exists

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.

STEP 06

Getting an address with no DHCP: SLAAC.

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”):

A sequence between a laptop, the rest of the street and the router. 1, ask: the laptop sends a Router Solicitation from its link-local address to ff02::2, all routers. 2, answer: the router, from fe80::a62b:b0ff:fe5c:19e2, sends a Router Advertisement: the prefix is 2001:db8:abcd:12::/64 and I am your gateway. 3, invent: the laptop combines the prefix with a random 64-bit ID, making 2001:db8:abcd:12:3c1f:9a2e:7b40:d51c. 4, check: it asks the street whether anyone is using that address, duplicate address detection, and nobody answers. 5, done: the address is in use with no DHCP needed.
The router gives out the street name; each device picks its own house number and checks that nobody else has it.

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.

💡 Explain it simply

Your laptop has a link-local fe80:: address before it has heard from any router. Why does IPv6 bother giving it one?

Reveal a plain-language answer

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.

STEP 07

No ARP, no broadcast: neighbour discovery.

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:

the IPv6 version of arp -a
netsh interface ipv6 show neighbors
Internet Address Physical Address Type fe80::a62b:b0ff:fe5c:19e2 a4-2b-b0-5c-19-e2 Reachable (Router) ff02::1 33-33-00-00-00-01 Permanent ff02::2 33-33-00-00-00-02 Permanent

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.

STEP 08

No NAT: the firewall does the job.

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.

Left, IPv4: a laptop, TV and phone at 192.168.1.23, .40 and .57 share one public address, 203.0.113.57, through NAT; inside addresses are hidden and reused everywhere. Right, IPv6: the same devices each have their own global address on 2001:db8:abcd:12::/64, ending ::d51c, ::7a10 and ::41b5. The router only routes and filters: its firewall allows replies and blocks new connections from outside.
IPv6 gives every device a real address, so protection moves to where it belonged all along: a firewall.

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.

💡 Explain it simply

A friend says IPv6 is less safe because “every device is on the Internet with a real address.” What's wrong with that argument?

Reveal a plain-language answer

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.

STEP 09

Living with both: dual stack.

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:

PowerShell / Terminal — any system
nslookup -type=AAAA one.one.one.one
Name: one.one.one.one Addresses: 2606:4700:4700::1111 2606:4700:4700::1001

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.

On a Cisco router

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.

STEP 10

Practice problems.

Work each on paper before you open the answer.

  1. Shorten 2001:0db8:abcd:0012:0000:0000:0000:0001.

    Show the answer

    Drop leading zeros: 2001:db8:abcd:12:0:0:0:1. Replace the run of three zero groups: 2001:db8:abcd:12::1.

  2. Shorten 2001:0db8:0000:0000:0001:0000:0000:0001. Watch out: there are two zero runs.

    Show the answer

    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.

  3. Expand 2001:db8::1 to all 32 digits. How many groups is the :: hiding?

    Show the answer

    Three groups are visible, so :: stands for five zero groups: 2001:0db8:0000:0000:0000:0000:0000:0001.

  4. Why is 2001:db8::abcd::1 not a valid address?

    Show the answer

    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.

  5. Are 2001:db8:abcd:12:3c1f:9a2e:7b40:d51c and 2001:db8:abcd:13::5 on the same street (the same /64)?

    Show the answer

    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.

  6. Your provider gives you 2001:db8:abcd::/48. How many /64 networks can you make, and what are the first two?

    Show the answer

    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.

  7. What kind of address is each? fe80::1, ::1, fd12:3456:789a:1::20, 2606:4700:4700::1111, ff02::1.

    Show the answer

    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.

STEP 11

IPv4 and IPv6, side by side.

IPv4IPv6
Size32 bits, about 4.3 billion128 bits, about 3.4 × 1038
Written as192.168.1.232001:db8:abcd:12::1
A normal LANusually /24, 254 devicesalways /64
Getting an addressDHCPSLAAC (DHCPv6 optional)
Finding a neighbour's MACARP (broadcast)Neighbor Discovery (multicast)
Broadcastyesno, multicast instead
NATalmost everywherenot needed; firewall instead
Loopback127.0.0.1::1
Private10.x, 172.16–31.x, 192.168.xfd00::/8
DNS recordAAAAA

Check yourself

  • You know whether your own connection has IPv6 (Step 01's ping)
  • You can shorten and expand any IPv6 address, and know why :: appears once
  • You can point to the /64 network and the interface ID in an address
  • You found your global, temporary and link-local addresses, and know what each is for
  • You can explain how SLAAC works without a DHCP server
  • You can explain why IPv6 has no NAT and what protects your devices instead

Where to go next

5

Troubleshooting, step by step

Networking Basics Guide 5, the last in the series: turn everything from Guides 1–4 into a method for finding any fault.

2

Subnetting, by hand

IPv4 subnetting still matters: almost every network is dual stack, and the IPv4 side is where masks and block sizes live.

⬢

Cisco 1921 Router Guide

Build a real network, then add the two lines from Step 09 and watch your laptop configure itself with SLAAC.