IPv6: What Changes Compared with IPv4 (and Why You're Already Using It)
IPv4 exhaustion, 128-bit addresses and abbreviation rules, delegated prefixes and /64 networks, address types, SLAAC and Router Advertisements, DHCPv6, temporary addresses, Neighbor Discovery, ICMPv6, stateful firewalls without NAT and dual stack.
We open the router's status page and, next to the familiar IPv4 address, we find a long string full of colons, such as 2001:db8:1234:5601::1. What is it? Do we actually need it? Is it a risk, given that without NAT every device becomes reachable? It is IPv6, and in all likelihood we are already using it for much of our browsing. Let's see why it exists, how addresses are built, how a PC creates one on its own and how to protect an IPv6 network properly.
Why IPv6: IPv4 addresses have run out
An IPv4 address is 32 bits long: about 4.3 billion combinations, fewer than the people on Earth and far fewer than the connected devices. IANA handed out the last free blocks in 2011 and the regional registries exhausted their pools in the following years; the RIPE NCC, which serves Europe, in 2019.
The Internet has held out thanks to NAT: all the devices at home share a single public address, as explained in the article on NAT and port forwarding. Today many providers add a second layer of NAT inside their own network (CGNAT), and then not even the home router has a public address. It works, but it complicates inbound connections, VPNs and many services. IPv6, now defined by RFC 8200, solves the problem at its root: addresses are 128 bits long, about 3.4 × 1038, enough to give every home network millions of billions of addresses.
How an IPv6 address is written
The 128 bits are written in hexadecimal, in eight groups of 16 bits separated by colons:
2001:0db8:1234:5601:0000:0000:0000:0001Two abbreviation rules, clarified by RFC 5952, make it readable:
- in each group the leading zeros are omitted:
0db8becomesdb8,0000becomes0; - one single run of all-zero groups is replaced by “::”. The longest run is chosen, and “::” is not used for a single group.
The address above therefore becomes 2001:db8:1234:5601::1. Letters are written in lower case. “::” appears at most once, otherwise there would be no way to know how many zeros to restore at each point. The examples in this article use the 2001:db8::/32 block, reserved for documentation by RFC 3849.
As in IPv4, the prefix length follows a slash: 2001:db8:1234:5601::/64 means that the first 64 bits identify the network. In local networks the prefix is almost always /64: the first 64 bits are the network, the last 64 the interface identifier, that is the device. IPv6 no longer works in terms of subnet masks; IPv4 subnetting is explained in the article on IP addresses and subnet masks.
The prefix delegated by the provider
With IPv4 the provider gives the router a single public address. With IPv6 it gives the WAN interface an address and, on top of that, delegates a whole prefix to the customer's network, usually with DHCPv6 Prefix Delegation (RFC 8415). The recommendations for home users and small businesses suggest a /56 or a /48; some providers assign only a /64. These are indicative values: they depend on the contract.
A /56 contains 256 /64 networks, a /48 contains 65,536. The router uses one for the LAN and can assign others to the guest network or to each VLAN, with no NAT and no overlaps. If the provider assigns dynamic prefixes, the prefix may change after a reconnection: this is one reason why, in IPv6, device addresses are not typed by hand into rules; names, aliases or whole prefixes are used instead.
Address types
In IPv6 it is normal for an interface to have several addresses at the same time, each with a specific role (RFC 4291).
| Type | Prefix | What it is for |
|---|---|---|
| Link-local | fe80::/10 | Always present, even without a router. Valid only on the local link and never routed: used by Neighbor Discovery, Router Advertisements and as the gateway. |
| Global unicast | 2000::/3 | Public address, reachable on the Internet if the firewall allows it. In the example: 2001:db8:1234:5601::/64. |
| Unique local (ULA) | fc00::/7, in practice fd00::/8 | Private addresses for internal use (RFC 4193), with a random identifier: they do not go out to the Internet. |
| Multicast | ff00::/8 | One packet for a group: ff02::1 all nodes on the link, ff02::2 all routers. |
| Loopback | ::1 | The device itself, like 127.0.0.1 in IPv4. |
In IPv6 there is no broadcast: the functions IPv4 performed with messages to everyone use targeted multicast groups, so devices that are not concerned do not have to process the packet.
SLAAC: the PC builds its own address
In IPv4 a device gets its address from the DHCP server, as explained in the article on DHCP. In IPv6 the most common method is stateless address autoconfiguration, SLAAC (RFC 4862), based on the ICMPv6 Neighbor Discovery messages (RFC 4861):
- at start-up the PC assigns itself a link-local address
fe80::…and sends a Router Solicitation to theff02::2group, that is to all routers; - the router replies with a Router Advertisement (RA) to
ff02::1, and repeats it at regular intervals anyway. It contains the prefix2001:db8:1234:5601::/64with its lifetimes, the indication that the router acts as gateway and, often, the DNS servers in the RDNSS option (RFC 8106); - the PC combines the prefix with a 64-bit interface identifier of its own choosing and obtains, for example,
2001:db8:1234:5601:3c1a:7f2e:9b40:d215; - before using it, it checks that nobody else has it: this is Duplicate Address Detection (DAD), a Neighbor Solicitation sent to a multicast group derived from the address itself;
- the default gateway becomes the router's link-local address, for example
fe80::1.
The router keeps no list of the assigned addresses: that is why it is called “stateless”. The interface identifier used to be derived from the MAC address (EUI-64 format), but this made a device recognisable on any network. Today operating systems use stable but opaque identifiers (RFC 7217) or random ones.
DHCPv6 and temporary addresses
DHCP exists in IPv6 too. DHCPv6 (RFC 8415) can assign addresses and keep a record of them, as in IPv4 (stateful mode), or provide only additional information such as DNS servers (stateless mode). Two flags in the Router Advertisement tell clients what to do: M (managed) invites them to request the address from DHCPv6, O (other) to request only the other information. Not every system supports address assignment through DHCPv6; Android, for example, relies on SLAAC. In a network with mixed devices it is therefore always worth announcing the prefix and the DNS servers in the Router Advertisement as well.
A stable public address would let websites recognise a device over time. For this reason operating systems also create temporary addresses (RFC 8981): they have the same prefix and a random identifier, they are used for outgoing connections and they are replaced periodically, usually within a day. That is why, when you check the network adapter, you see several 2001:db8:… addresses on the same interface.
Neighbor Discovery instead of ARP
In IPv4, finding the MAC address of a device on the same network is the job of ARP. IPv6 has no ARP: Neighbor Discovery replaces it, with Neighbor Solicitation and Neighbor Advertisement messages. The question does not go to everyone, but to a solicited-node multicast group derived from the last digits of the address being looked up. The same protocol carries Router Solicitations, Router Advertisements and Redirect messages. On Windows the neighbour table is shown by netsh interface ipv6 show neighbors, on Linux by ip -6 neigh.
ICMPv6 is essential
In IPv4 many administrators block ICMP “just in case”, with some inconvenience but no serious consequences. In IPv6 this is not possible: ICMPv6 (RFC 4443) carries Neighbor Discovery, SLAAC and Duplicate Address Detection. Moreover, IPv6 routers do not fragment packets: if a packet is too large for a link, the router drops it and sends the sender a Packet Too Big message, which lets it reduce the size. If the firewall blocks this message, connections open but then stall as soon as the data gets larger, a fault that is hard to diagnose.
RFC 4890 lists the messages that should be allowed through: at least Destination Unreachable, Packet Too Big, Time Exceeded and Parameter Problem, plus the Neighbor Discovery messages on the local link. Echo Request and Echo Reply, that is ping, can be limited, but they are useful for troubleshooting.
No NAT: the firewall provides the security
With IPv6 every device has a public address and NAT is no longer needed. Many people fear that, without NAT, everything becomes reachable from the Internet. In reality the protection never came from NAT itself, but from the fact that the router drops inbound packets that do not match an existing connection. In IPv6 this job is done openly by a stateful firewall, as RFC 6092 also recommends for home routers:
- connections started from the LAN towards the Internet are allowed and the firewall records their state;
- replies match the state and pass without any inbound rule;
- unsolicited inbound packets are dropped, unless an explicit rule opens a specific service.
The mechanism is described in the article on stateful firewalls and the state table. The advantage over NAT is clarity: to publish a service, a rule allowing, for example, port 443 to a single address is enough, with no port forwarding. In OPNsense, rules state the protocol version (IPv4, IPv6 or both): a rule written only for IPv4 neither protects nor allows IPv6 traffic. Menus may vary with the version.
Dual stack: IPv4 and IPv6 together
Today almost all networks are dual stack: every device has an IPv4 address and one or more IPv6 addresses, and uses both. When a name has both an A record and an AAAA record, as explained in the article on DNS, the operating system prefers IPv6 and, with the Happy Eyeballs technique (RFC 8305), quickly falls back to IPv4 if IPv6 does not respond. That is why many users rely on IPv6 for much of their browsing without knowing it.
Examples: ipconfig and ip -6 addr
On Windows, ipconfig shows the adapter's addresses. An example consistent with the network in this article:
Ethernet adapter Ethernet:
Connection-specific DNS Suffix . : home.arpa
IPv6 Address. . . . . . . . . . . : 2001:db8:1234:5601:3c1a:7f2e:9b40:d215
Temporary IPv6 Address. . . . . . : 2001:db8:1234:5601:8d4e:21a7:c03f:6b19
Link-local IPv6 Address . . . . . : fe80::b5e2:4c71:9a0d:3e86%12
IPv4 Address. . . . . . . . . . . : 192.168.1.20
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : fe80::1%12
192.168.1.1It shows the stable address, the temporary one used for outgoing connections, the link-local address with the adapter indication (%12, the zone) and the IPv6 gateway, which is the router's link-local address. On Linux the command is ip -6 addr; for a laptop on the same network:
$ ip -6 addr show dev eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
inet6 2001:db8:1234:5601:a4f0:6e12:d93b:7c05/64 scope global temporary dynamic
valid_lft 86235sec preferred_lft 14235sec
inet6 2001:db8:1234:5601:51c8:2b9e:44a7:e310/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 86235sec preferred_lft 14235sec
inet6 fe80::7d3a:c2e1:6b84:19f5/64 scope link noprefixroute
valid_lft forever preferred_lft forever
$ ip -6 route show default
default via fe80::1 dev eth0 proto ra metric 100 expires 1764sec pref mediumscope global marks a routable address, scope link the link-local one; temporary marks the privacy address; valid_lft and preferred_lft are the lifetimes received with the Router Advertisement, which count down until a new announcement renews them. proto ra confirms that the gateway was learnt from a Router Advertisement. For a quick test, ping -6 www.example.com forces the use of IPv6 on both Windows and Linux.
Common mistakes
- Disabling IPv6 “for security”. It does not make the network safer: it removes a protocol that operating systems and many services expect to find, and Microsoft itself advises against disabling it in Windows. Security comes from the firewall rules, which must be written for IPv6 too.
- Blocking all ICMPv6. It breaks Neighbor Discovery and SLAAC, and blocking Packet Too Big causes connections that stall halfway. Filter according to RFC 4890, not with a blanket block.
- Opening the firewall inbound “because without NAT it isn't needed”. The opposite is true: without NAT, the stateful firewall is the only barrier. Inbound, allow only what you want to publish, to specific addresses and ports.
- Mistaking
fe80::for a public address. A link-local address is valid only on the local link: it does not prove that IPv6 towards the Internet works and it is not reachable from outside. The public address is the2001:…one, or in any case within2000::/3. - Using prefixes longer than /64 in the LAN. With a /112 or a /120 SLAAC does not work: networks with clients should always be /64.
- Rules written only for IPv4. If the firewall allows or blocks a service only in IPv4, IPv6 traffic follows different rules: check every rule for both versions.
Practical conclusions
- Leave IPv6 enabled: if your provider offers it, the network will run dual stack and many services will use it on their own.
- Check with
ipconfigorip -6 addrthat you have a global address, not justfe80::, and an IPv6 gateway. - Make sure the firewall applies the default inbound block to IPv6 as well, and open only the services you need to publish.
- Do not block all ICMPv6: allow at least Packet Too Big, the error messages and Neighbor Discovery.
- Use a /64 network for each LAN or VLAN, taken from the delegated prefix, and announce the prefix and DNS servers in the Router Advertisement.
Readers who want to go further into IPv6 addressing, delegated prefixes and the protection of dual-stack networks will find these topics developed step by step in the volumes of the RETI LAN series.
The video
Further reading
- Book: LOCAL AREA NETWORKS (LAN) — Volume 2: IP Addressing and Network Services (English edition)
- Book: LOCAL AREA NETWORKS (LAN) — Volume 4: Routing, NAT, and Internet Access (English edition)
- Book: LOCAL AREA NETWORKS (LAN) — Volume 5: LAN Security and Integration (English edition)
- Video course: Reti LAN da Zero: Switch, IP, Router, Wi-Fi e Internet (video course in Italian)
- Video course: Capire i Firewall con OPNsense (video course in Italian)
- Related article: IP Address and Subnet Mask: How to Tell Which Network a Device Is On
- Related article: DHCP: How a Device Gets Its IP Address
- Related article: DNS: How a Name Becomes an IP Address
- Related article: NAT and Port Forwarding: How a Private Network Talks to the Internet
- Related article: ARP: How a PC Finds Another Device's MAC Address
- Related article: Stateful Firewalls: Why Replies Get Through Without a Rule
- Specialization: LAN Networks
Technical sources
- RFC 8200 e RFC 4291 — Internet Protocol, Version 6 (IPv6) Specification; IP Version 6 Addressing Architecture — Definition of IPv6: 128-bit addresses, the header, no fragmentation by routers; the addressing architecture: link-local fe80::/10, global unicast, multicast ff00::/8, loopback ::1, the 64-bit interface identifier, no broadcast.
- RFC 5952 e RFC 3849 — Recommended text representation of IPv6 addresses (leading zeros omitted, “::” once for the longest run, lower-case letters) and the 2001:db8::/32 block reserved for documentation.
- RFC 4861, RFC 4862 e RFC 8106 — Neighbor Discovery, Stateless Address Autoconfiguration, opzione RDNSS — Router Solicitation and Router Advertisement, Neighbor Solicitation and Advertisement, Redirect, solicited-node groups; automatic address configuration with the announced prefix and Duplicate Address Detection; DNS servers announced in Router Advertisements.
- RFC 8415, RFC 7217 e RFC 8981 — Stateful and stateless DHCPv6 and Prefix Delegation; stable but opaque interface identifiers; temporary addresses for privacy in autoconfiguration.
- RFC 4193 — Unique Local IPv6 Unicast Addresses — Private addresses fc00::/7, in practice fd00::/8 with a random 40-bit global ID, not to be routed on the Internet.
- RFC 4443 e RFC 4890 — ICMPv6 e raccomandazioni per il filtraggio nei firewall — ICMPv6 error and informational messages; messages that must not be blocked: Destination Unreachable, Packet Too Big, Time Exceeded, Parameter Problem and the Neighbor Discovery messages on the local link.
- RFC 6092 e RFC 8305 — Simple Security in IPv6 CPE; Happy Eyeballs Version 2 — Stateful firewalls on home routers: allow connections started from inside and drop unsolicited inbound traffic; fast choice between IPv6 and IPv4 in dual-stack networks.
- RFC 6177 e documento RIPE-690 — Recommendations on the size of prefixes assigned to end users: /56 or /48 for home users and small businesses; actual values depend on the provider.
Standards and official documentation available from the respective organisations.