IP version 6 addresses, IPv6 for short, are almost here and sooner or later you will need to learn everything there is to know about them. In addition to the IPv6 address format you will also need to learn how to covert an IPv4 address into IPv6 and vice versa.
I will try to make your life a little easier by introducing the idea of IPv6 to you. I will show you the IPv6 format, talk about compressions that you can use, and show you how to convert IP version 6 address into IPv4.
Let’s start with simple explanation of the new format. As you may know, the new-generation-IP talk started in the early 1990s when we were slowly running out of IP addresses. We had quite a few proposals for the new address format but in 1995 IPv6 was selected and the RFCs were officially entered into the RFC repository.
IPv6 was created based off of IPv4 with some of the useful IPv4 features carried over to IPv6. There were many changes to the new IP format, however, and I will list some of them here below.
- Expanded Addressing Capabilities: IPv6 address size increased from 32 bits to 128 bits. Because of the increased size the new address will support a higher number of nodes, more levels of addressing hierarchy, and a much simpler autoconfiguration of addresses for remote users. A new address type was created, called anycast.
- Header Format Simplification: To simplify the entire IP format, some of the IPv4 header fields were dropped or made optional in IPv6.
- Flow Labeling Capability: There is a new quality-of-service (QOS) capability that enables the labeling of packets belonging to particular traffic “flows” with special handling, such as real-time service.
- Authentication and Privacy Capabilities: There are new built-in extensions to support security options
Here is an example of an old and new addressing scheme:
Old – IPv4 address: 188.8.131.52
New – IPv6 address: 1029:9183:81E2:0000:0000:01D5:2115:019B
As you can see the new generation IP address is quite different from what we are used to. The IPv6 address is in a hexadecimal format. The only good thing in the IPv6 address format is that we can use compressions. There are rules, however, on how and when to use them.
If you have consecutive fields of zeroes in the IPv6 address, you can express them with two colons.
It does not matter if you have two, three, four or eight fields of zeros, you can simply type two colons next to each other and that will represent all the consecutive zeros fields. These fields of zeros must follow each other.
A very important key to this rule is that you can only use that compression once in an IPv6 address. For example:
Original IPv6 format: 1234:1234:0000:0000:1234:0000:0000:1234
Using zero compression: 1234:1234::1234:0000:0000:1234
Notice how I used zero compression only ONCE in this example. Writing this address like this:
would make this address incorrect and every router would give you an error.
Leading Zero Compression
In a leading zero compression you can drop leading zeros in an address, in any field, as long as there is at least one number left. What that means is that if the address field is all zeros, you must leave at least one zero in that field. Here is an example:
Original IPv6 format: 1234:0000:1234:0000:1234:0000:0123:1234
Using leading zero compression: 1234:0:1234:0:1234:0:123:1234
You can also combine these compressions and use them together in an address:
Original IPv6 format: 1234:0000:0000:1234:0002:0033:0012:0123
With both compressions: 1234::1234:2:33:12:123
(zero and leading compression)
Zero Compression uses the double-colon to replace the second and third block of numbers, which were all zeroes. Leading zero compression replaces the “0s” at the beginning of each of the last four blocks. Just be careful and take time when using both zero compression and leading zero compression. They key is to remember that you can use zero compression only once in a single IPv6 address.
IPv6 to IPv4 conversion
- Lets start with an IPv6 address that can be converted to IPv4:IPv6 address: ::D190:4E71 – the double colon is zero compression
- Since the IPv6 is in a hexadecimal format we will start with the first number, which is D1 and convert that into decimal. In hexadecimal D=13 and 1=1, so we have:D1 – 13 units of 16 and 1 unit of 1 = 209
- The second number is: 90. Therefore we have:90 – 9 units of 16 and 0 units of 1 = 144
- Next number is: 4E.4E – 4 units of 16 and 14 units of 1 = 78
- And the last number: 71.71 – 7 units of 16 and 1 unit of 1 = 113
- IPv4 address after conversion is: 184.108.40.206