Networking 101: Undressing IPv6 Addresses (Part 3 of 4)

So far, everything I’ve shared applies to IPv4 addresses.  There are actually two versions and IPv6 is the future.  Don’t ask me why the IETF skipped over IPv5, maybe they had a thing against odd numbers.

Anyway, in this guide we’re going to dive into the mysterious world of IPv6 addresses.

The reason we have IPv6 addresses is because a 32bit IPv4 address only gives the us 4.3 billion unique addresses.  You might think that’s a pretty freggin’ big number but when you consider that there are 7 billion humans on earth and each person has multiple devices connected to the internet, you’ll see why we are running out of IP addresses.  Every internet connected device needs an IP address.  Every router, smartphone, dropcam, chromecast and Kindle reader needs one.

The IETF recognized that the IPv4 address space was famished and very soon all unique addresses would be assigned.  IPv6 is the answer to our IP address problem.

Let’s talk about the bitastic world of IPv6!

Bountiful Bits

IPv4 is 32 bits long.  Since a bit has exactly two states, 32 bits gives us 4,294,967,296 possible values.

By contrast, an IPv6 is a whopping 128 bits long.

Haha, I don’t think you realize the stratospheric combinations we get with 128 bits.

I wonder heard someone say that we could assign a unique IPv6 address to every atom on the earth and still have enough left over for over 100 earths.

So we’re not running out of these anytime soon.  But in order to give us so many combinations, the IPv6 address is significantly loner than an IPv4 address.

Admittedly, no one has the time to write out 128 individual bits.  And even if we represented those bits in dotted decimal notation it would be extremely long.

Since each decimal number is 8 bits, a 128 bit IPv6 address in dotted decimal notation might look something like this:

192.34.32.234.34.56.23.120.3.23.5.255.2.56.67.23

Who the heck is going to use something like that?

So instead of using decimal numbers, IPv6 is represented in base-16 which is aptly called Hexadecimal.

Let me explain – this is actually really easy to understand.

Handling Hexadecimal

Before we embark on our voyage into the intimidating mountains of hexadecimal I want to a do a super quick review of something we all know: decimal: AKA base-10.

Let’s say we wanted to list the first 16 values in plain old decimal what would it look like?

  • 0
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

Now we’ve run out of unique symbols so how do we represent the next 6 numbers? How do we write numbers with values larger than 9?

We carry the 1 to the left and continue!

  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

These are the first 16 decimal values.  No confusion here.

What about binary?  What would the first 16 values look like in binary?  We’ll you know how to convert decimal numbers to binary now right?

  • 0000 0000 is o
  • 0000 0001 is 1
  • 0000 0010 is 2
  • 0000 0011 is 3
  • 0000 0100 is 4
  • 0000 0101 is 5
  • 0000 0110 is 6
  • 0000 0111 is 7
  • 0000 1000 is 8
  • 0000 1001 is 9
  • 0000 1010 is 10
  • 0000 1011 is 11
  • 0000 1100 is 12
  • 0000 1101 is 13
  • 0000 1110 is 14
  • 0000 1111 is 15

These are the first 16 values.  Since the first 4 bits are all zeros we could have just typed out the last 4 bits but I wanted you to see the whole thing.

So what about Hexadecimal?

  • 0
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

So far it looks identical to decimal but remember this is base-16, so we need 16 unique symbols to represent 16 distinct values. We just use the first 5 letters of the alphabet for values 10, 11, 12, 13, 14, and 15

  • A
  • B
  • C
  • D
  • E
  • F

That’s Hex for ya!

That’s all it is.  Nothing complicated here.

Hardy HEXamples

So let’s look at a number in hex.  Let’s say I gave you this number:

2015

It looks like a decimal number but it’s really in Hex; base-16.

So what does this mean?

Each character is 4 bits in length.

So the 2 is four bits.  The 0 is four bits.  The 1 is four bits.  The 5 is four bits.

  • 2 = 0010
  • 0 = 0000
  • 1 = 0001
  • 5 = 1001

So 2015 in hex is 16 bits long.  In IPv6 we separate groups of 16 bits with colons.

IPv4 used four dots to separate 8 bit decimal numbers.

IPv6 uses 8 colons to separate 16 bit hexadecimal numbers.

Here’s an example of a valid IPv6 address:

2015:0000:0000:0345:bce0:2341:3456:3400/64

Don’t panic you already know what this means:

  • 2015 is 16 bits long
  • 0000 is 16 bits long
  • 0000 is 16 bits long
  • 0345 is 16 bits long
  • bce0 is 16 bits long
  • 2341 is 16 bits long
  • 3456 is 16 bits long
  • 3400 is 16 bits long

16 x 8 = 128bits.  So there you have the full 128 bit address divided into 8, 16 bit chunks.

IPv6 host and network portions

The slash 64 at the end is just CIDR notation and tells us which part of the address designates the street and which part belongs to the house.

So /64 means the first 64 bits belongs to the street (the network) and the last 64 bits belongs to the house (the hostID).

2015:0000:0000:0345 is the network ID
bce0:2341:3456:3400 is the host ID (house number)

How to tell an IPv6 address she’s too freggin fat

So here’s the deal:

2015:0000:0000:0345:bce0:2341:3456:3400/64

is superior to

192.34.32.234.34.56.23.120.3.23.5.255.2.56.67.23

but it’s still pretty freggin’ long.

IPv6 addresses gives us an exorbitant amount of unique combinations so it means we probably won’t run out of IPv6 addresses ever but it also means the address is longer and a bit unwieldy.

Fortunately there are a few tricks we can do to shorten an IP address.

Here’s how to tell that pudgy IPv6 address to go on a diet…

  • One contiguous group of 0’s can be represented as a double colon ::
  • Leading zeros can get chopped off

So we can trim:

2015:0000:0000:0345:bce0:2341:3456:3400/64

into

2015::345:bce0:2341:3456:3400/64

It’s still long but its definitely shorter than the unabridged version!

The Bottom Line

Now you know the basics of IPv6 but get this:

I promise you that you’re going to forget it.  Yup.  Try telling what you read today to your boss tomorrow.  You’ll get nervious.  You’ll make mistakes.  You’ll be chagrined.

I’m not being negative; I’m being real.  People don’t just wake up one day understanding IPv6 – you have to practice.  The only reason why I know this stuff is because I’ve been using it for a long time.

And I think about it while on the crapper… but that’s another story…


 

So here’s what I need you to do:

Type ipconfig on your PC or ifconfig on your Mac and go hunting for IPv6 addresses.

Check out what shows up on my Mac.  I’ve got an interface named lo0 (my local loopback interface) with the following inet6 (IPv6) address:

inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1

Okay what the crap does this mean?

The inet6 means this is an IPv6 address.

fe80::1 is the actual address. Remember two colons can be substituted for consequtive zeros so fe80::1 is the short hand version of:

fe80:0000:0000:0000:0000:0000:0000:0000

the prefixlen 64 part means the first 64 bits (the prefix) belong to the mask.  So my lo0 interface is on this network:

fe80:0000:0000:0000; it’s obviously easier to use the abbreviations!

IPv6 AddressesThe same logic applies to my en0 interface.

fe80::6676:baff:fea4:d460%en0 prefixlen 64

This means the IPv6 address of my en0 interface (which happens to be my Wi-Fi adapter) is:

fe80:0000:0000:0000:6676:baff:fea4:d460

and the first 64 bits (prefixlen 64) belong to the network name (the street).  The last 64 bits belong to the host (the house number).

  • fe80:0000:0000:0000 is the network ID
  • 6676:baff:fea4:d460 is the unique identifier for my en0 adapter on the network.

I’m getting the feeling that you’re starting to get this stuff now.  Hit me up with some comments below if you have questions.

About

Connect with Vonnie on Twitter

Posted in Linux, Mac OS X 10.10 Yosemite, Mac OS X 10.8 Mountain Lion, Mac OS X 10.9 Mavericks, What Is, Windows, Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Vista, Windows XP Tagged with: , ,
  • Tcat Houser

    What happened to TCP/IP V5 was there we’re multiple really good ideas proposed. And not one of them to talk to the other 2 heavy contenders. So IETF took the best of the top three contenders and smashed all into IPNG (IP V6).