LAN NetworksNetwork design

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.

  • Category: LAN Networks · Network design
  • Published:
  • Editorial team: Alba Technology Academy
  • Reading time: about 11 minutes

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:0001

Two abbreviation rules, clarified by RFC 5952, make it readable:

  1. in each group the leading zeros are omitted: 0db8 becomes db8, 0000 becomes 0;
  2. 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.

A 32-bit IPv4 address and a 128-bit IPv6 address At the top a short bar: the IPv4 address 192.0.2.1, 32 bits. Below it a bar four times longer: the IPv6 address 2001:0db8:1234:5601:3c1a:7f2e:9b40:d215, eight groups of 16 bits. The first four groups form the /64 network prefix, announced by the router; the last four the 64-bit interface identifier, chosen by the device. At the bottom the abbreviation: 2001:0db8:0000:0000:0000:0000:0000:0001 is written 2001:db8::1. IPv4 · 32 bits 192.0.2.1 about 4.3 billion addresses IPv6 · 128 bits · 8 groups of 16 bits 20010db812345601 3c1a7f2e9b40d215 /64 network prefix announced by the router interface identifier 64 bits, chosen by the device 2001:0db8:0000:0000:0000:0000:0000:0001 → 2001:db8::1 leading zeros omitted, “::” for the run of zeros
Figure 1 — IPv6 addresses are four times longer in bits: in a LAN the first half is the network, the second the device. Example addresses (RFC 5737, RFC 3849).

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.

A /56 prefix delegated by the provider and the /64 networks of the LAN On the left the provider, which delegates the prefix 2001:db8:1234:5600::/56 to the router. In the middle the router or firewall. On the right two local networks taken from the prefix: the LAN 2001:db8:1234:5601::/64 and the guest network 2001:db8:1234:5602::/64. Below, the note: a /56 contains 256 /64 networks, a /48 contains 65,536. ProviderDHCPv6-PD /56 Router · firewall2001:db8:1234:5600::/56delegated prefix LAN2001:db8:1234:5601::/64 Guest network2001:db8:1234:5602::/64 A /56 = 256 /64 networks · a /48 = 65,536 · indicative values
Figure 2 — The provider delegates a prefix; the router takes a /64 network from it for each segment. Example addresses (RFC 3849).

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

TypePrefixWhat it is for
Link-localfe80::/10Always 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 unicast2000::/3Public 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::/8Private addresses for internal use (RFC 4193), with a random identifier: they do not go out to the Internet.
Multicastff00::/8One packet for a group: ff02::1 all nodes on the link, ff02::2 all routers.
Loopback::1The 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):

  1. at start-up the PC assigns itself a link-local address fe80::… and sends a Router Solicitation to the ff02::2 group, that is to all routers;
  2. the router replies with a Router Advertisement (RA) to ff02::1, and repeats it at regular intervals anyway. It contains the prefix 2001:db8:1234:5601::/64 with its lifetimes, the indication that the router acts as gateway and, often, the DNS servers in the RDNSS option (RFC 8106);
  3. 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;
  4. 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;
  5. 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.

SLAAC autoconfiguration with a Router Advertisement Two columns: the PC on the left, the router on the right. Arrow 1 from the PC to the router: Router Solicitation to ff02::2. Arrow 2 from the router to the PC: Router Advertisement to ff02::1, with the prefix 2001:db8:1234:5601::/64, the gateway fe80::1 and the DNS server in the RDNSS option. Step 3: the PC combines the prefix with its own interface identifier and obtains 2001:db8:1234:5601:3c1a:7f2e:9b40:d215. Step 4: Duplicate Address Detection, a Neighbor Solicitation that gets no reply; the address becomes valid. An animated dot slowly travels along the Router Advertisement arrow. PC Router ① Router Solicitation → ff02::2 ② Router Advertisement → ff02::1 prefix 2001:db8:1234:5601::/64 · gateway fe80::1 · RDNSS ③ The PC combines the prefix and its interface identifier 2001:db8:1234:5601:3c1a:7f2e:9b40:d215/64 ④ DAD: “is anyone already using this address?” Neighbor Solicitation · no reply ⑤ Address valid · default gateway fe80::1
Figure 3 — With SLAAC the router announces the prefix and the PC composes its address on its own, after checking that it is free. Example addresses (RFC 3849).

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.

A stateful firewall in IPv6: replies pass, unsolicited inbound traffic is blocked On the left the LAN PC 2001:db8:1234:5601:3c1a:7f2e:9b40:d215, in the middle the firewall, on the right the Internet with the web server 2001:db8:abcd::80 and an external host 2001:db8:9999::66. Green arrow 1: the PC opens a connection to the server on port 443; the firewall allows it and records the state. Green arrow 2: the server's reply matches the state and passes. Red arrow 3: the external host sends an unsolicited packet to port 3389 on the PC; there is neither a state nor a rule, and the firewall drops it. At the bottom: essential ICMPv6 messages remain allowed. PC · LAN2001:db8:1234:5601:…:d215 Statefulfirewallstatetable web server2001:db8:abcd::80 external host2001:db8:9999::66 ① TCP 443 ② reply ③ TCP 3389 unsolicited: dropped ① outbound allowed: the state is created ② the reply matches the state Essential ICMPv6 (Packet Too Big, Neighbor Discovery) always allowed · RFC 4890
Figure 4 — Without NAT, protection comes from the state table: replies pass, unsolicited inbound traffic stops. Example addresses (RFC 3849).

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

It 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 medium

scope 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 the 2001:… one, or in any case within 2000::/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 ipconfig or ip -6 addr that you have a global address, not just fe80::, 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

IPv6: What Changes Compared with IPv4 — Animation without voice-over, with on-screen text in English and sound effects.

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.

OPNsense® is a registered trademark. Alba Technology does not represent the OPNsense project.