3.4. Prefix Notation
The notation for prefixes has also been specified in RFC 4291. A global routing prefix is the high-order bits of an IP address used to identify the subnet or a specific type of address (refer to Table 3-2). It was called the format prefix in earlier RFCs. The prefix notation is very similar to the way IPv4 addresses are written in Classless Interdomain Routing (CIDR) notation, and it is also commonly used for subnetted IPv4 addresses. The notation appends the prefix length, written as a number of bits with a slash, which leads to the following format:
IPv6 address/prefix length
The prefix length specifies how many left-most bits of the address specify the prefix. This is another way of noting a subnet mask. Remember, a subnet mask specifies the bits of the IPv4 address that belong to the network ID. The prefix is used to identify the subnet that an interface belongs to and is used by routers for forwarding. The following example explains how the prefix is interpreted. Consider the IPv6 prefix notation 2E78:DA53:1200::/40. To understand this address, let's convert the hex into binary as shown in Table 3-1.
The compressed notation (replacing a sequence of zeros with a double colon) is also applicable to the prefix representation. It should be used carefully, though, because there are often two or more ranges of zeros within an address, and only one can be compressed.
To play with the example in the previous section, check the following prefix notation. The address is 2001:DB8:0000:0056:0000:ABCD:EF12:1234/64, but now we're just interested in the prefix of the address. Lets find out whether the result is correct if we compress it as follows:
In order to verify this notation, we'll expand the address again. If we follow the notation rules, we end up with an address of 2001:DB8:0000:0000:0000:0000:0000:0056, with 2001:DB8:0000:0000 for the 64-bit prefix. So the compression leads to a wrong interpretation. It is not identical to the original address and prefix. To make sure the address interpretation is unambiguous, we have to note it as follows: