Internet Protocol version 6 (IPv6) is the most recent version of the Internet Protocol (IP) which was developed by the Internet Engineering Task Force (IETF) to deal with the long-anticipated problem of IPv4 address exhaustion. IPv6 is intended to replace IPv4.
IPv6 uses a 128-bit address, theoretically allowing 2128, or approximately 3.4×1038 addresses. The actual number is slightly smaller, as multiple ranges are reserved for special use or completely excluded from use. The total number of possible IPv6 address is more than 7.9×1028 times as many as IPv4, which uses 32-bit addresses and provides approximately 4.3 billion addresses. The two protocols are not designed to be interoperable, complicating the transition to IPv6. However, several IPv6 transition mechanisms have been devised to permit communication between IPv4 and IPv6 hosts.
IPv6 addresses are represented as eight groups of four hexadecimal digits with the groups being separated by colons, for example 2001:19f0:6000:8f2a:5400:ff:fe20:ad5e, but methods to abbreviate this full notation exist.
The IPv6 addresses are made up of three parts:
- The provider-assigned prefix (48 Bit)
- The site prefix (16 Bit)
- The interface or host ID (64 Bit)
The Provider-assigned Prefix
The provider-assigned prefix, also called the global address space, is a 48-bit prefix. It's consist of three parts:
- The 16-bit reserved IPv6 global prefix
- The 16-bit provider-owned prefix
- The 16-bit provider-assigned prefix
The global prefix is used for representing the IPv6 global address space, where Internet addresses range from 2000::/16 to 3FFF::/16. The remaining IPv6 range is reserved or has "special" uses.
The provider-assigned prefix are provider-owned IPv6 prefix which is assigned to ISPs by IANA and ranged from 0000::/32 to FFFF::/32. And the next 16 bits are assigned to an organization by the ISPs, which is ranged from 0000::/48 to FFFF::/48.
The first 48-bit in the IPv6 address is displayed in the figure below.
The Site Prefix
The following 16 bits after the provider-assigned prefix is the site prefix. That is, there're 264 addresses in each site.
IPv6 Address representation
The 128 bits of an IPv6 address are represented in 8 groups of 16 bits each. Each group is written as four hexadecimal digits and the groups are separated by colons (:). An example of this representation is 2001:19f0:6000:8f2a:5400:ff:fe20:ad5e.
For convenience, an IPv6 address may be abbreviated to shorter notations by application of the following rules.
- One or more leading zeroes from any groups of hexadecimal digits are removed; this is usually done to either all or none of the leading zeroes. For example, the group 0042 is converted to 42.
- Consecutive sections of zeroes are replaced with a double colon (::). The double colon may only be used once in an address, as multiple use would render the address indeterminate. RFC 5952 recommends that a double colon must not be used to denote an omitted single section of zeroes.
An example of application of these rules:
- Initial address:
- After removing all leading zeroes in each group:
- After omitting consecutive sections of zeroes:
The loopback address,
0000:0000:0000:0000:0000:0000:0000:0001, may be abbreviated to
::1 by using both rules.
As an IPv6 address may have more than one representation, the IETF has issued a proposed standard for representing them in text.
The Different IPv6 Address Types
An IPv6 address consists of 128 bits. Addresses are classified into various types for applications in the major addressing and routing methodologies: unicast, multicast, and anycast networking. In each of these, various address formats are recognized by logically dividing the 128 address bits into bit groups and establishing rules for associating the values of these bit groups with special addressing features.
From IPv4, you might know APIPA (Automatic Private IP Addressing) or AutoNet. Whenever automatic IP configuration through DHCP fails, Windows automatically assigns an autoconfiguration address in the range 169.254.0.1 to 169.254.255.254, which allows the computer to communicate with other machines on the link. In IPv6, link-local addresses always begin with FE80::/10 (1111 1110 10) and the interface identifier in the modified EUI-64 format. EUI-64 format address is obtained through the 48-bit MAC address. The MAC address is first separated into two 24-bits, with one being OUI (Organizationally Unique Identifier) and the other being NIC specific. The 16-bit 0xFFFE is then inserted between these two 24-bits for the 64-bit EUI address.
Unlike IPv4, IPv6 requires a link-local address on every network interface on which the IPv6 protocol is enabled, even when routable addresses are also assigned. These addresses refer only to a particular physical link and are used for addressing on a single link for purposes such as automatic address configuration and neighbor discovery protocol, as well as for some other IPv6-based protocols, such as DHCPv6. Link-local addresses can be used to reach the neighboring nodes attached to the same link. The nodes do not need a globally unique address to communicate. Routers will not forward datagram using link-local addresses.
Site-Local Addresses and Unique Local Addresses
A site local address is an IPv6 address in the block
fec0::/10. It is the approximate IPv6 counterpart of the IPv4 private address. Unique local addresses are available for use in private networks, e.g. inside a single site or organization or spanning a limited number of sites or organizations. They are not routable in the global IPv6 Internet. Anyway, it makes NAT possible in IPv6 though it's not encouraged. Because there're much larger IPv6 addresses.
Despite this, RFC 3879 appeals against site local address. And unique local addresses (ULA) was defined in RFC 4193, reserving the address block
fc00::/7 for use in private IPv6 networks and defining the associated term unique local addresses.
The address block
fc00::/7 is divided into two /8 groups:
- The block
fc00::/8has not been defined yet. It has been proposed to be managed by an allocation authority, but this has not gained acceptance in the IETF. This block is also used by the cjdns mesh network.
- The block
fd00::/8is defined for /48 prefixes, formed by setting the 40 least-significant bits of the prefix to a randomly generated bit string. This results in the format fdxx:xxxx:xxxx:: for a prefix in this range. RFC 4193 offers a suggestion for generating the random identifier to obtain a minimum-quality result if the user does not have access to a good source of random numbers.
As an example, a routing prefix in the
fd00::/8 range would be constructed by generating a random 40-bit hexadecimal string, taken to be
e48dba82e1 in this example. The string is appended to the
fd00::/8 prefix. This forms the 48-bit routing prefix
fde4:8dba:82e1::/48. With this prefix, 65536 subnets of size /64 are available for the private network:
Aggregatable Global Unicast Addresses
A global unicast address is simply what we call a public IP address in IPv4—that is, an IP address that is routed across the whole Internet. You can make out a global unicast address easily: The first three bits are set to 001. Thus, the address prefix of a global IPv6 address ranges from
2000::/3 to 3FFF
As mentioned above, global unicast address consists of three parts: the 48-bit provider-assigned prefix, the 16-bit site prefix, and the 64-bit interface or host ID. And there're three subnets in aggregatable global unicast addresses:
2001::/16is the prefix for unicast in global IPv6 Internet.
2002::/16is reserved for 6to4 which is an Internet transition mechanism for migrating from IPv4 to IPv6, a system that allows IPv6 packets to be transmitted over an IPv4 network (generally the IPv4 Internet) without the need to configure explicit tunnels.
- 3FFE::/16 is the prefix for 6bone which was a testbed for Internet Protocol version 6.
IPv6 supports the use of multicast addresses. The multicast address identifies a multicast group, which is a group of interfaces, usually on different nodes. An interface can belong to any number of multicast groups. If the first 16 bits of an IPv6 address is ff00n, the address is a multicast address.
Multicast addresses are used for sending information or services to all interfaces that are defined as members of the multicast group. For example, one use of multicast addresses is to communicate with all IPv6 nodes on the local link.
When an interface's IPv6 unicast address is created, the kernel automatically makes the interface a member of certain multicast groups. For example, the kernel makes each node a member of the Solicited Node multicast group, which is used by the Neighbor Discovery protocol to detect reachability. The kernel also automatically makes a node a member of the All-Nodes or All Routers multicast groups.
The following is a summary of the contents of each field.
- 11111111 – Identifies the address as a multicast address.
- FLGS – Set of the four flags 0,0,P,T. The first two flags must be zero. The P field has one of the following values:
- 0 = Multicast address that is not assigned based on the network prefix
- 1 = Multicast address that is assigned based on the network prefix
- If P is set to 1, then T must also be 1.
- Reserved - Reserved value of zero.
- Plen - Number of bits in the site prefix that identify the subnet, for a multicast address that is assigned based on a site prefix.
- Group ID - Identifier for the multicast group, either permanent or dynamic.
For complete details about the multicast format, refer to RFC 3306, "Unicast-Prefix-based IPv6 Multicast Addresses.
An anycast address is an address that is assigned to a set of interfaces that typically belong to different nodes. A packet sent to an anycast address is delivered to the closest interface (as defined by the routing protocols in use) identified by the anycast address. Anycast addresses are syntactically indistinguishable from unicast addresses, because anycast addresses are allocated from the unicast address space. Assigning a unicast address to more than one interface makes a unicast address an anycast address. Nodes to which the anycast address is assigned must be explicitly configured to recognize that the address is an anycast address.
The anycast address has a prefix concatenated by a series of zeros (the interface ID). The subnet device anycast address can be used to reach a device on the link that is identified by the prefix in the subnet device anycast address, such as
::1/128 is the loopback address of the local host which is the equivalent of the 127.0.0.1 in IPv4. When an application in a specific host sends a data packet to this address, the TCIP/IP stack will loop the packet back on the same interface it was sent to so the packet never exits that host.
This type of address is mostly used for testing the TCP/IP stack as it only exists on that host and can't be reached by any other host on the network.
The first 127 bit of the loopback address is set to all 0's and the last bit set to 1 resulting an IP address that takes the form of 0:0:0:0:0:0:0:1:/128 or ::1/128 for short.
All 128 bit of the of an unspecified address is set to all 0's resulting an IP address that takes the form of 0:0:0:0:0:0:0:0:/128 or ::/128 for short.