IPv6 is the successor to IPv4. Its main gain is room: addresses are 128 bits long, so there are vastly more of them.
Writing an address
An address is eight groups of four hexadecimal digits, separated by colons:
2001:0db8:0000:0000:0000:ff00:0042:8329Two rules shorten it:
- Drop leading zeros in each group.
- Replace one run of all-zero groups with
::.
The result is 2001:db8::ff00:42:8329. You can use :: only once, otherwise nobody could tell how long each gap was.
Common types
::1is loopback.fe80::/10is link-local. Interfaces with IPv6 enabled normally have one, and it works only on that link.fc00::/7is unique local, similar in purpose to private IPv4. In practice you seefdaddresses.2000::/3is the range global unicast addresses come from today.ff00::/8is multicast.
IPv6 has no broadcast. Neighbor Discovery, using multicast, takes the place of ARP. 2001:db8::/32 is reserved for documentation, as used here.
Prefixes and autoconfiguration
A normal LAN uses a /64. With SLAAC, a router advertises the prefix and each host builds its own address. DHCPv6 also exists. A host often has several addresses at once, including temporary ones for privacy.
On Linux
$ ip -6 address show dev eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
inet6 2001:db8:1:2::50/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::5054:ff:fe12:3456/64 scope link
valid_lft forever preferred_lft foreverip -6 route shows IPv6 routes. Pinging a link-local address needs the interface name, because every link uses the same range:
$ ping -c 1 fe80::1%eth0Older systems may need ping6. In a web URL, put the address in brackets: http://[2001:db8::1]:8080/.
NAT is not normally needed with IPv6, but a firewall still is. Many networks run IPv4 and IPv6 side by side, called dual stack. Remember to apply your filtering to both.
The networking basics guide covers the underlying ideas.
Try it
Run ip -6 address and sort your addresses into loopback, link-local, unique local and global. Then shorten 2001:0db8:0000:0001:0000:0000:0000:0001 by hand and check it with python3 -c 'import ipaddress; print(ipaddress.ip_address("2001:0db8:0000:0001:0000:0000:0000:0001"))'.
Check your understanding
IPv6
All 5 sections ยท no timer
Unlimited retries
Questions from every section are combined into one assessment. Answer them all correctly to complete the article.
Your completion saves in this browser. Sign in to sync it to your account.