Sub topic 6
IPv6 basics
This chapter assumes you know how IPv4 addresses, subnet masks, and default gateways work, and that you can run commands in a Windows command prompt or PowerShell.
Why IPv6 exists
IPv4 uses 32-bit addresses, which allow about 4.3 billion addresses. That pool ran out. IPv6 uses 128-bit addresses, which is enough for every device to have its own public address. Because of this, IPv6 networks don't normally need NAT.
Reading and shortening an address
An IPv6 address is written as eight groups of four hexadecimal digits, separated by colons:
2001:0db8:0000:0000:0000:0000:0000:0001
Two rules shorten it:
- Drop leading zeros in each group.
0db8becomesdb8, and0000becomes0. - Replace one run of consecutive all-zero groups with
::.
Applying both rules gives 2001:db8::1. A common error is using :: twice in one address. That is invalid, because the reader could not tell how many groups each :: replaced.
Address types
IPv6 has no broadcast. It uses unicast (one device), multicast (a group of devices), and anycast (the nearest of several devices that share an address).
| Type | Prefix or value | Purpose |
|---|---|---|
| Global unicast | 2000::/3 | Routable on the internet, like an IPv4 public address |
| Link-local | fe80::/10 | Works only on the local link and is never routed |
| Unique local | fc00::/7 (in practice fd00::/8) | Private addressing, like IPv4 private ranges |
| Loopback | ::1 | The local machine, like 127.0.0.1 |
| Multicast | ff00::/8 | Delivered to a group of devices |
Every IPv6 interface has a link-local address, even when no router or DHCP server is present. It is assigned automatically. This is similar to APIPA in IPv4, except that link-local addresses are a normal, permanent part of IPv6.
How a host gets its address
- SLAAC (stateless address autoconfiguration): the router advertises a prefix, and the host builds its own address from that prefix.
- DHCPv6: a server assigns the address and other settings, as DHCP does for IPv4.
Most home networks use SLAAC.
Checking IPv6 on Windows
ipconfig /all
ping ::1
ping -6 example.comIn the ipconfig /all output, look for "Link-local IPv6 Address" (starting with fe80) and "IPv6 Address". The ping ::1 command tests the local IPv6 stack. The -6 option forces ping to use IPv6 for the name lookup.
Coexisting with IPv4
Most networks run dual stack, meaning each device has both an IPv4 and an IPv6 address. Tunneling wraps IPv6 packets inside IPv4 packets so they can cross networks that only support IPv4.
Exercise
Shorten the address 2001:0db8:0000:0000:0000:0000:0000:0001 as far as the rules allow. Then say why 2001::db8::1 is not valid.
Show answer
The shortened form is 2001:db8::1. The address 2001::db8::1 is invalid because "::" may appear only once. With two of them, the number of zero groups each one replaces is ambiguous.