3.3. Address Notation
An IPv6 address has 128 bits, or 16 bytes. The address is divided into eight 16-bit hexadecimal blocks separated by colons. For example:
To make life easier, some abbreviations are possible. For instance, leading zeros in a 16-bit block can be skipped. The example address now looks like this:
A double colon can replace consecutive zeros or leading or trailing zeros within the address. If we apply this rule, our address looks as follows:
Note that the double colon can appear only once in an address. The reason for this rule is that the computer always uses a full 128-bit binary representation of the address, even if the displayed address is simplified. When the computer finds a double colon, it expands it with as many zeros as are needed to get 128 bits. If an address had two double colons, the computer would not know how many zeros to add for each colon. So the IPv6 address 2001:DB8:0000:0056:0000:ABCD:EF12:1234 can be represented in the following ways (note the two possible positions for the double colon):
2001:DB8:0000:0056:0000:ABCD:EF12:1234 2001:DB8:0:56:0:ABCD:EF12:1234 2001:DB8::56:0:ABCD:EF12:1234 2001:DB8:0:56::ABCD:EF12:1234
In environments where IPv4 and IPv6 nodes are mixed, another convenient form of IPv6 address notation is to put the values of an IPv4 address into the four low-order byte pieces of the address. An IPv4 address of 192.168.0.2 can be represented as x:x:x:x:x:x:192.168.0.2, and an address of 0:0:0:0:0:0:192.168.0.2 can be written as ::192.168.0.2. If you prefer, you can also write ::C0A8:2.