In the previous editions of “Subnetting Shortcuts”, we solved various types of problems involving subnet masks. This time, we’ll look at some more complex cases, specifically those in which the subnet/host boundary lies within the second or third octets. But first, because our lives would be incomplete without it, 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 |

Now, on to the first problem. Suppose you are tasked with subnetting the 172.16.0.0/16 network, such that there are 100 subnets supporting 300 hosts each. Since 30,000 (100 times 300) is less than the 65,534 host capacity of a “/16” address space (a Class “B” network), we’re good to proceed.

As before, the algorithm is:

- 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

We use the number of hosts per subnet to determine the number of host bits required. Consulting the powers of two chart reveals that for 300 hosts … hmmm… it reveals that 300 is off the chart! However, since we know that each column to the left is worth twice the column to the right, all we would need would be one more column to the left (two to the ninth is 512) to see that we need nine host bits (which actually allows for 510 hosts per subnet).

Next, using the chart, we determine the number of subnet bits needed. In this case we’re on the chart, since 100 subnets requires seven subnet bits (which actually allows for 128 subnets). Since nine (host bits) plus seven (subnet bits) is 16, and we have 16 bits with which to work (32 minus the 16 already used to specify the address space), we’re in good shape. Thus, the subnet mask is a “/23” (32 minus the nine host bits, or 16 plus the 7 subnet bits).

Now, since we know that the mask is a “/23”, we can proceed to calculate the subnets, ranges and broadcasts. First, though, let’s determine the increment. One way to do this is to note that since the mask is a “/23”, there is one host bit in the octet of interest (the third octet). Therefore, the increment is two to the first, or two in the third octet. Incrementing by two in the third octet, the subnets are:

- 172.16.0.0/23
- 172.16.2.0/23
- 172.16.4.0/23
- (123 more subnets that increment by two in the third octet go here)
- 172.16.252.0/23
- 172.16.254.0/23

Note that you can also use the increment to determine the subnet mask in dotted-decimal form. Simply subtract the increment (two) from 256, and that’s the value in the octet of interest (the third). In other words, the mask is 255.255.254.0 (same as a “/23”).

Now let’s find the ranges. As before, the range extends from one more (than the subnet) to two less (than the next subnet) … BUT … by “one more”, we actually mean “the next address”. For the first subnet (172.16.0.0/23), the first legal host address is 172.16.0.1 (not 172.16.1.0), and the last address on that subnet is 172.16.1.254 (not 172.16.0.254). Likewise, on the second subnet (172.16.2.0/23), the first host is 172.16.2.1 (not 172.16.3.0), and the last host is 172.16.3.254 (not 172.16.2.254). Thus, the ranges are:

- 172.16.0.0/23, Range: 172.16.0.1 – 172.16.1.254
- 172.16.2.0/23, Range: 172.16.2.1 – 172.16.3.254
- 172.16.4.0/23, Range: 172.16.4.1 – 172.16.5.254
- (123 more subnets that increment by two in the third octet go here)
- 172.16.252.0/23, Range: 172.16.252.1 – 172.16.253.254
- 172.16.254.0/23, Range: 172.16.254.1 – 172.16.255.254

Using the same logic, the broadcast addresses are:

- 172.16.0.0/23, Broadcast: 172.16.1.255
- 172.16.2.0/23, Broadcast: 172.16.3.255
- 172.16.4.0/23, Broadcast: 172.16.5.255
- (123 more subnets that increment by two in the third octet go here)
- 172.16.252.0/23, Broadcast: 172.16.253.255
- 172.16.254.0/23, Broadcast: 172.16.255.255

While we’re here, let’s make some observations. First, the basic idea is the same as what we were doing before, we’re just operating in a different octet. Second, when subnetting with a “/23” mask, an address like 172.16.1.0 is a legal host address (with that mask, it’s neither a subnet nor a broadcast address). It looks kind of weird, but it’s perfectly legit. Third, since most workgroups (VLANs) have fewer than 254 hosts (employees, whatever), you don’t see subnet masks of “/23” used very often (nor anything in the range of “/9” to “/23”, for that matter).

Since that was such fun (!), let’s do another. Given an address space of 10.0.0.0/8, subnet it such that there are 1000 subnets supporting 1000 hosts each. Since a million (1000 times 1000) is less than the approximately sixteen million host capacity of a “/8” address space (a Class “A” network), we’re good to go.

As always, we use the number of hosts per subnet to determine the number of host bits required. A thousand hosts per subnet is off the chart, but it’s easy to see that if nine host bits allows 510 hosts, then ten host bits allows for 1022 hosts (two to the tenth is 1024, minus the two reserved addresses gives 1022). Likewise, 1000 subnets requires ten subnet bits (which allows for 1024 subnets). That’s a total of twenty bits.

Since we only need twenty bits, but we have 24 bits to work with (32 minus the eight specifying the address space), we have four “extra” bits, so at this point we have a decision to make. Since there are 32 bits in a subnet mask, the number of network bits plus subnet bits plus host bits must equal 32. We could make the extra bits subnet bits, or host bits, or split them between the two.

To leave room for growth in both the number of subnets and the size of each subnet, let’s split the difference, using twelve host bits and twelve subnet bits (allowing for up to 4096 subnets, each containing up to 4094 hosts), and results in a “/20” mask. This means that there are four host bits in the third octet, so the subnets increment by 16 (two to the fourth) in the third octet, and the dotted-decimal mask is 255.255.240.0 (256 minus 16 in the third octet). Thus, the subnets and their ranges are:

- 10.0.0.0/20, Range: 10.0.0.1 – 10.0.15.254
- 10.0.16.0/20, Range: 10.0.16.1 – 10.0.31.254
- 10.0.32.0/20, Range: 10.0.32.1 – 10.0.47.254
- (12 more subnets that increment by sixteen go here)
- 10.0.240.0/20, Range: 10.0.240.1 – 10.0.255.254
- 10.1.0.0/20, Range: 10.1.0.1 – 10.1.15.254
- 10.1.16.0/20, Range: 10.1.16.1 – 10.1.31.254
- 10.1.32.0/20, Range: 10.1.32.1 – 10.1.47.254
- (4074 more subnets that increment by sixteen go here)
- 10.255.208.0/20, Range: 10.255.208.1 – 10.255.223.254
- 10.255.224.0/20, Range: 10.255.224.1 – 10.255.239.254
- 10.255.240.0/20, Range: 10.255.240.1 – 10.255.255.254

Using the same logic, in case we’re interested the broadcast addresses are:

- 10.0.0.0/20, Broadcast: 10.0.15.255
- 10.0.16.0/20, Broadcast: 10.0.31.255
- 10.0.32.0/20, Broadcast: 10.0.47.255
- (12 more subnets that increment by sixteen go here)
- 10.0.240.0/20, Broadcast: 10.0.255.255
- 10.1.0.0/20, Broadcast: 10.1.15.255
- 10.1.16.0/20, Broadcast: 10.1.31.255
- 10.1.32.0/20, Broadcast: 10.1.47.255
- (4074 more subnets that increment by sixteen go here)
- 10.255.208.0/20, Broadcast: 10.255.223.255
- 10.255.224.0/20, Broadcast: 10.255.239.255
- 10.255.240.0/20, Broadcast: 10.255.255.255

Now that we’re experts, let’s do one more. Given an address space of 10.5.64.0/18, find the mask that gives 50 subnets, with the maximum number of hosts per subnet. For 50 subnets, we need six subnet bits (allowing a maximum of 64 subnets). Since six (subnets bits) plus eighteen (specified with the address space) is 24, we need a “/24” mask (255.255.255.0), and the subnets increment by one in the third octet. Also, because we’re left with eight host bits (32 minus 24), we can have up to 254 hosts per subnet. In other words, it’s as if we have 64 Class “C” networks starting with “10.5.64.0” at our disposal. The subnets, their ranges and broadcasts are:

- 10.5.64.0/24, range: 10.5.64.1 – 10.5.64.254, BC: 10.5.64.255
- 10.5.65.0/24, range: 10.5.65.1 – 10.5.65.254, BC: 10.5.65.255
- (60 more subnets that increment by one in the third octet go here)
- 10.5.126.0/24, range: 10.5.126.1 – 10.5.126.254, BC: 10.5.126.255
- 10.5.127.0/24, range: 10.5.127.1 – 10.5.127.254, BC: 10.5.127.255

Next time, we’ll finish off the shortcuts by solving some advanced “find the subnet” problems.

Author: Al Friebe

bowarr

I think there’s another typo in the following:

“#10.5.64.0/24, range: 10.5.64.1 – 10.5.64.0.254, BC: 10.5.64.255

# 10.5.65.0/24, range: 10.5.64.1 – 10.5.64.254, BC: 10.5.64.255”

The first line has a five octet end of range. I think the 0 should be left out and in the second subnet, the range is the same as the first subnet, i.e. 64 instead of 65 for the 3rd octet of each and for the 3rd octet of the BC.

Bob

Al Friebe

Bob –

You’re right, and the correction has been submitted. Thanks again!

– Al