Subnetting a Subnet – VLSM

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 2n-2 equation.  Technically you could set the equation equal to 6 (AKA 6=2n-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≤2n-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)

I’m hoping at this point what needs to be done might be obvious.  We simply start from the first available network number and add up the block sizes.  Let me lay it out below and see if it helps.

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.107 .77-.106 32 /27
6 192.168.50.108 192.168.50.139 .109-.138 32 /27

Really what I do is add up the required block sizes and then fill in info like the usable IP range and broadcast.  Just make sure that you get your network numbers right.  If you are off by even one number everything after that will be wrong.  So, as you can see when we use VLSM we saved a lot of IP space by only allocating networks that met the host size requirement that we needed for that network.  The most dramatic savings often come from WAN links that only require 2 usable IPs and use the /30 subnet masks.

Tags:

  1. Thapelo’s avatar

    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

    Reply

  2. m3f’s avatar

    hello,
    your last vlsm calculation doesn´t make sense

    Reply

  3. m3f’s avatar

    can you please explain the last vlsm calculation.

    Reply

  4. Scott’s avatar

    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?

    Reply

    1. admin’s avatar

      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?

      Reply

    2. lim’s avatar

      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 e-mail also.

      Reply

    3. Ann Sam’s avatar

      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!

      Reply

      1. Jon Langemak’s avatar

        Not sure I understand. What do you think I have backwards?

        Reply

      2. Kevin’s avatar

        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. 🙂

        Reply

Reply

Your email address will not be published. Required fields are marked *