I can’t make this point any more definite. You NEED to know how subnetting works if you are going to work on networks. It’s just that simple. Sure, you can get by using /24 networks everywhere for awhile. But once you get your XBOX online and you actually want to work on big networks you’ll be sunk. I’m glad that Cisco realized this and made it such a large part of their certifications. So be warned, you don’t have a prayer at passing their entry level cert (CCNA) if you can’t subnet.
So, since I already talked about subnetting in an earlier post let’s talk about VLSM (Variable Length Subnet Masks), or as I like to call it, ‘subnetting a subnet’. VLSM , in my opinion, really boils down to knowing block sizes. Block sizes are the entire IP space that a network takes up. For instance, a /30 (255.255.255.252) network has a block size of 4. How do I know that? I subtract the last octet from 256. In the case of /30 you have a network number, a broadcast number, and two usable IP’s. So in total, there are 4 IP’s making the block size 4 I’ll list some of the more typical block sizes below.

Block Size  Usable IP’s  Last Octet 
/30  4  2  252 
/29  8  6  248 
/28  16  14  240 
/27  32  30  224 
/26  64  62  192 
/25  128  126  128 
/24  256  254  0 
Now, let’s talk about the actual problem again. You should know by this point how to do basic subnetting. What I mean by that is if someone gives you a subnet and asks you to subnet it, you should know how. Most of the time it means doing what I call ‘equal subnetting’. That is you take a subnet and divide it into equal parts using one part for each network. This often leads to waste. Take this subnetting question into consideration.
You have the network 192.168.50.0 /24 and you need 6 networks with the maximum available hosts in each network. Define each network.
At this point our best friend is the old 2^{n}2 equation. Technically you could set the equation equal to 6 (AKA 6=2^{n}2) and solve using natural log functions, but I think it’s easier to just guess until you get it right. So plug in some numbers and see what works. As it turns out, when we plug in 3 we get 6. Really the equation should read 6≤2^{n}2 since we can’t talk about decimals here. If you actually solved the equation and received a decimal you would need to round up to the next whole number. At any rate, we solved the equation and got 3 as our answer. That means we need to borrow 3 network bits in order to get 6 subnets. When we do that we end up with a subnet mask of /27 and our subnets are as follows.
Subnet  Network  Broadcast  Usable  Block Size  Subnet Mask 
1  192.168.50.0  192.168.50.31  .1.30  32  /27 
2  192.168.50.32  192.168.50.63  .33.62  32  /27 
3  192.168.50.64  192.168.50.95  .65.94  32  /27 
4  192.168.50.96  192.168.50.127  .97.126  32  /27 
5  192.168.50.128  192.168.50.159  .129.158  32  /27 
6  192.168.50.160  192.168.50.191  .161.190  32  /27 
Pretty easy right? Now what happens if three of these networks are point to point WAN links? WAN links that are point to point only require 2 usable IPs and are typically given /30 subnet masks because of this. So in the above example we have literally wasted over 80 IP addresses! So what’s the solution to this problem? VLSM. Basically we just add the block sizes we need onto each other starting from the beginning. So let’s start with a more defined question.
You have the network 192.168.50.0 /24 and require the following subnets.
3 subnets for WAN links
2 subnets with at least 60 usable host IP’s
1 subnet with at least 20 usable host IP’s
The first thing you should think about is block sizes. If we look at the question again we can determine what block sizes we need just by analyzing the host IP count requirement.
You have the network 192.168.50.0 /24 and require the following subnets.
3 subnets for WAN links (Block size of 4)
2 subnets with at least 60 usable host IP’s (Block size of 64)
1 subnet with at least 20 usable host IP’s (Block size of 32)
Note: Thanks for all the folks that have commented on this over the years. I’m finally fixing this and I’ll apologize endlessly that it took me this long to do so.
The main issue you need to contend with is fitting the required network sizes into the initial subnet allocation. If we were to take the approach of just “stacking” these requested subnets one on top of each other we’d end up in trouble pretty quickly and it might look something like this…
Subnet  Network  Broadcast  Usable  Block Size  Subnet Mask 
1  192.168.50.0  192.168.50.3  .1.2  4  /30 
2  192.168.50.4  192.168.50.7  .5.6  4  /30 
3  192.168.50.8  192.168.50.11  .9.10  4  /30 
4  192.168.50.12  192.168.50.75  .13.74  64  /26 
5  192.168.50.76  192.168.50.139  .77.138  64  /26 
6  192.168.50.140  192.168.50.171  .141.170  32  /27 
A quick examination of this table should reveal an immediate flaw (as it did to some of you, thanks for the comments!). Simply “stacking” the allocations on top of one another does not respect the bit boundaries of the subnets. In other words, by doing it this way, you’re overlapping subnets on top of one another. A good rule of thumb, and something I think about each time I do this, is that smaller subnets fit inside of larger subnets. That may seem obvious, but what that really means is that an exact number of smaller subnets fit inside of a larger subnet. Each time you increase the subnet mask by 1, you can get twice as many of those size networks in the same space. For instance we start with a single /24.
192.168.50.0/24
Which could be subnetted into..
2 x /25 networks
4 x /26 networks
8 x /27 networks
16 x /28 networks
etc.
Lets walk through this and hopefully this will start making sense. Let’s start with allocating the biggest block first that we need which is a /26. Inside a given /24 network you could fit a total of four /26 networks…
192.168.50.0/26
192.168.50.64/26
192.168.50.128/26
192.168.50.192/26
Those are the ONLY valid /26 allocations that can fit inside of the /24. So since those are the biggest, let’s allocate those first….
Subnet  Network  Broadcast  Usable  Block Size  Subnet Mask 
1  192.168.50.0  192.168.50.59  .1.58  64  /26 
2  192.168.50.64  192.168.50.127  .65.126  64  /26 
Now, let’s allocate the next biggest chunk which is a /27. You’ll notice that as the subnets get smaller, they inherently fit inside the large subnets. For instance, here’s a list of all the possible /27 subnets that can fit inside of a /24…
192.168.50.0/27
192.168.50.32/27
192.168.50.64/27
192.168.50.96/27
192.168.50.128/27
192.168.50.160/27
192.168.50.192/27
192.168.50.224/27
Notice that we have some overlap in terms of the last octet with the /26 allocations. By increasing the subnet mask size by 1 (from /26 to /27) I can get twice as many subnets in the /24 and they all align evenly within the same subnets for the /26 allocations. So let’s now allocate the .27 into our table…
Subnet  Network  Broadcast  Usable  Block Size  Subnet Mask 
1  192.168.50.0  192.168.50.59  .1.58  64  /26 
2  192.168.50.64  192.168.50.127  .65.126  64  /26 
3  192.168.50.128  192.168.50.159  .129.158  32  /27 
Now we only have the three /30 subnets left to allocate. Since we’re still going smaller, we can tack these right onto the end of the /27 allocation – or put another way – inside of the next /27 allocation. The next /27 allocation would be 192.168.50.160/27. How many /30s can we get inside of that? 8!
192.168.50.160/30
192.168.50.164/30
192.168.50.168/30
192.168.50.172/30
192.168.50.176/30
192.168.50.180/30
192.168.50.184/30
192.168.50.188/30
Subnet  Network  Broadcast  Usable  Block Size  Subnet Mask 
1  192.168.50.0  192.168.50.59  .1.58  64  /26 
2  192.168.50.64  192.168.50.127  .65.126  64  /26 
3  192.168.50.128  192.168.50.159  .129.158  32  /27 
4  192.168.50.160  192.168.50.163  .161.162  4  /32 
5  192.168.50.164  192.168.50.167  .165.166  4  /32 
6  192.168.50.168  192.168.50.171  .169.170  4  /32 
Again, it’s all a matter of how you lay things out but let’s imagine they come back and ask you to assign another….
/26 – At this point – your only option for a full /26 allocation would be 192.168.50.192/26 since you’ve already started eating into 192.168.50.128/26 with smaller subnets.
/27 – Assuming you don’t allocate the above /26 example, another /27 could come out of the /24 in the form of 192.168.50.192/27 or 192.168.50.224/27.
Keep in mind that this leaves the range of IPs from .172 to .191 stranded. It’s best practice to prevent this from happening by allocating the same size subnet out of a given block but in some cases your hand will be forced to do something like this and leave space unused.
Hope this helps!
Thank you very much for making my life much easier and I want to say to you keep it up .I am on my way to do CCNA course and I hope wit this information I will come right
hello,
your last vlsm calculation doesn´t make sense
can you please explain the last vlsm calculation.
Now just a question. We have always been taught to go from the largest to the smallest VLSM. In the last example it jumped around a bit from 2 usable hosts to 60 and then to 20. If we get a question in CCNA about that, is it wise to go from largest subnet to lowest or does it matter?
Wow, sorry for the delay in the reply. My bad.
The size of the subnet depends solely on its use. There really isnt a ‘best practice’ in regards to largest to smallest as long as you know your math. Did I misunderstand your question?
sorry, can i know how the subnet 1 until 4 in the last question is /30 and /26?
Instead of the IP address is 192.168.50.0 /24.
Can show me how to calculate it?
Can snap the photo of answer to my email also.
Hey, this is a very good tutorial, however, the question stated that you should derive 2 subnets with at least 60 usuable host IP’s and 1 subnet with at least 20 usuable host IP’s so it should be two /26 and one /27. What you did was the opposite but anyways if you change the question it will work out to be the same answer you have there. I now better understand VLSM. Thank you!
Not sure I understand. What do you think I have backwards?
Your VLSM and required usable hosts is wrong with the regards to your requirements.
”
You have the network 192.168.50.0 /24 and require the following subnets.
3 subnets for WAN links (Block size of 4)
HERE — > –2 subnets with at least 60 usable host IP’s (Block size of 64)
HERE — > –1 subnet with at least 20 usable host IP’s (Block size of 32)
”
You should have
2 x 60 usable hosts
1 x 20 usable hosts
Your output is:
….
4 192.168.50.12 192.168.50.75 .13.74 64 /26
5 192.168.50.76 192.168.50.107 .77.106 32 /27
6 192.168.50.108 192.168.50.139 .109.138 32 /27
Change your requirements is the easiest way to fix the mistake:
You have the network 192.168.50.0 /24 and require the following subnets.
3 subnets for WAN links (Block size of 4)
HERE — > –1 subnets with at least 60 usable host IP’s (Block size of 64)
HERE — > –2 subnet with at least 20 usable host IP’s (Block size of 32)
That is what they are trying to tell you. 🙂
The VLSM example makes no sense.
For example:
Network 192.168.50.0/26 has 4 possible networks: 192.168.50.0, 192.168.50.64, 192.168.50.128, 192.168.50.192
192.168.50.12/26 as a network address is nonsense. You have gone outside the bit boundaries for the network.
The supposed hosts in this network ie .13 – .74 will not fall within the same network and will not be able to communicate with each other. 192.168.50.13 is a host on the 192.168.50.0/26 network whereas 192.168.50.68 would be on the 192.168.50.64/26 network. There are similar errors with some of the other network allocations.
As you say VLSM is subnetting a subnet, but you must choose “real” networks in terms of bit boundaries when doing this subdividing.
This is why VLSM is calculated stepwise from most to least hosts required in a given subnet as the network bit boundary then follows a logical sequence.
A correct scheme would be the following networks generated:
192.168.50.0/26 (60 hosts required)
192.168.50.64/26 (60 hosts required)
192.168.50.128/27 (20 hosts required)
192.168.50.160/30 (2 hosts required)
192.168.50.164/30 (2 hosts required)
192.168.50.168/20 (2 hosts required)
Verification with an online vlsm calculator is always a wise move.
Are you sure that a /26 class C subnet can start at the .12 IP (network#4) ?
I know this is an old thread but was the only one where I found this, which I would be glad because fits my requirements, but seems that no routing protocol will realize of this. Every Subnet Calculator on Internet will have the /26 subnets always starting on 0, 64, 128 and 192. Even there was a place where they recommend to place the bigger subnet first for “avoiding problems” (IDK which ones).
Thanks in advance if your still there.
Rgds
Langus
I was intending to start with the small subnets first for the same reason you mentioned here, as most of the folks on the web tried, against of the recommendation of start with the big subnet first, however doesn’t work.
As a newbie to VLSM I was happy when I found your post and this other one “https://www.pluralsight.com/blog/itops/ciscoccnavlsm” mentioned you could allocated the small subnets at the beginning of the network address range.
So now I don’t know if it’s the over constrained residential routers, or the routing protocol, or just my ignorance that is not allowing network#4. Subnet calculators on the web will understand network#4 “/26” as subnetting only on .0, .64, .128 or .192. Seems that cannot be defined at .12 as you mentioned here (even when I wished).
I’m really interested on your opinion about this.
Thanks in advance!
I don’t know if you’re still reading comments on such an old thread, but on the second question your /26 subnet is wrong. The IP 192.168.50.12 is part – a valid host IP – of the 192.168.50.0/26 subnet which goes from 192.168.50.0 to 192.168.50.63. If you need to use the first three /30 subnets for your wan links, then the next available /26 subnet is the 192.168.50.64/26 subnet. Subnets need to start at IP’s that have all the host bits set to 0 and 12 in binary is 00001100.
Hi folks – I finally got around to updating this. Many apologies for it taking me 8 years (eek) to do this but all of you who called out my subnet allocations as incorrect were right. Thanks for the continued comments!