| IPv6 Network - Getting Started |
IPv6 Network - Getting Started
Later in this chapter, we’ll be enabling IPv6, but before that, it’s important to understand IPv6 addressing. This subject is somewhat more complex than IPv4 addressing. First of all, IPv6 addresses are written differently: as eight 16-bit hexadecimal values separated by colons rather than as four 8-bit decimal values separated by periods. A typical IPv6 address looks like this:
2001:db8:31:1:20a:95ff:fef5:246e
Note that leading zeros are usually left out. To cut down on unnecessary zeros even more, one (and only one) sequence of zero values separated by colons may be removed. So the address 2001:db8:31:0:0:0:0:1 may also be written as 2001:db8:31::1. The fact that the address is now composed of only four values indicates that four zero values were removed at the place of the double colon, so they can easily be reinstated when the address must be converted to the internal 128-bit representation. This “zero compression” makes the following shorthand perfectly legal:
:: (0:0:0:0:0:0:0:0), which is the unspecified address.
::1 (0:0:0:0:0:0:0:1), which is the IPv6 loopback address.
2001:db8:31:: (2001:db8:31:0:0:0:0:0), which is (almost) a regular address.
However, something like 2001:db8:31::5900::1 isn’t allowed, as there is no way to see that it is supposed to mean 2001:db8:31:0:5900:0:0:1 and not 2001:db8:31:0:0:5900:0:1. In this case, you should use either 2001:db8:31::5900:0:0:1 or 2001:db8:31:0:5900::1. To accommodate the cases where the bottom 32 bits of an IPv6 address represent an IPv4 address (see Chapter 6), an IPv6 address may be expressed as six hexadecimal values separated by colons followed by the last 32 bits in the shape of an IPv4 address, for instance:
2001:db8:31:0:5900:0:172.31.45.60.
IPv6 doesn’t use netmasks (a few exceptions prove the rule), but instead it uses the prefix notation that’s common in IPv4 routing as well. So when an Ethernet has the IPv6 address range 2001:db8:31:1:: to 2001:db8:31:1:ffff:ffff:ffff:ffff assigned to it, this is written as 2001:db8:31:1::/64. The “/64” means that the first (upper or left) 64 bits of the address are assigned by an authority of some sort, and the contents of the remaining bits (also 64 in this case) are assigned locally. The address part in a prefix must be a valid IPv6 address with all the bits that aren’t part of the prefix set to zero. So 2001:db8:31:1::/64 and 2001:db8:31:1::/127 are valid prefixes, but 2001:db8:31:1/64 or 2001:db8:31:1::/48 aren’t. In the first case, the address part isn’t a valid 128-bit IPv6 address; in the second case the “:1::” part falls outside the 48 prefix bits, so it should have been zero: 2001:db8:31::/48.
However, even though it isn’t a valid prefix,
2001:db8:31:1:20a:95ff:fef5:246e/64 is shorthand for “address 2001:db8:31:1:20a:95ff:fef5:246e in subnet 2001:db8:31:1::/64.”1 An address without a slash and a prefix value is always just an address, never a prefix or an address range. So 2001:db8:31::/48 is a prefix, but 2001:db8:31:: is an address that just happens to end in a lot of zero bits. See RFC 3513 for more information. Appendix A has more information on RFCs and how
to obtain them.
Tip Because the colon character is already used to separate the port number from the hostname or address in URLs, IPv6 addresses can’t be used in URLs (and many other places such as configuration files) as-is. Enclosing IPv6 addresses in brackets solves this problem. For example, a URL that points to the literal IPv6 address 2001:db8:31:2::1 would be http://[2001:db8:31:2::1]/ (RFC 2732). You may also encounter IPv4 addresses in this form, such as http://[192.0.2.1]/.
| Users' Comments (0) |
|
No comment posted







