|
Notation and Masking Basics
IPv6 addressing works essentially like IPv4. There are an address and a mask, the mask being used to determine network boundaries; only the length of the numeric address and its representation differ. IPv6 addresses are 128 bits (16 bytes) to IPv4's 32 bits (4 bytes), and v6 addresses are represented as colon-separated, two-byte words in hexadecimal rather than as period-separated bytes in decimal. Additionally, IPv6 netmasks are represented in "slash" notation (a forward slash followed by the number of bits in the mask) rather than as an additional IP address (such as the familiar 255.255.252.0 in the IPv4 world).
Example IPv6 address: fec0:0:3:1ad3:0:0:23:a/64
The address is everything before the slash, and the number following the slash is the "length" of the subnet mask, the number of bits that are set to 1. As with IPv4, the 1 bits are all consecutive and high-order: the first 0 bit follows the last 1 bit. So the the first 64 bits (or 8 bytes) are fec0:0:3:1ad3, the network part of the address, and the host part is 0:0:23:a.
IPv4 networking makes use of "network addresses" and broadcast addresses
(host address bitwise-ANDed with the netmask or bitwise-ORed with the inverse of
the netmask, respectively). Because there is no broadcasting in IPv6, only
multicasting (which, as in IPv4, is done in its own address space separate from unicast
addresses), there is no need to reserve an address on each subnet for a
broadcast address. The smallest possible IPv4 subnet consists of four
addresses—network, two hosts, and broadcast—and has a 30-bit mask
(255.255.255.252) out of a 32-bit address. The smallest-possible
multi-host IPv6 subnet consists of only two addresses, those of the hosts that
occupy it. The corresponding netmask would be 127 bits out of a 128-bit address,
and in the case of a 127-bit netmask, the network address is also a valid
unicast address.
Abbreviation and Compression
It is possible to abbreviate addresses. You may have noticed that leading zeroes in words are often omitted. Additionally, all-zero words may be compressed between two consecutive colons.
Uncompressed: fec0:0:3:0:0:0:23:a
Compressed: fec0:0:3::23:a
An address may be compressed only once. fec0:0:0:3:0:0:a:3 may be compressed to either fec0::3:0:0:a:3 or fec0:0:0:3::a:3, but it may not be compressed to fec0::3::a:3, as it is then impossible to determine how many all-zero words have been compressed into each pair of consecutive colons. For addresses that begin or end in all-zero words, the leading or final zero(es) may be omitted (for example, ::1 or fec0:0:3:1ad3::).
Types of Addresses
There are three types of IPv6 unicast addresses: link-local, site-local, and
global.
Link-local addresses are automatically configured when IPv6 capability is
enabled on an interface. Such an address is always in the network
fe80::/10 and has the interface's MAC address encoded in the
lower 64 bits. This address is used for various types of communication between
devices on the same subnet. You may notice, for example, that when a host
learns a default inet6 route via router advertisement, that route's next hop
is the router's link-local address, not its global address. As the name
implies, packets with link-local source addresses will never be routed between
networks. See RFC 2464,
sections 4 and 5, for information on how a link-local address is formed on an
ethernet network using EUI-64 encoding.
Site-local addresses are analagous to IPv4's RFC1918 addresses
(10.0.0.0/8, 172.16.0.0/12,
192.168.0.0/16). They may be routed within an organization but
cannot be expected to be globally unique. At MTU, these addresses should only
be used when implementing IPv6 on a private VLAN. The site-local address range
is fec0::/10.
Global addresses are, of course, intended to be globally unique. MTU is the
only organization in the world with addresses starting with
2001:48a8:0000 through 2001:48a8:00ff. |