Join Mike Meyers for an in-depth discussion in this video Introduction to IP addressing and binary, part of CompTIA Network+ Exam Prep (N10-006) Part 3: The World of TCP/IP.

- This is a typical IP address. Odds are good you've probably seen one of these. They show up all over the place on our computers. Every computer on a TCP/IP network must have a unique IP address. IP addresses are distinct in that it's gonna be four values separated by three dots. Well, I've got a little bit of interesting news for you. This is actually a lie. A real IP address is nothing more than 32 ones and zeros. That's it, just ones and zeros, on and offs. Pulses of electricity or light, whatever it might be.

But to show you that, I've decided I'd like to play Go, so I got a Go game out and I'm gonna represent zeros with little white beads and I'm gonna represent ones with black beads. So, what I have here in front of me is a real IP address. This is 32 ones and zeros. And, what we need to do in this episode is understand how we can take ones and zeros and convert 'em into something like this. So, to do that, the first thing you need to appreciate is that there really are no dots.

Dots don't exist in IP addresses. They're really just separators. I mean, here's a phone number right here. Now if you take a look at this phone number, would you actually dial an open parenthesis and a closed parenthesis, and a dash as part of your dialing process on a phone? Of course not. The reasons those are there on a phone number is because human beings need to be able to use telephones and they're used as separators. So it's really the same thing with IP addresses. In order to go from this down to this, we're gonna have to go through a process. Let me show you how this works.

The first thing you wanna do is if you have 32 ones and zeros, we're gonna break them up into four groups of eight. I'm just gonna separate these with my hand. And there's no particular reason for separating them into four groups of eight, other than it was chosen arbitrarily as a good way to do this. I'm gonna artificially separate them a little bit so we can see it a little bit better. Now, I've got four groups of eight here. If you have eight ones and zeros, you could have all zeros.

Here we have all zeros. Or, you could have all ones. Or, we could have a whole bunch of combinations in between like this is one possible combination between all zeros and all ones. This is another possible. This another possible combination. So is this.

And this is one as well. The whole idea behind dotted-decimal notation is that instead of us having to say things like, my IP address is, 001001001001001 and cause that's really hard to type into a computer, the dotted decimal notation is nothing more than a shortcut, a shorthand, that we use to represent 32 ones and zeros in a row. By breaking them into groups of eight, we can have different combinations anywhere from all zeros to all ones with a bunch of combinations in between.

There are exactly two to the eighth, or 256 combinations. Now in the IP world, we start with zeros, so it's zero to 255 and that's where IP addresses come from. It's simply taking eight ones and zeros and converting it into a value that goes between zero and 255. The secret to converting to binary to dotted-decimal is to take a piece of paper and remember one number. Remember 128. If you can remember that number, you can covert this very, very easily and you're gonna have to do this on the Network+ by the way.

If you could remember the number 128, you take a piece of paper and in the upper left hand corner, you write in 128 and then you take half of that. Then half, then half, then half, then half, then half, then half. If you take a look we've got one, two, three, four, five, six, seven, eight locations. Got it? All right, so. Once you've got this little cheat sheet, let's go ahead and pick a value. What I'm gonna do is 1100 0101 So just like that. Let's go ahead and do that.

Now I'm gonna use beads, but on your piece of paper, you could just write ones and zeros directly underneath each of these letters. zero, one zero, one 110 00101, okay. Now, what you have to do at this point is simply take a look and wherever you have a one, you add those values together. Let's go through the math here. 128, we got a one there, so that gets added.

Plus 64 is 192. Now we don't add any of these because these are all zeros. Plus 4 is 196. We don't add the two because that's a zero. Plus one is 197. Congratulations. You've just converted 11 0 0 01 0 1 into the dotted-decimal notation of 197. Perfect. That's great, but let's do it a few more times to make sure you get the idea.

I'm gonna pick another value. In this case, I'm gonna pick zero, zero, zero, zero, one, one, one, zero Now again, you could just write ones and zeros on the piece of paper to do this for yourself, but let's go through the process. Now remember if it has a zero underneath it, we don't add it, so we'r not gonna add 128. We're not gonna add 64. We're not gonna add 32. We're not gonna add 16 or 1.

It's only these three values. 8 + 4+ 2 = 14. 00001110 = 14 as an octet. Fantastic. Let's try it one more time and again, I'm just gonna pick an arbitrary value. So this time, I'm gonna do 10101010. And again, you could write ones and zeros underneath your piece of paper to do the exact same thing I'm doing with my Go beads.

Here we go. First, we'll get rid of the zeros. We're gonna add 128 + 32 and that's 160 Plus 8 equals 168. Plus 2 equals 170. 10101010 = 170. Fantastic. Now there's a couple of these after you look at these for a while, you start to notice certain things.

For example, if these were all zeros like that then the answer is going to be zero. Equally, if it's all ones, it's 255. It's important that you should be able to recognize some of these binary values and instantly be able to convert it into an octet.

All zeros is zero, all ones is 255. If you have just a one followed by seven zeros, that's gonna be 128. If you have seven zeros with just a one, that's one. That's all you need to do to take any binary value and convert it into an octet. If you remember 128, it's real easy to do.

Let's go ahead and reverse the process. Now what I'm gonna do is I'm gonna give you an octet value and I need you to be able to convert it into binary. Don't worry, we still use the exact same tool. Just remember 128. Okay, so I've got my little piece of paper with the 128 all the way down to the one again, so let's go ahead and do a couple of examples. Let's start off with, I'll pick an arbitrary value here between zero and 255. Let's do 171. To do that, let's go through the process.

To make this happen, you start with your initial value, 171, and you start on the left and you march over to the right. How many 128s are there in 171? Well there's exactly one, so we'll put a one bead there. And we subtract 128 from 171 and we get the remainder of 43. Now we march down to the next one. How many 64s are there in 43? Well 64 is bigger than 43, so it's zero. Then we go to the next value.

32. How many 32s are there in 43? Well, there's exactly one and we go ahead and do the subtraction. We have 43 minus 32 and we have 11. We keep carrying that 11 along as we go. How many 16s are there in 11? Well, it's bigger than 11, so there's zero. We come to the next value, 8. How many eights are there in 11? There's exactly one. Leaving remainder of three. How many fours are there in three? Zero.

How many twos are there in three? One. And then, that leaves a value of one. How many ones are in one? One. (laughing) That's exactly how we go through the process. We've taken 171 and we've converted it into 10101011. Fantastic. Let's try it again. This time I'm gonna pick another arbitrary value. You guys get in the right place. And this time, we're gonna use the value 224. Let's go through the process.

We start with 224. How many 128s are there in 224? There's exactly one. And that leaves a value of 96. How many 64s are there in 96? There's exactly one. That leaves us the value of 32. We go ahead and take the 32, how many 32s are there in 32? There's exactly one and now we're done. All we have to do is throw zeros in for the rest because we don't have any remainder left to deal with.

224 equals 11100000. Perfect, let's do it one more time. This time let's pick the value 95. We'll start on the far left hand side. How many 128s are there in 95? Well, 128's bigger than 95, so there's zero. So now we have 95. How many 64s are there in 95? There's just one. 95 minus 64 equals 31.

How many 32s are there in 31? 32's bigger than 31, so zero. How many 16s are there in 31? Exactly one. And after we do the subtraction, we have exactly 15. Let's move down to the eights. How many eights are there in 15? There's one. We do the subtraction and now we have seven. How many fours are there in seven? One, we do the subtraction and now we have three. How many twos are there in three? One, we do the subtraction, now we have one.

And then we put a one on the end. So we have just converted 95 into the binary value 01011111, Fantastic. It's really important that you know how to convert binary to octets and octets to binary. Now just for the Network+, but for the real networking world. Keep in mind, I've shown you how to do it by hand, but in reality, we'll use things like Windows calculator. There's apps that you can put on your phone that'll allow you to do this conversion very, very quickly and easily, so for the test, do it by hand, but in the real world, use a calculator.

###### Released

7/28/2015*CompTIA Network+ All-in-One Exam Guide, 6th edition*. This course covers the basics of TCP/IP and an overview of routing.

We are now a CompTIA Content Publishing Partner. As such, we are able to offer CompTIA exam vouchers at a 10% discount. For more information on how to obtain this discount, please download these PDF instructions.

## Share this video

## Embed this video

Video: Introduction to IP addressing and binary