Getting Started with IPv6
April 3, 2011 Leave a comment
IPv6 is coming – traffic is a trickle but steadily increasing and smart wager is on demand, for relevant skills and technologies, to grow to drive IPv6 in the network. This entry is for those starting their IPv6 journey.
- Here I have included
- Explanation of key concepts of IPv6 address architecture.
- Some useful IPv6 resources on the web.
IPv4 address exhaustion has long been expected but there were doubters, even conspiracy theorists, passionately arguing that there were plenty of IPv4 addresses to last a long long time, perhaps forever. While networking community has developed ingenious ways to prevent sudden exhaustion of IPv4 address, the demand for connectivity and new addresses shows no sign to stop or even slow down.
Google regularly collects IPv6 adoption data, which shows healthy growth rate. Signs are pretty clear that network engineers will need to know IPv6 and a good place to start is IPv6 addressing so let us take a quick look at how to work with IPv6 addresses.
IPv6 Address Representation
The most obvious difference between IPv4 and IPv6 is the size of the IPv6 address space, which is 128 bits as oppose to 32 bits for IPv4. Without doing the counting or estimating in terms of number of grains of sand on the planet, one can safely say that the size of IPv6 address pool is, huge! even astronomical. Let’s look at an IPv6 address, in binary form
For an address so long a text representation that is easy to read, document or use in CLI is an important consideration so format of the IPv6 address is an integral part of the IPv6 address architecture described in RFC 4291, aptly titled “IP version 6 Addressing Architecture”.
- Following is a list of rules to represent an IPv6 addresses:
- 8 fields of 16-bit each and separated by a colon, ‘:‘.
- Fields are hexadecimal numbers – don’t panic! it looks scary in exam situations but it is not … more on this shortly.
- Leading zeros in each field are optional.
- Optionally, an address can be compressed that allows one (and only one) set of consecutive fields of zeros to be replaced by a ‘::’.
- Prefix length is indicated by a ‘/’ then a decimal number, between 0 and 128, following the address, the familiar CIDR format.
Let’s take the bull by the horns and deal with the business of hex to binary conversion. It is easier than you might think. This is because 16 is a power of 2, i.e. 24 = 16, which leads to a simple trick to transform hex representation to binary form or bits:
Each hexadecimal digit can be converted to a 4-bit binary number. Just as binary system has two digits [0, 1] and decimal system has ten digits [0, .., 9], hexadecimal system has sixteen digits [0, .., 9, a, .., f]. So to convert a hex number to its binary form simply replace each hex digit by its 4-bit binary representation.
Basically if you know the binary equivalent of the 16 hex digits you will be able to convert hex to binary with ease. An excellent blog entry that explains practical hexadecimal skills by Jeff Doyle is highly recommended.
If we apply the IPv6 address representation rules to the binary address in figure 1 we get a far more readable form. Figure 2 shows the the 32 hex-digits in 8 fields. The striped table is for convenience to highlight sets of 4 bits and hex equivalent.
We can compress the address by using ‘::’ to replace one or more consecutive zero fields, fields 3 and 4 in this instance, and dropping leading zeros in each field. To illustrate the last rule about subnet prefix, suppose in the above example 60 most significant bits are the subnet address then we could write the compressed form including prefix length as below
Note: Mask length of 64 is generally considered best practice, which is the default and enables useful features of IPv6 protocols but beyond the scope of our topic here.
IPv6 Address Types
RFC 4291 defines 3 types of addresses
- Unicast: An identifier for a single interface. Majority of the IPv6 address space is for unicast addresses.
- Multicast: An address for multiple interfaces, usually on different nodes. Traffic addressed to a multicast address is routed to all the interfaces with that address.
- Anycast: An address attached to mutiple interfaces, usually on different nodes. A packet destined for an Anycast address would be delivered to the nearest interface with the address.
Unicast have different subtypes and Multicast address have flags and scope over which a multicast group is configured. IPv6 Address page on Wikipedia has a good description various types on IPv6 address and most significant bit values that are used to identify address type.
Finally, Netmatics IPv6 calculator is an online tool that calculates IPv6 address prefix and does binary-hex conversions.