Skip to content
Visual explainer 3h to learn 5 steps

IPv6 addressing

Read, shorten and plan IPv6 addresses and explain SLAAC and address types.

By Invicly Tech, , in Computer Networking. About 10 minutes to read.

Topic 13 of 51

In short

IPv6 uses 128-bit addresses written as eight groups of hexadecimal, which removes address scarcity and the need for NAT. Sites typically receive a /48 or /56 and every LAN is a /64. Hosts can configure themselves with SLAAC using router advertisements, or get addresses from DHCPv6.

Explained simply

IPv6 is the newer version of the Internet Protocol. Its main purpose is simple: IPv4 ran out of addresses. An IPv6 address is 128 bits long, which gives so many addresses that every device can have its own public one, with no need for NAT.

Addresses are written as eight groups of four hexadecimal digits, separated by colons, like 2001:0db8:0000:0000:0000:0000:0000:0001. That is long, so there are two shortening rules: drop leading zeros in each group, and replace one run of all-zero groups with ::. The example becomes 2001:db8::1.

Every IPv6 interface has several addresses at once. A link-local address starting with fe80 is always there and only works on the local link. A global address, usually starting with 2 or 3, works on the internet. Many networks also use unique local addresses starting with fd, like private addresses in IPv4.

Devices can set up their own address without a DHCP server. The router announces the network prefix, and each device builds the rest of the address itself. This is called SLAAC. Networks can also use DHCPv6 if they want central control.

Press Play on a diagram to walk through it one step at a time.

CompareIPv4 versus IPv6
IPv4
  • 32-bit, dotted decimal
  • About 4.3 billion addresses
  • NAT is common
  • ARP for neighbours
  • Header checksum
IPv6
  • 128-bit, hexadecimal groups
  • /64 per LAN
  • End-to-end addressing
  • Neighbour Discovery via ICMPv6
  • No header checksum, simpler header
LayersAnatomy of 2001:db8:abcd:20:a1b2:c3ff:fed4:e5f6
  1. 1
    2001:db8:abcd::/48

    Site prefix from the ISP (48 bits)

  2. 2
    :20

    Subnet ID chosen by you (16 bits), here VLAN 20

  3. 3
    2001:db8:abcd:20::/64

    The LAN prefix announced in RAs

  4. 4
    a1b2:c3ff:fed4:e5f6

    Interface ID (64 bits), random or EUI-64

In depth

Writing addresses: the exact rules

An IPv6 address is 8 groups (hextets) of 16 bits. RFC 5952 sets the canonical form. Write hex digits in lowercase. Drop leading zeros in each group, so 0db8 becomes db8 and 0000 becomes 0. Replace the longest run of two or more all-zero groups with ::, and if two runs tie, shorten the first. Never use :: for a single zero group, and never use :: twice, because then nobody could tell how many zeros each one hides.

To expand an address, do the reverse: count the groups present, fill :: with enough 0000 groups to make 8, and pad each group to 4 digits. For example 2001:db8:0:a::1 has 5 groups, so :: stands for 3: 2001:0db8:0000:000a:0000:0000:0000:0001. In URLs, put the address in brackets: http://[2001:db8::1]:8080/.

  • 2001:0DB8:0000:0000:0001:0000:0000:0001 -> 2001:db8::1:0:0:1
  • Longest zero run wins; on a tie, the first one
  • :: only once per address
  • URLs need brackets: [2001:db8::1]:443

Address types and well-known prefixes

IPv6 has no broadcast. It uses unicast, multicast and anycast instead. Unicast types include ::1 (loopback), :: (unspecified, used before a host has an address), fe80::/10 (link-local, on every interface, never routed), fc00::/7 (unique local; in practice fd00::/8 followed by a random 40-bit ID) and 2000::/3 (global unicast, today's public internet space). 2001:db8::/32 is reserved for documentation.

Multicast starts with ff. ff02::1 reaches all nodes on the link, ff02::2 all routers, and ff02::1:ff00:0/104 is the solicited-node range used by Neighbour Discovery. Because link-local addresses exist on every interface, the same fe80 address can appear on several links, so you must name the interface: ping fe80::1%eth0.

MapIPv6 address types
IPv6 addresses
  • Global unicast 2000::/3
    • Public, routable
    • Usually from your ISP's prefix
  • Unique local fc00::/7
    • fd00::/8 in practice
    • Internal only, like RFC 1918
  • Link-local fe80::/10
    • On every interface
    • Needs a zone: fe80::1%eth0
  • Multicast ff00::/8
    • ff02::1 all nodes
    • ff02::2 all routers
  • Special
    • ::1 loopback
    • :: unspecified
    • 2001:db8::/32 documentation

Planning with /48, /56 and /64

IPv6 planning is about subnets, not hosts. Every LAN gets a /64: 64 bits of prefix and 64 bits of interface ID. A /64 holds about 18 quintillion addresses, so you never size a LAN by host count, and SLAAC requires exactly /64. Sites usually receive a /48 (65,536 subnets of /64) or a /56 (256 subnets), often by DHCPv6 prefix delegation from the ISP.

With a /48 such as 2001:db8:abcd::/48, the fourth hextet is yours: 2001:db8:abcd:0010::/64, 2001:db8:abcd:0020::/64 and so on. Plan on nibble (4-bit, one hex digit) boundaries so addresses stay readable, for example the first digit for the building and the next for the VLAN. You can even embed the VLAN number: VLAN 20 becomes 2001:db8:abcd:20::/64. Router links can use /127 (RFC 6164) and loopbacks /128.

  • LAN: always /64
  • /48 = 65,536 LANs; /56 = 256 LANs
  • Plan on hex-digit (nibble) boundaries
  • Point-to-point: /127; loopback: /128

SLAAC, privacy addresses and DHCPv6

Routers send Router Advertisements (RAs) to ff02::1 every few minutes, or when a host asks with a Router Solicitation. An RA carries the prefix, the router's link-local address as the default gateway, and flags. If the prefix has the A (autonomous) flag, hosts build their own address: the /64 prefix plus a 64-bit interface ID, then run Duplicate Address Detection before using it.

The interface ID used to come from the MAC (EUI-64: split the MAC, insert fffe, flip the U/L bit), but that let sites track a device everywhere. Modern systems use a stable random ID per network (RFC 7217) and extra temporary addresses for outgoing connections (RFC 8981). The RA's M flag tells hosts to get addresses from stateful DHCPv6, and the O flag to get other settings, like DNS, from DHCPv6. DNS can also come in the RA itself (the RDNSS option). Android, notably, does not use stateful DHCPv6 for addresses.

SequenceA host joins an IPv6 LAN with SLAAC
Host
Router
Other hosts
  1. 1DAD: NS for its new fe80:: address
    Host to Other hosts: DAD: NS for its new fe80:: address
  2. 2Router Solicitation to ff02::2
    Host to Router: Router Solicitation to ff02::2
  3. 3RA: prefix 2001:db8:abcd:20::/64, A flag, gateway
    Router to Host: RA: prefix 2001:db8:abcd:20::/64, A flag, gateway
  4. 4DAD: NS for its new global address
    Host to Other hosts: DAD: NS for its new global address
  5. 5DAD silent: address valid, traffic flows
    Host to Router: DAD silent: address valid, traffic flows

Header differences from IPv4

The IPv6 header is a fixed 40 bytes with only eight fields: version, traffic class (like DSCP), a 20-bit flow label, payload length, next header (like IPv4's protocol field), hop limit (like TTL), and the 16-byte source and destination addresses. There is no header checksum, because link layers and TCP or UDP already check for errors, so routers do less work per packet.

Options and fragmentation moved into extension headers, chained through the next header field: hop-by-hop options, routing, fragment, and others. Routers never fragment IPv6 packets; only the sender can, after learning the path MTU from ICMPv6 Packet Too Big messages. Every IPv6 link must carry at least 1280 bytes. And UDP checksums, optional in IPv4, are mandatory in IPv6.

Learn it in 5 short steps

About 35m each. Track them with a timer in your plan.

  1. 1
    Shorten and expand IPv6 addresses~35m
  2. 2
    Identify link-local, global and ULA addresses~35m
  3. 3
    Plan /48 and /64 subnets~35m
  4. 4
    Explain SLAAC and DHCPv6~35m
  5. 5
    Compare IPv4 and IPv6 headers~35m

Key points

  • Shorten by dropping leading zeros and replacing one run of zero groups with ::.
  • fe80::/10 is link-local, present on every IPv6 interface.
  • 2000::/3 is global unicast; fc00::/7 is unique local.
  • Routers do not fragment IPv6; senders use path MTU discovery.

Key terms

Tap a card to flip it. 0/5 known

Examples

bash
ip -6 addr show                 # link-local fe80:: and global addresses
ip -6 route show
ping -6 -c 2 2606:4700:4700::1111
python3 -c "import ipaddress; print(ipaddress.ip_address('2001:0db8:0000:0000:0000:0000:0000:0001'))"
# 2001:db8::1

Building an EUI-64 interface ID by hand

A host with MAC 00:1a:2b:3c:4d:5e uses EUI-64 on prefix 2001:db8:abcd:20::/64. Step 1: split the MAC in the middle: 00:1a:2b | 3c:4d:5e. Step 2: insert ff:fe: 00:1a:2b:ff:fe:3c:4d:5e. Step 3: flip the 7th bit of the first byte (the U/L bit): 00 becomes 02. Step 4: group into hextets: 021a:2bff:fe3c:4d5e. Step 5: add the prefix: 2001:db8:abcd:20:21a:2bff:fe3c:4d5e. The ff:fe in the middle is how you spot EUI-64 addresses in logs. The link-local address uses the same ID: fe80::21a:2bff:fe3c:4d5e.

Inspecting what the router is announcing

A laptop gets no global IPv6 address. Step 1: list addresses; only fe80:: is present, so SLAAC did not happen. Step 2: send a Router Solicitation and print the RA with rdisc6 (from the ndisc6 package). Step 3: if nothing comes back, no router is sending RAs on this VLAN, or a switch is filtering them. Step 4: if an RA comes back but the prefix shows autonomous: no, or a length other than 64, SLAAC is not allowed; fix it on the router. Step 5: check that the firewall allows ICMPv6, since RAs are ICMPv6 type 134.

bash
ip -6 addr show dev wlan0 scope global
sudo rdisc6 wlan0
#  Prefix : 2001:db8:abcd:20::/64
#   On-link                 :           Yes
#   Autonomous address conf.:           Yes
#  Recursive DNS server     : 2001:db8:abcd:20::53
ip -6 route show default

Quick reference

  • Shorten: drop leading zeros, replace the longest run of zero groups with ::, only once
  • fe80::/10 link-local, fd00::/8 ULA, 2000::/3 global, ff00::/8 multicast
  • Every LAN is a /64; a /48 gives 65,536 of them and a /56 gives 256
  • ff02::1 all nodes, ff02::2 all routers; IPv6 has no broadcast
  • RA flags: A = use SLAAC, M = addresses from DHCPv6, O = other info from DHCPv6
  • Link-local needs a zone: ping fe80::1%eth0
  • IPv6 header: 40 bytes fixed, no checksum, minimum link MTU 1280

Common mistakes

  • Using :: twice in one address, which is ambiguous.
  • Subnetting LANs smaller than /64, which breaks SLAAC.

Quick quiz

Pick an answer to see if you're right and why.

Question 1

1What is the canonical (RFC 5952) short form of 2001:0db8:0000:0000:0001:0000:0000:0001?

Question 2

2How many /64 subnets fit in a /56?

Question 3

3Which address range is IPv6's equivalent of private RFC 1918 space?

Question 4

4A Router Advertisement has the M flag set. What should hosts do?

Question 5

5Which field from the IPv4 header has no equivalent in the IPv6 base header?

0/5 answered

Practice exercises

Try each one yourself first. Use the hint if you get stuck, then compare with the solution.

  1. Exercise 1easy

    Expand 2001:db8:0:a::1 and fd12:3456:789a:1::25 to full 32-digit form.

  2. Exercise 2medium

    Your site has 2001:db8:4200::/48. Plan /64s for VLANs 10, 20, 30 in building 1 and the same VLANs in building 2, using the subnet ID to show both.

  3. Exercise 3hard

    On Linux, find which of your global IPv6 addresses are temporary privacy addresses and which is stable, and show which one is used for outgoing connections to 2606:4700:4700::1111.

Check yourself

Answer in your head, reveal, then be honest with yourself.

Feel confident about this topic?

Frequently asked questions

Do I still need NAT with IPv6?
No. Every device can have a global address. A stateful firewall on the router that blocks unsolicited inbound connections gives the same protection people expected from NAT.
Why does my device have so many IPv6 addresses?
Normal: one link-local, one stable global address per prefix, and one or more temporary privacy addresses that rotate, often daily. Each serves a different purpose.
Can I use a /80 or /96 for a LAN to save addresses?
You should not. SLAAC needs a /64, and some features break with longer prefixes. IPv6 has plenty of /64s, so there is nothing to save.
How do I check whether I have working IPv6?
Run ping -6 2606:4700:4700::1111 or curl -6 https://ifconfig.co. If both work, your IPv6 path to the internet works end to end.

Go deeper

ShareXLinkedInWhatsApp