This time, we’ll use the shortcuts to solve some different types of problem. Instead of “find the mask”, this time the challenge is to “find the subnet”. Ready? Here’s the first problem: given a host address of 192.168.1.100 and a subnet mask of “/27”, determine the host’s subnet, the legal range of host addresses on that subnet, and the broadcast address for the subnet.
Since we know we’ll need it, here’s the powers of two chart:
The first step is to determine the subnet increment. Since there are 5 host bits (32 total bits in the mask minus 27 network-type bits), the increment is 32 (from the chart, 2 to the 5 is 32). Thus, the subnets (incrementing by 32 in the last octet) are:
Since 100 lies between 96 and 128, the host is on the 192.168.1.96/27 subnet. Based on the shortcuts we developed before, we can determine that the range of hosts on that subnet is 192.168.1.97 – 126 (one more than the current subnet to two less than the next subnet), and that the broadcast address is 192.168.1.127 (one less than the next subnet). Done!
Let’s do another … given a host address of 10.50.100.200 and a mask of 255.255.255.192, find the host’s subnet, the range and the broadcast address. Recall that when given a mask in dotted-decimal, the subnet increment can be determined three ways:
- Subtract the value in the octet of interest from 256
- Two to the number of host bits in the octet of interest.
- The value of the least significant subnet bit
In the case of a 255.255.255.192 mask, the first approach gives: 256 – 192 = 64. For the the second approach, a 255.255.255.192 mask is a “/26” (that is, six host bits), and two to the sixth is 64. In the third approach, a decimal 192 is equivalent to 11000000 in binary, and the least significant subnet bit (the rightmost one) is the 64 bit. No matter how you do it, the increment is 64. Since the increment is 64 (in the last octet), the subnets are:
Since 200 is greater than 192 (the last subnet), the host is on the 10.50.100.192/26 subnet, the range of hosts on that subnet is 10.50.100.193 – 254, the broadcast address is 10.50.100.255, and we’re done!
Let’s do another … the address and mask are 172.16.1.203/29. Based on the mask, we can see that the subnets increment by eight (because there are three host bits). While it’s possible to count by eight’s all the way to 203, for most people that would take a while (and be error prone). A quicker approach is to divide 203 by eight, which we can round down to 25*. Now just multiply 25* by 8 (the increment) to get 200, which is the subnet (172.16.1.200/29, to be exact). Since the increment is eight, the next subnet is 208 (actually 172.16.1.208/29), the range of addresses on the host’s subnet is 172.16.1.201 – 206, and the broadcast address is 172.16.1.207 for the host’s subnet.
Okay, since you insist, just one more … the address is 10.1.2.153, and the mask is 255.255.255.252 (that is, “/30”). Based on the mask, we can see that the subnets increment by four. Just take 256 and subtract 252, or use the fact that there are two host bits, or that the rightmost one in 11111100 (252 written in binary) is worth four. While it’s possible to count by fours all the way to 153, that would be boring, so let’s just divide 153 by 4, giving 38 (if we round down). Now multiply 38 times 4, which is 152. Thus, the subnet is 152 (10.1.2.152/30), the range is 10.1.2.153 – 154, and the broadcast is 10.1.2.155 (the next subnet is 10.1.2.156).
Next time, we’ll use the shortcuts to solve more complex subnet masking problems.
Authors: Al Friebe
*Correction to a typo in the original post