Defining Custom Subnet Masks

Remember that when defining a custom mask, you not only need to consider the number of subnets required, but also the number of hosts each subnet will need to support. Imagine if I came to you with a special requirement. I have a Class B address, want the maximum number of subnets possible, and each subnet must support 60 hosts maximum. This is not difficult to figure out, but the way in which we approach the problem is different. Since the requirement specifies that each subnet will only ever need to support a maximum of 60 hosts, that’s where we’ll start. Let’s walk through this one step-by-step.

  1. We know we need to support 60 hosts per subnet, so we should start by defining how many host bits we require. In this case, 6 bits will be enough, since 26-2 equals 62. Don’t forget to subtract the 2 whenever you’re dealing with host bits – otherwise, your answer may be wrong.
  2. Knowing that we need 6 bits for hosts, and that we’re using a Class B address, simply draw out the diagram shown in this figure. Notice that I’ve sectioned off the last 6 bits, since they’re reserved for hosts.
  3. We want the maximum number of subnets possible, so we simply use all remaining non-network and non-host bits to define our subnets. Recall that this means changing the subnet bits to binary 1s. This is illustrated in this figure.
  4. If we convert out mask back to decimal, we come up with This mask will provide the maximum number of subnets possible, given our requirement of supporting 60 hosts per subnet. In this case, we can have up to 210-2 (1022) subnets, and 26-2 (62) hosts per subnet.

Just for the sake of completeness, let’s take a look at defining a custom subnet mask for a Class C address as well. Since Class C addresses support a fairly limited number of hosts to begin with, subnetting these addresses isn’t terribly common. However, it is something that you need to know. Recall that the default mask for a Class C address is In this example, let’s assume that we want to have at least 12 subnets, with the maximum number of hosts per subnet possible.

The steps are the same as always. Since we’ve been given a requirement for a certain number of subnets, we need to figure out how many subnet bits we’ll require. In this case we need at least 12 subnets, which means we’ll need to “steal” at least 4 bits, since 3 will not be enough. 24-2 gives us a maximum of 14 subnets. This is illustrated in the figure below.

Figure: Defining a custom subnet mask for a Class C address.

Notice that because we’re dealing with a Class C address, we’re left with only 4 host bits. That means that our custom mask of will provide us with a fairly limited 24-2, or 14 hosts per subnet. While this may not seem very practical, we have met the requirement of supporting at least 12 subnets given a Class C address range.

Author: Dan DiNicolo

Dan DiNicolo is a freelance author, consultant, trainer, and the managing editor of He is the author of the CCNA Study Guide found on this site, as well as many books including the PC Magazine titles Windows XP Security Solutions and Windows Vista Security Solutions. Click here to contact Dan.