7 IPv6 Addressing
Learn how IPv6 addresses are structured and shortened, how address types and prefix lengths work, and how subnetting divides IPv6 address blocks.
Address structure and notation
An IPv6 address is a -bit identifier assigned to an interface. It is written as eight groups of up to four hexadecimal digits separated by colons. For example, 2001:0db8:0000:0000:0000:0000:0000:0042 consists of eight -bit groups.
Shortening IPv6 addresses
IPv6 notation can be shortened in two ways:
Omit leading zeros in any group. For example,
0042becomes42.Replace one consecutive run of zero groups with
::. Use::at most once because it represents however many zero groups are needed to make eight groups. For example,2001:db8::42expands to2001:db8:0:0:0:0:0:42.
The recommended uses lowercase letters, omits leading zeros, and compresses the longest run of zero groups. If multiple runs are tied for longest, choose the first. Do not use :: to replace only one zero group.
IPv6 address types
IPv6 has three fundamental address types:
identifies one interface, and a packet is delivered to that interface. Common categories include global , intended for globally routed communication; link-local (
fe80::/10), used on a local link; and unique-local (fc00::/7), intended for local communications within sites or organizations.identifies a set of interfaces. A packet is routed to one member of the set, typically the nearest according to routing.
identifies a group of interfaces, and a packet is delivered to the group. addresses are in
ff00::/8.
IPv6 has no broadcast addresses; provides group-delivery functions. The unspecified address is ::, and the loopback address is ::1. These are special addresses, not ordinary host addresses.
Prefix lengths and address boundaries
A states how many leftmost bits identify a network prefix. It follows a slash: 2001:db8:1234:5600::/56 has a -bit prefix, so the remaining bits are outside that prefix.
The prefix /n means that the first bits are fixed as the network prefix. The remaining bits are calculated as:
For example, /64 leaves bits outside the prefix. The address 2001:db8:1234:5600::42/64 belongs to 2001:db8:1234:5600::/64: the first four -bit groups are the -bit prefix, and the final four groups are outside it.
In many networks, an address is considered as a followed by an ; the boundary depends on the . A /64 is the common subnet size for ordinary IPv6 LANs, but it is not a universal rule for every type of link. The block 2001:db8::/32 is reserved for documentation examples, not ordinary public addressing.
IPv6 blocks
divides an address block into smaller blocks by extending its . Each bit added to the prefix doubles the number of possible subnets, while the number of addresses in each subnet is halved.
For example, dividing 2001:db8:1234::/48 into /64 subnets extends the prefix by bits:
This gives distinct /64 subnets. The remaining bits in each /64 block are outside its .
A useful planning habit is to write the first, then identify which bits are fixed and which are available for . Unlike IPv4, IPv6 has no broadcast address, and all-zero and all-one values in address fields are generally legal.