Welcome to the IP address lesson. In this lesson you will learn how to dissect an IP address, and be able to convert binary to decimal and vice versa. This is going to be a great lesson where you really learn the ropes of IP addressing and get started with figuring out what all this binary stuff is and what it means and then we will do some practice exercises. Let’s go ahead and look at our agenda for this lesson. We’ll start out by discussing what binary digits are, we’ll do some eight bit binary to decimal conversions, and look at an entire IP address in binary format. This is super important for any network engineer or IT professional to know this stuff is the basis for a lot of what’s to come. Let’s look at some binary stuff.
Binary
By this point you’re probably thinking that binary is just kind of a series of ones and zeros that just goes from one host to another or just goes across your screen. Well, it is actually that binary is a mixture of ones and zeros that are flying across your screen and can mean some specific stuff. We will learn what those numbers actually mean, in regard to IP addressing and to reinforce your understanding of binary ones and zeros we need to know that a one or a zero is an on or an off. A one means on and a zeros means off. One means there is signal a zero means there is no signal. This may be something you know or don’t, but this is a cool little tidbit of information. If you look at a switch like on the back of your computer it may have a line and then a circle. This means on or off.
Let’s move on then and discuss what these ons and offs actually mean in more detail. Here in the diagram above we have the most important chart for IP addressing and subnetting that you can ever create. Understanding the numbers in the diagram is the way we can make our lives easy. What this chart represents is binary values. I’m going to put a placeholder for some digits. There are eight placeholders here, meaning that there are eight binary digits and we can fill these placeholders with either a zero or a one. Each one of these bit placeholders represents the number that’s above it in the chart that we wrote. We have some zeros and one one. I’m going to describe exactly what this calculates out to, but before we do that I want to make sure you understand that we’re looking at eight binary digits and these binary digits together are considered to be an octet.
An octet is eight binary digits. An IP address, network ID, and a subnet mask are all made up of four separate octets which are four separate groups of eight binary digits. If you multiply eight times four that gives you 32 so there’s a total of 32 binary digits. The point is we’re looking at an octet here and we are concerned with figuring out what this octet means. Each octet is built exactly the same way whether you’re talking about an IP address, and network ID, or a subnet mask. Starting at the right in the octet it goes from one then two then four the eight then sixteen and so on.
Previously we said a binary can be an on or off and that’s why we represent it with a one or zero so anywhere we have a zero we’re saying that this bit field is actually turned off or this bit is turned off. So 128 is turned off in this example, 64 is turned off, 32 is turned off all the way to two is turned off. The only thing here that’s turned on is the bit that is represented by the number one. What this means is that this entire octet turns from binary into a decimal one.
Let’s say we turn on the field under the four, it would actually be a five because the four will be turned on and the one would be turned on. Four plus one equals five.
IP address in binary
The next exercise is to look at an IP address in binary. For the example we are going to use the IP address 192.168.1.5 and if we break this out into binary we will have four different octets and we have four different sets of decimal numbers that translate to four different sets of binary digits.
Using our chart and looking at the 192 decimal value our goal is to figure out how to get 192 and if we add 128 and 64 we get 192. In decimal this would look like 11000000. Moving on to the second octet, what can we add up to equal 168? We can start with 128 because 168 includes 128, but then if we add 64 that would be too high and equals 192. Instead let’s add 32. 128 plus 32 equals 160, now all we need is to pop an eight in there. So it will be 10101000. Moving on to the third octet to get to 1 we would only need to turn on the one bit place value and moving on to the last octet, five. We can really quickly find out what five is. It’s just four plus one and it’s going to look like 00000101.
Conclusion
Pretty cool, right? This is binary and this is how we create our IP addresses. There’s a total of 32 binary digits that are broken up into four octets as we have seen. I hope you really enjoyed it and I’d like to remind you that if you’re truly serious about your career in Information technology, be sure to check out our career blueprint and engineer training program at www.zerotoengineer.com