From the course: Learning Subnetting

IPv4 address formatting

- [Instructor] Let's get started with our discussion of a IPv4 subnetting by considering the format of an IPv4 address. It really reminds me of a street address, let's say that somebody gave you their address and it looked like this, 27837th Street. Huh, what exactly does that mean? We're not sure because there's no space between the house number and the street number. That could mean 278 37th Street, or if we put the space in a different spot, it could mean that they live at 2783 7th Street. Which is it? We don't know because we don't know where that dividing line lives. Well, we have a similar paradox in the IPv4 addressing world. If we're given an address like this, 10.1.2.3, there's only two parts to it. There's a part of that address that references the host, the device on the network, and the other part of the address references the network or the subnet itself. So two different parts, we've got a network portion of the address, that's the first part, and then we've got the host portion of the address, that the last part, but we don't know where the network stops and host starts, so let's break it down and see how we can determine where to draw that dividing line. First, I want you to notice how this is written. It's 10.1.2.3, you notice the dots? This is called a dotted decimal notation. We've got four different fields, each field is separated by a dot, and there are eight binary bits in each field, as a result, we say that each field is an octet, we've got four octets. So, how many bits total? Does that mean that an IPv4 address has eight times four? That's 32, we've got a 32 bit address, and it's often beneficial, and we'll do that a lot in this course, it's often beneficial to write an IP address in binary, and that's what we're going to do here. We're going to take each of these individual octets and individually represent them as binary numbers. Now, if you already know how to do decimal to binary conversion, if you already knew that a 10 in decimal was 00001010 in binary, awesome, you've got a head start! If that's a foreign concept to you, no worries because we're going to definitely cover binary conversion to decimal, and decimal conversion to binary, so we'll cover that in this course, but for now, just know that a 10 in decimal looks like four zeros and then 1010 in binary, and I've also written out the other numbers, the one, the two, the three, those are their representations in binary, as well. Now, here's the key to determining where the network portion the address stops and the host portion starts. It's something called the subnet mask, and if you look at that subnet mask in binary, it's a series of ones followed by series of zeros. In this case, we have eight ones followed by, if you add 'em up, 24 zeros. Now a subnet mask is always going to have this basic structure, in other words, it's going to start with consecutive ones, and it's always going to end with consecutive zeros, if there are any zeros, it might just be all ones, but typically, we have contiguous ones followed by contiguous zeros, we just don't know how many ones we have. In this case, we have eight, and notice that for each of our IP address binary bits, there's a corresponding subnet mask binary bit, and any time that there is a one in the subnet mask bit, the corresponding IP address bit is part of the network address. That means, in this instance, the first eight bits are network bits, the last 24 bits are host bits, that tells us where we draw the dividing line. So, when we're writing out this IP address, if we just did what we did earlier and say, it's 10.1.2.3, that's not a lot of information. That's the IP address, but there's no subnet information, we don't know on what network that IP address resides. That's going to be one of the keys in this course to determining, given an IP address and the corresponding subnet mask, we're going to learn how to determine, what's the network address of that IP? Now, one way we could write this and include subnet mask information is something called prefix notation. With prefix notation we could say, 10.1.2.3 /8. The /8 says that there are eight ones in the subnet mask, in other words, the first eight bits are network bits, and therefore, the last 24 bits are host bits. Another way to write this would be 10.1.2.3 255.0.0.0. Notice, this is also, much like the IP address, in dotted decimal notation, specifically, this is our subnet mask in dotted decimal notation. The 255, that's the decimal value we get if we take those eight ones, there in that first octet, if we have eight binary ones, if you do the conversion, and we'll see how to do that conversion later, but if you convert eight binary ones to decimal, you get 255. And we have all zeros in the other octets and they, of course, are going to translate into decimal values of zeros. Those are a couple of different ways that we could write this IPv4 address to include subnet mask information, but what I wanted you take away from this video was that it's crucial that we have that subnet mask information for an IP address if we want any hope of knowing on what network it lives. And as we've previously alluded to, we're going to have the ability to draw that subnet mask dividing line where we want to draw it, to meet our specific design goals, and we'll get plenty of practice with that in this video series, however, there are some defaults. This subnet mask, where we have eight bits that are network bits, that's actually the default mask for this IP address. 10.1.2.3, as we're about to learn in the next video, that's considered to be a class A IP address, and that's the default subnet mask for a class A IP address. Let's take a look at all the other classes in our next video.

Contents