How To Simplify IPV6 Addresses And How To Revert Them Back To Their Original Forms

Quoting from Wikipedia:

IPv6 addresses are written in eight groups of four hexadecimal digits separated by colons, for example, 2001:0db8:85a3:0000:0000:8a2e:0370:7334. IPv6 addresses are logically divided into two parts: a 64-bit (sub-)network prefix, and a 64-bit interface identifier.  Source:  http://en.wikipedia.org/wiki/IPv6

As you can see, when everyone is fully switching over to IPV6, the IP addresses of IPV6 have to be grouped in 8 groups of four hexadecimal digits.  It’s a lot longer than the IPV4.  Also, you can simplify the IPV6 addresses by replacing the groups that has four zeros with two colons (i.e, ::), but you cannot do that more than one time.  We can also call two colons simply as a double colon.  OK, to be crystal clear, I mean you can only simplifying IPV6 addresses’ contiguous groups of four zeros with double colon one time only.  To make this even more clear, I show you some examples:

Example #1 ~ Simplifying:  2001:0db8:85a3:0000:0000:8a2e:0370:7334 — Correct:  2001:odb8:85a3::8a2e:0370:7334 — Incorrect:  21:db8:85a3::8a2e:37:7334

Example #2 ~ Simplifying:  2001:0000:85a3:0000:0000:8a2e:0370:7334 — Correct:  2001:0000:85a3::8a2e:0370:7334 — Incorrect:  2001::85a3::8a2e:0370:7334

The examples above point out that only contiguous groups of four zeros of IPV6 addresses can be replaced by one double colon (i.e., two colons).  Why is that?  It’s because when one wants to reverse the simplified examples back into the original forms, using the double colon once in the IPV6 simplifying process helps one figures out the original forms of IPV6 addresses easier.  To figure out how to do just that, one needs to count the available groups, use 8 groups minus the available groups, and time that by 16.  Why you have to time 16?  Each group of IPV6 addresses represents 16 bits.  The total bits for IPV6 addresses equate to 128 bits — take eight groups time 16 bits.

An example of how to revert the simplifying form of IPV6 address back into its original form ~ Simplifying form:  2001:odb8:85a3::8a2e:0370:7334 — We can see that there are 6 original groups and a double colon (i.e., two colons), the math is going to be ((8-6)*16) which equates to 32 bits that are being simplified.  Also, we can just use (8-6) and we know there are two groups that are being simplified — that translates into two groups of contiguous groups of zeros, so we just need to replace the double colon with 16 bits of zeros per group (i.e., 0000:0000).  The original form of this specific IPV6 address is 2001:odb8:85a3:0000:0000:8a2e:0370:7334.

Why IPV6 addresses have 128 bits?  IPV6 addresses have bigger bits in total to allow more groups of bits to be arranged in unique orders so we can have larger range of IP addresses than IPV4 addresses.  After all, IPV4 addresses have only 32 bits.

Sometimes, you’ll see geeks who wear t-shirts that say ::1, but you don’t know the meaning of that.  ::1 means it’s an IPV6 Loopback address.  Remember, IPV4 has several Loopback addresses too, and those are 127.0.0.1 and whatever addresses in the range of 127.0.0.0 – 127.255.255.255.  What are Loopback IP addresses?  These Loopback IP addresses won’t route your data outside of your local network, because these IP addresses are special IP addresses that meant to be used locally only.  For IPV6, it has only one Loopback IP address which is 0:0:0:0:0:0:0:1, and we can simplify it down to ::1 (i.e., replacing all contiguous groups of zeros with a double colon).  Now when you see a geek who wears a t-shirt that says ::1, you’ll know what it means!

2 thoughts on “How To Simplify IPV6 Addresses And How To Revert Them Back To Their Original Forms

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.