In “Part 3”, we solved a subnet masking problem using shortcuts. This time, we’ll use the shortcuts to solve some additional problems. Here’s the first problem: given an address space of 172.16.1.0/24, divide the network into five subnets, each supporting at least twenty hosts.
Here are the steps we’ll use:

Using the powers of two chart, determine the required subnet mask

Using the mask, determine the increment

Using the increment, determine the subnets

Using the subnets, determine the broadcast addresses (if needed)

Using the subnets, determine the ranges
And here is the powers of two chart:
n =  8  7  6  5  4  3  2  1 
2^{n} =  256  128  64  32  16  8  4  2 
The first step is to determine the total number of host address required. Five (subnets) times twenty (hosts per subnet) is 100. Since we were given a “/24” address space (a Class “C” sized piece of a Class “B” network) that supports up to 254 addresses, we’re good to go. Referring to the chart, we can see that twenty hosts per subnet requires at least five host bits (which would actually support up to thirty hosts per subnet). Also, five subnets requires at least three subnet bits (which would allow for up to eight subnets). If we add the number of host bits (five) to the number of subnet bits (three), we get a total of eight, which is exactly how many bits we have to work with. Why? Because the first 24 bits are fixed by the address space, leaving eight bits to get us to the mask length of 32.
Now we can calculate the subnet mask. We can either subtract the number of host bits (5) from 32 (the total length of a subnet mask), or add the number of subnet bits (3) to that specified by the address space (24). Either way, the mask is a “/27”.
Next, we determine the increment, which is simply two raised to the number of host bits (from the powers of two chart). In this case, that is 2^{5} = 32, so the subnets increment by 32. Incidentally, this also tells us the mask in dotteddecimal. Just subtract the increment (32) from 256 (a magic number), giving 224. Thus, the mask is 255.255.255.224 (the same as “/27”). If you’d like it in binary, it’s all ones in the first three octets, and “11100000” in the fourth octet (a total of 27 ones).
At this point, we can calculate the subnets. Just start at zero, and increase by the increment, stopping at the last subnet (which is equal to the mask):

172.16.1.0/27

172.16.1.32/27

172.16.1.64/27

172.16.1.96/27

172.16.1.128/27

172.16.1.160/27

172.16.1.192/27

172.16.1.224/27
Next, let’s examine the broadcast addresses. Remember that in each case, the subnet’s broadcast address is equal to the value of the next subnet minus one, with the exception of the last subnet, for which the broadcast address is always “255”. Thus, subnets and their broadcast addresses are:

172.16.1.0/27, Broadcast: 172.16.1.31 (one less than 32)

172.16.1.32/27, Broadcast: 172.16.1.63 (one less than 64)

172.16.1.64/27, Broadcast: 172.16.1.95 (and so on)

172.16.1.96/27, Broadcast: 172.16.1.127

172.16.1.128/27, Broadcast: 172.16.1.159

172.16.1.160/27, Broadcast: 172.16.1.191

172.16.1.192/27, Broadcast: 172.16.1.223

172.16.1.224/27, Broadcast: 172.16.1.255 (last is always 255)
Finally, let’s calculate the ranges of legal host addresses. Remember that the range begins with one more than that of the subnet itself, and ends with two less than the next subnet (which is one less than the subnet’s broadcast address). As for the broadcast addresses, the exception is the last subnet, for which the last host is always “254” (256 minus 2). Therefore, the subnets and their ranges are:

172.16.1.0, Range: 1 – 30 (one more, to two less)

172.16.1.32, Range: 33 – 62 (likewise)

172.16.1.64, Range: 65 – 94 (etcetera)

172.16.1.96, Range: 97 – 126

172.16.1.128, Range: 129 – 158

172.16.1.160, Range: 161 – 190

172.16.1.192, Range: 193 – 222

172.16.1.224, Range: 225 – 254 (ends with 254)
Let’s do another … given an address space of 10.100.200.0/24, find the mask that will give eleven subnets of thirteen hosts each. Since this is a total of 143 host addresses, it should fit in the specified “/24” address space. Referring to the powers of two chart, we see that for thirteen hosts per subnet, we need four host bits (which actually allows fourteen hosts per subnet), and that eleven subnets requires four subnet bits (which allows sixteen subnets).
Based on these numbers (four subnet and four host bits), the mask is “/28”. This can be found either from 24 plus the four subnet bits, or 32 minus the four host bits. Also, with four host bits, the subnets increment by 16 (two to the fourth). Since the increment is sixteen, subnet mask is 255.255.255.240 (256 minus 16 is 240), the last subnet is 10.100.200.240, and the subnets, their ranges and broadcast addresses are:

10.100.200.0/28, 10.100.200.1 – 14, 10.100.200.15

10.100.200.16/28, 10.100.200.17 – 30, 10.100.200.31

10.100.200.32/28, 10.100.200.33 – 46, 10.100.200.47

(Ten more subnets that increment by sixteen go here)

10.100.200.208/28, 10.100.200.209 – 222, 10.100.200.223

10.100.200.224/28, 10.100.200.225 – 238, 10.100.200.239

10.100.200.240/28, 10.100.200.241 – 254, 10.100.200.255
Let’s do one more … given the same address space of 10.100.200.0/24, find the mask that will give twenty subnets of ten hosts each. Since this is a total of 200 host addresses, we think that it should fit into the specified “/24” address space. Referring to the powers of two chart, we see that for ten hosts per subnet, we need four host bits (which actually allows fourteen hosts per subnet), and that twenty subnets requires five subnet bits (which allows thirtytwo subnets). Four bits plus five bits is nine bits, and that’s a problem, because the address space is specified as a “/24”, so we have only eight bits to work with (we can’t touch any of the first 24 bits). The only solution would be to obtain additional address space.
Next time, we’ll use the shortcuts to solve more subnet masking problems.
Author: Al Friebe