The first step in learning to subnet IPv4 is to understand the starting point. In this video, you’ll learn about IP classes and how to quickly calculate network values from an IP address and subnet mask.
<< Previous Video: IPv4 Addresses Next: IPv4 Subnet Masks >>
In the early days of the IP protocol, there were only three subnet masks that could possibly be assigned to a particular workstation. There was a Class A subnet mask, a Class B, and a Class C. The subnet mask for a Class A network is 255.0.0.0. This also means there are 8 bits available for the network address, and 24 bits available for hosts on those networks. A Class B subnet mask is 255.255.0.0, which means there are 16 bits available for the network and 16 bits available for the hosts. And a Class C subnet mask is 255.255.255.0, where there are 24 bits that are available for networks and 8 bits available for hosts. If we were to then draw lines through the subnet mask, you can see where the separation is between the network address and the host, and this line tends to change, whether it’s a Class A, a Class B, or a Class C subnet mask.
As IP became more popular, we realized that limiting our subnet masks to a Class A, B, or C was not a very efficient way to perform IP addressing. So we really haven’t used this method of automatic subnet masking since 1993. But we still use these terms in casual conversation. We might have a network that’s a 192.168.1.1, and somebody might ask, what’s the subnet mask on this network? And we’ll simply say, it’s a Class C, which is a much faster way than saying, oh, it’s 255.255.255.0. The reason we still reference these class-based subnet masks is that they become a starting point if we ever want to provide any additional subnetting to a particular IP address range.
Here’s a summary of the subnet classes. You only need to know Class A, Class B, and Class C. Class A subnet masks are associated with IP addresses that begin with the number 1 through 126, and the subnet mask for Class A is 255.0.0.0. If an IP address happens to start with a 128 through 191 as the first octet, then that is a Class B address, and the default subnet mask for that address is 255.255.0.0. The first octet of a Class C address will start with a 192 through 223, and the default subnet mask for this Class C address is 255.255.255.0.
As I mentioned earlier, you need to know these default classes so you know where to start when you begin IP subnetting. Let’s look at a number of different IP addresses and determine what class this particular IP address belongs to. Our first one is 126.96.36.199. If we refer back to our chart of IP address classes, we know that if the first octet happens to be a value between 0 and 126, then it is a Class A address. The next address is 188.8.131.52. And again, we want to look at that first octet, which is 220, and we know that our Class C range is between 192 and 223. And 220 certainly fits inside of that range, so this is a Class C address.
The next address is 184.108.40.206. Again, we want to look at the first octet, which is 165, and referring back to our chart, we know that anything between 128 through 191 is a Class B address. The address of 220.127.116.11 starts with a 128. We know that Class B addresses begin with 128 through 191, which makes this a Class B address. This next address, 18.104.22.168 starts with a 191. And again, we know our Class B range is between 128 and 191, so this is also a Class B address. And the last IP address, 22.214.171.124, we know that 192 falls into the Class C subnet range, so this would be a Class C IP address.
Let’s start using these IP addresses and subnet masks to start architecting the values that we could use for devices on a particular IP subnet. The first address that we’ll calculate is a network address. This would be the first IP address that happens to belong to a particular subnet. You can also get this value by taking all of the host bits of a particular subnet and changing them all to zero, and that will allow you to calculate the network address. If the very first IP address on a particular IP subnet is the network address, then one that is just one number above that is the first usable host address. So if you’ve calculated the network address, it’s very easy to find the first usable host address. You just add one to the IP address.
Conversely, you can find the network address by determining the first usable host address and subtracting one from that. The last IP address on a particular IP subnet is the network broadcast address. If you were to set all host bits to 1, this would allow you to calculate the network broadcast address. If you then want to define the last usable IP address that you can assign to a workstation or some other device on that subnet, you would find the network broadcast address and the last usable host address would be one number lower than that broadcast address.
Let’s now take what we know about the network address, the first usable IP address, the broadcast address, and the last usable IP address and do some calculations using actual IP values. So let’s take the IP address of 10.74.222.11, and when we perform this calculation, let’s assume that we’re using the default values or the class-based subnet masks. We know that anything that starts with an IP address of 10 into the Class A subnet range, which means the subnet mask will be 255.0.0.0.
Now that we know the subnet mask, we’re able to draw that line that will separate out the network part of the IP address versus the host part of the IP address, and let’s put those into a particular chart. We know our network value is everything to the left of the line, so that would be 10, and then our host values would be everything to the right of the line, which would be 74.222.11. To find the network address, then, we set all of the host bits to 0. So instead of 74.222.11, we have 0.0.0, which means the network address is 10.0.0.0 for this particular IP subnet.
To find the first available host on the subnet, we add 1 to the network address, which means the first available host could use an IP address of 10.0.0.1. To find the broadcast address for this network, we would change all of these host bits to be 1 in binary, which means that our broadcast address would be 10.255.255.255. And to find the last available host that you could use on this IP subnet, we subtract 1 from the broadcast address, making the last available IP address on the subnet 10.255.255.254.
Let’s perform the same calculations with another IP address, 172.16.88.200. We first need to determine what the default class would be for this IP address, and if we look at the first octet, which is 172, that falls into the range of a Class B IP address. A Class B IP address will then use the default subnet mask of 255.255.0.0. For a Class B address, then, we’re drawing the line right in the middle between the 255.255 and the 0.0, which means that we have a 172.16 on one side of the line and 88.200 on the other side. With this Class B address, then, our subnet mask separates this IP address into two sides, where the 172.16 is our network and the 88.200 is on the host side of this particular IP address. To find the network address, we need to set the host values to 0, so the network address is going to be 172.16.0.0.
To find the first available host on this network, we add 1 to the network address, which means the first IP available on this subnet is 172.16.0.1. To find the broadcast address for this subnet, we’re going to set all those hosts bits to 1, meaning they will be 255.255, making the broadcast address 172.16.255.255. And the last available IP address will be 1 fewer than the broadcast address, making it 172.16.255.254.
Let’s perform one more calculation with an IP address of 192.168.4.77. If we look at that first octet of 192, we know this is a Class C address so it will have a default subnet mask of 255.255.255.0. That means we’re going to draw the line right after that third octet, making the 192.168.4 the network part of the address, and the 77 as the host part of the address. To find the network address, then, we’re going to set all the host bits to 0, and there’s only a single octet of those. So the network address is 192.168.4.0. The first available IP address on the subnet will be 1 value larger than the network address, or 192.168.4.1. To calculate the broadcast address, we need to change all the host bits to 1, making that decimal value 255, which means the broadcast address is 192.168.4.255. That also means if we subtract 1 from that, we have the last available host address on this network, or 192.168.4.254.
As you can see, if the subnet mask happens to fall in that Class A, B, or C range, it becomes relatively easy to calculate all of these values. In future videos, we’ll show you how to calculate exactly the same information, even if that delineation is not on that Class A, B, or C range of subnet masks.