Knowledge base

IPv6 tutorial — notation, prefixes and subnetting

IPv6 structure, RFC 5952 notation, prefixes, address types, SLAAC, DHCPv6, DNS, and URLs.

By the end of this guide, you will be able to expand, compress, and classify an IPv6 address and find its network prefix. For example, you will shorten 2001:0db8:0000:0000:0000:0000:0000:0042 to 2001:db8::42 without changing the address. IPv6 succeeds IPv4 and uses 128 bits, giving it a vastly larger address space. RFC 8200 (STD 86) is the base specification, RFC 4291 and its updates define the addressing architecture, and RFC 5952 recommends a canonical text format.

Address structure and notation

A full address has eight groups of four hexadecimal digits. Hexadecimal notation uses 0–9 and a–f, so one digit represents 16 possible values. In 2001:0db8:0000:0000:0000:0000:0000:0042, remove leading zeroes within each group and replace the longest run of all-zero groups with one ::. The result, 2001:db8::42, is a shorter spelling of exactly the same value.

  • Use :: only once, or expansion would be ambiguous.
  • If equal-length zero runs tie, RFC 5952 chooses the first.
  • Write hexadecimal letters a–f in lowercase.
  • Do not shorten a single zero group with ::.

The IPv6 calculator expands and compresses addresses with these rules.

Prefixes and a /64 example

A prefix is the number of fixed leading bits. In 2001:db8:1234:5678:abcd::1/64, the first four groups form the prefix. The network is 2001:db8:1234:5678::/64, and the last value in the block is 2001:db8:1234:5678:ffff:ffff:ffff:ffff. IPv6 has no broadcast address; it uses unicast, anycast, and multicast.

Splitting a /56 into /64s

Extending /56 to /64 adds 8 subnet bits and creates 2^8 = 256 /64s. In order, 2001:db8:1200::/56 contains 2001:db8:1200::/64, 2001:db8:1200:1::/64, 2001:db8:1200:2::/64, through 2001:db8:1200:ff::/64.

The first three groups account for 48 fixed bits. A /56 also fixes the first 8 bits of the fourth group: 2001:0db8:1200:00xx. Only xx changes from 00 to ff: the remaining 8 bits of the fourth group. The third group stays 1200. The full block ends at 2001:db8:1200:ff:ffff:ffff:ffff:ffff. Do not apply the IPv4 subtraction rule: IPv6 does not use broadcast.

Address types and the IANA registry

RangePurpose
::/128unspecified
::1/128loopback
fe80::/10link-local; routers do not forward it between links
fc00::/7unique local; not globally routed
ff00::/8multicast
2001:db8::/32 and 3fff::/20documentation
5f00::/16SRv6 SID space, not ordinary global host space
::ffff:0:0/96IPv4-mapped addresses

Classification must use the longest matching entry in the live IANA registry. An address beginning with 2 or 3 is not automatically ordinary global unicast.

RA, SLAAC, DHCPv6, and Neighbor Discovery

RA (Router Advertisement) is a message in Neighbor Discovery from RFC 4861. A router can use it to advertise a prefix, a default route, and configuration guidance. SLAAC (Stateless Address Autoconfiguration) in RFC 4862 lets a host form an address without a server assigning every address. DHCPv6 can supply addresses or other settings, but the default route normally still comes from RA. Neighbor Solicitation and Advertisement messages help find a device on the local link, check whether it is reachable, and detect duplicate addresses.

Link-local scope, DNS, and URLs

A link-local address may need a zone identifier such as fe80::1%eth0, because the same range exists on multiple interfaces. DNS stores IPv6 in AAAA records. An IPv6 literal in a URL needs brackets: https://[2001:db8::42]/; place a port after the closing bracket.

Checks that prevent common mistakes

  • After expansion, count eight groups. Two :: abbreviations would be ambiguous, and zeroes may be removed only from the start of a group.
  • Choose the prefix for the use case. /64 is standard for many SLAAC subnets, while justified exceptions exist.
  • Separate addressing from traffic protection. IPv6 does not need NAT for security; a firewall enforces policy, and a global address does not guarantee reachability.
  • Use documentation ranges in examples and training, and use a properly assigned prefix in an operating network.

A little network lab

Which /64 subnet number fits the delegated /56?

Your documentation allocation is 2001:db8:1200::/56. Choose subnet number ab for a VLAN and address 2001:db8:1200:ab:beef::1. Check membership of the /56, then identify its /64.

Example result2001:db8:1200::/56 → 2001:db8:1200:ab::/64Open example in calculator
  1. Hexadecimal ab is decimal 171. Fourth group 00ab retains the required leading 00, so the first 56 bits match the allocation.

  2. Within the /56, the next 8 bits select one of 256 /64s. Numbering from zero, 00 is first, ab is the 172nd block, and ff is last.

  3. Change the prefix to /64: the calculator finds 2001:db8:1200:ab::/64. At /56, this part of the fourth group is still variable within the block.

Your turn

Does 2001:db8:1200:100::/64 fit this /56?

Show answer and explanation

No. Fourth group 0100 starts with 01 instead of 00 in its first 8 bits. The final permitted value is 00ff; the next block is outside the allocation.

Official documents

Standards & sources

Sources checked:

The date refers to checking the listed documents and registries, not endorsement by their authors. Calculation assumptions and limits appear with the result. How we prepare the material.