In a previous video, we talked about class-based subnetting and how IP addresses could be assigned a class A, class B, or class C address. But since 1993, we've not used class-based subnetting. Instead, we use classless subnetting. Sometimes you'll see this referred to as classless inter-domain routing, or CIDR.
This classless addressing means that we can assign a subnet mask that doesn't fall into those same class A, class B, or class C arrangements. And instead of referring to the subnet mask in its decimal form, we can simply refer to it as the number of bits. That number of bits is referred to as a CIDR block notation.
For example, a decimal subnet mask of is the same as a slash eight CIDR block notation because it has eight individual bits as part of the subnet mask. So it would be very common to see an IP address written as 192.168.1.44 slash 24. Everything with the slash 24 is referring to the number of bits in a subnet mask, and a slash 24 mask would be the same as When you're configuring a device, you're often giving it an IP address, a subnet mask, a default gateway, and very often a series of DNS servers. Most of the time, an operating system is expecting you to put the subnet mask in as a decimal mask. So for example, in Windows, you may put the IP address, and then you might add in the decimal version of the subnet mask. But if you're using a router or a switch, it may be expecting the CIDR block notation for those masks.
So instead of using you would simply input slash 8. Make sure you check the documentation of the device you're using to see what notation it prefers for the subnet mask. As you've probably seen in our previous examples of subnet masks, the mask consists of a contiguous series of ones followed by zeros. So the ones would be on the left, the zeros would be on the right.
For example, here is a subnet mask. You can see the contiguous set of ones on the left and the zeros that are on the right. In this example, you can see three separate octets that are set to 1. So there are 24 1's in this particular mask, and there are eight 0's at the end. If we were to write this out in decimal, it would be And if you were to write this out in CIDR block notation, you would count how many 1's are associated with the subnet mask. In this case, there are 24. So the CIDR block notation would be slash 24. The subnet mask is obviously used to separate the network part of the address from the host part of the address.
So for this particular subnet mask, the network address is 24 bits in length, and the host address is 8 bits in length. Let's convert a binary subnet mask to one that is the CIDR block notation for a subnet mask. And we'll take this subnet mask that we have on the screen, which has all ones in the first two octets and all zeros in the last two octets.
If we were to count. the number of ones in the subnet mask. We have eight in the first octet, eight in the second octet, none in the third, and none in the fourth. That means the total number of ones in the subnet mask would be 16. So the CIDR block notation would be slash 16. This means that the first 16 bits of the subnet mask are associated with the network and the last 16 bits are associated with the host ID. Let's do another one.
In this example, the first three octets are all ones, but the last octet has two ones and six zeros. So let's count the number of ones in the subnet mask. There are eight in the first octet, eight in the second octet, eight in the third octet, and two that are in the fourth octet.
If we count all of those together, we have 26. So the CIDR block notation of this subnet mask would be slash 26. The slash 26 means that the first 26 bits of this address are the network part of the address, and the last six bits are reserved for the host ID. And here's one more. In this subnet mask, we have the first octet of all ones, the second octet has four ones and four zeros, and then the third and fourth octets are all zero. Since we are counting number of ones, we have eight in the first octet and four in the second octet.
And if you count those together. The subnet mask insider notation would be a slash 12. That means that the first 12 bits are for the network ID, and the last 20 bits would be for the host ID. We've looked at the subnet mask in binary, and we've calculated the Sider block notation, but we often refer to the subnet mask as a decimal value.
If we were to convert these binary subnet masks into a decimal value, there are only a certain number of these that you would run into. For example, all zeros would obviously be a decimal zero, but anything that starts with a binary of 1 and the rest zeros would be a decimal of 128. If there are two 1's, it's 192, 3 would be 224, and so on. This means that you could create a chart that shows all eight of the bits within a single octet and what the decimal equivalent would be.
We can now use that chart to calculate the Sider block notation and what the decimal representation of that subnet mask would be. So let's look at a subnet mask of all ones in the first octet. There are four 1s in the second octet, and the rest of this would be all 0s. If you refer to our chart, you can see that all 1s is 255. Four 1s and four 0s would be 240. And then, of course, all 0s would be 0. And if we were to count the number of 1s, we know that correlates back to a slash 12. So a slash 12 SIDR notation is the same thing as in decimal notation. And of course, since there are 12 1s, the network section is 12 bits in length, which leaves the remaining 20 bits available for the host ID.
Let's look at a subnet mask we've not seen yet. This one is all 1s in the first octet, all 1s in the second octet. There are three 1s in the third octet, and of course, the rest of this is 0s.
If we look at our chart, we can see that, of course, all 1s is 255. And in the octet that has three of these 1s, We refer to the chart that is the same as 224 in decimal. And obviously, all zeros in binary is the same as 0 decimal. If we then count the number of ones in all of these octets, they all add up to 19. So your CIDR block notation would be slash 19, which corresponds back to the decimal representation of This, of course, means that the network part of this address is 19 bits in length. And the host section is 13 bits in length.
Of course, we can do this in reverse as well. Let's say that we have a subnet mass that's been given to us as a slash 26 in CIDR block notation. If we were to write this out in binary, that means that we would have all ones in the first three octets and two ones in the last octet.
And if we were to refer back to our chart, all ones would obviously be 255. And the last octet that has two 1's correlates back to a 192 in decimal. So a slash 26, where your network ID is 26 bits in length and the host ID is 6 bits in length, is the same as a slash 26 in CIDR block notation or 255.255.255.192 in decimal. Let's do another one where we've been given a slash 20 in CIDR block notation.
That means there are 20 1's. in this particular subnet mask. So your first two octets are all 1, and third octet has four 1s and four 0s, and of course, the last octet will be all 0. If we refer to our chart, we know that the decimal version of that binary subnet mask will be which is the same as a slash 20 CIDR block notation. That means the network part of this address is 20 bits in length, which leaves us 12 bits available. for host IP addresses.