IPv6 fundamentals

IPv6 address format and notation

IPv6 is 128 bits wide, so the full text form is not short. Fortunately the notation is predictable: eight hexadecimal groups, optional leading zeroes, and a single double colon when a run of zero groups can be skipped.

The full form

The full address is eight 16-bit groups

A complete address has eight groups separated by colons. Each group is 16 bits, written with up to four hexadecimal digits: 2001:0db8:0000:0000:0000:0000:0000:0001.

Hex is used because one hex digit is four bits. That is handy when you need to inspect a prefix or compare two addresses by hand: every group is a clean 16-bit boundary.

Rule one

Remove zeroes from the left, never the right

A group such as 0db8 can be written as db8. A group of zeroes becomes 0. Dropping zeroes from the right changes the number, so do not do that.

2001:0db8:0001:: 2001:db8:1::

Rule two

The double colon stands in for whole zero groups

A run of complete 0000 groups can become ::. Use it once at most. If it appeared twice, there would be no way to tell how many groups belong in either gap.

2001:db8:0000:0000:0000:0000:0000:1
2001:db8::1

Network prefixes

The slash marks the routing boundary

IPv6 uses the same slash notation as IPv4. In 2001:db8:1234::/48, the first 48 bits are the network prefix. The other 80 bits sit below that routing boundary.

A /64 is normal for one IPv6 LAN, but it is not a magic default for every case. Providers, data centres, and routing designs use other prefix lengths when they need to.

Calculate a CIDR range