The 128bit IPv6 addresses need a slightly different display format. Instead of dotted-decimal notation we use colon-separated hex values. The address is split into blocks of 16 bit with each block being displayed in hexadecimal form and blocks are separated with colons.
For example: 2001:0db8:0000:0000:0001:0002:0003:0004
This takes up a lot of space. We are allowed to leave out leading zeroes:
2001:db8:0:0:1:2:3:4
This is already better, but we still have that useless block of zeroes in the middle - it is allowed to reduce exactly one block of continuous zeroes to "::":
2001:db8::1:2:3:4
If we want to put an address like this into a URL we have a slight problem: the colon is normally used to separate the port from the address. This is solved by putting [ and ] around the address, so that:
http://[2001:db8::1:2:3:4]:8080/my/path
becomes the URL for HTTP access to 2001:db8::1:2:3:4 on port 8080 looking for the file /my/path.
In order for a host to know which addresses are reachable on the same link it needs to know how much of the local address pertains to the network link (network ID) and what part pertains to the host itself (host ID). This is done with a network mask. In IPv6 notation the network mask is appended to the IP address with a slash and a decimal number - the number denotes the amount of bits on the left side of the address that represent the network ID. For example 2001:db8::1:2:3:4/64 tells the host that the left 64 bit (2001:db8:0:0:*) represent the network of the link it is connected to and the right 64 bit (*:1:2:3:4) represent the host itself.
Apart from giving hosts routing hints network masks are also used when blocks of addresses are given to organisations to tell them which bits they can use to structure their internal network. For example if Example Corp. gets told by its Registry that it now owns 2001:db8::/48 - they know that the first 48 bits of each and every IP address in their network must be 2001:db8:0:* and they can use the remainder to structure their network - eg. giving 2001:db8:0:0::/64 to their backbone, 2001:db8:0:1::/64 to the IT network, 2001:db8:0:2/64 to the office buildings on the west campus, and so on.
There are several kinds of addresses that we need to understand in order to understand the IPv6 addressing architecture.
Unicast addresses are the normal everyday kind that most people are familiar with - the address belongs to exactly one host and if we send a packet to that address it arrives at exactly the same host each and every time.
Multicast addresses are different - they are shared between different hosts. If we send a packet to a multicast address it arrives at all of the hosts that subscribe to the address - potentially all of them will answer the packet.
Anycast addresses are in between both concepts. The address belongs to multiple hosts - usually scattered globally. If we send a packet to an anycast address it arrives at exactly one of those hosts - usually the one nearest (in network terms) to us.
Node Local scope describes addresses that are valid only inside a single host or even inside a single network device, they never leave the host.
Link Local scope describes addresses that are valid on a specific wire. For example addresses that can be used to differenciate the devices connected to the same ethernet switch, but are not valid outside of that LAN segment.
Site Local scope used to describe addresses that are valid for a specific organization. This scope has since been deprecated and site local addresses are handled the same way global addresses are handled.
Global scope addresses are routable in the Internet.
There are quite a few blocks of addresses with specific meanings, these are the main blocks as of 2009.
The high order bits define the address type:
Address type | Binary prefix | IPv6 notation |
Unspecified | 00...0 (128 bits) | ::/128 |
Loopback | 00...1 (128 bits) | ::1/128 |
Multicast | 11111111 | FF00::/8 |
Link-Local unicast | 1111111010 | FE80::/10 |
Global Unicast | (everything else) |
The unspecified address is used internally to tell the operating system that all local IP addresses should be listened on (server programs) or that any IP address that fits the needs (clients) is fine.
The loopback address denotes the local host - any packet sent to this address is sent to the local system, never to the network.
2000::/3 is the block from which globally routable addresses are allocated for the next few decades. Most of those are from 2001::/16 at the moment.
2002::/16 is the prefix for the 6to4 mechanism that allows networks with a globally routable IPv4 address to create a IPv6 network prefix that can be used internally and is also globally routable.
2001:db8::/32 is a reserved prefix for examples, like the one you are reading right now. These addresses are from the globally routable space and hence the local networks will behave as expected, but providers filter them out since too many test networks use them. This network is not intended to be used in real life.
3ffe::/16 used to be the prefix for the 6bone test network that has since been shut down. Some of the addresses continue to be used (usually internally only) - for this reason the addresses are currently blocked for re-allocation, but they will be re-used eventually.
fc00::/7 or more specifically the fd00::/8 part of this network is used for private networks without direct connection to the Internet. These are usually used to have an unchanging internal prefix and in test networks that do not have any connectivity or very limited connectivity - although these addresses are unicast addresses most providers will filter them out since no routes exist and the addresses cannot be formally allocated.
IPv4-compatible addresses were used in the first phase of the transition between IPv4 and IPv6. A program was allowed to use an IPv6 socket to access the IPv4 protocol stack by prefixing the 32bit IPv4 addresses with zeroes (network ::/96), as an exception to the normal notation it was allowed to insert the IPv4 address in dotted-decimal notation, eg.: ::192.168.0.1. This address type is now deprecated due to most programs being dual-stack and due to subtle differences in the higher level protocols which made implementation difficult.
IPv4-mapped addresses automatically give each host with a valid global IPv4 address a valid IPv6 address in the network ::FFFF:0/96, eg.: ::FFFF:192.168.0.1. Although this addressing scheme is still standard and supported by all IPv6 implementations it has not seen widespread adoption in the real world.
There is one specific anycast address available in each network: the router anycast. In this address all bits of the host-ID are set to zero. Routers for a network are required to be reachable under this address. Hence if you know the network ID of a network, but not the normal unicast address of the router, you can always use the router anycast as a gateway.
All multicast addresses are in the network ff00::/8. The next 8 bits contain 4 bits for flags and 4 bits for scope.
The flags are 0|R|P|T with:
T=0 (0x0010) indicating a well known multicast, T=1 a dynamically assigned multicast.
R is used for specifying Rendezvous Points for globally routed multicasts.
P=1 is a multicast based on a network prefix (T must be 1), P=0 is a non-network based multicast.
The most important multicasts have all flags set to 0.
The important scopes are:
Some of the more important assigned multicast addresses are:
The solicited node multicast is used when asking for the hardware address (eg. ethernet MAC) for a specific IP address. The xx:xxxx part is replaced by the last three bytes of the address that is asked for. This ensures that only a limited number of hosts need to check the request while most of those which have a different address need not bother with the request.