Variable Length Subnet Mask (VLSM)

I see, thank you for the explanation @lagapidis

1 Like

here Gabriel did not mention the free space.
After subnet 4 (size 30) . AT subnet 5(size 2) becomes 10.0.5.158 and then free space becomes 10.0.5.160

Hello Pavan

I’m not sure what you mean when you say ā€œfree space.ā€ Based on his original Subnet 5 is indeed what he has stated, with the following elements:

  • network address: 10.0.5.160/30
  • netmask: 255.255.255.252
  • first host: 10.0.5.161
  • last host: 10.0.5.162
  • broadcast address: 10.0.5.163

In the above subnet, the network is a /30 network with four addresses. One broadcast, one network, and two host addresses, as stated.

Can you clarify what your question is? Thanks!

Laz

In Your example you mentioned free space. So I meant after size 128 you should add size 32 in subnet 5. Then size 2 becomes free space

Hello Pavan

Ah, I see what you mean. Yes, in the original post that you are referring to, the free space was not calculated. The poster only determined the subnets to be used. However, if we want to do that we can achieve it like so:

Subnet 6 (free space) has 4 addresses:

  • network address:10.0.5.164
  • first host: 10.0.5.165
  • last host: 10.0.5.166
  • broadcast address: 10.0.5.167

Subnet 7 (free space) has 8 addresses:

  • network address:10.0.5.168
  • first host: 10.0.5.169
  • last host: 10.0.5.174
  • broadcast address: 10.0.5.175

Subnet 8 (free space) has 16 addresses:

  • network address:10.0.5.176
  • first host: 10.0.5.177
  • last host: 10.0.5.190
  • broadcast address: 10.0.5.191

Subnet 9 (free space) has 32 addresses:

  • network address:10.0.5.192
  • first host: 10.0.5.193
  • last host: 10.0.5.222
  • broadcast address: 10.0.5.223

Subnet 10 (free space) has 32 addresses:

  • network address:10.0.5.224
  • first host: 10.0.5.225
  • last host: 10.0.5.254
  • broadcast address: 10.0.5.255

Of course, we can keep going because the original poster said that we’re looking at the 10.0.0.0/8 network to be subnetted. There’s a lot of free space there, but there’s no reason to continue, since we’d just be getting bigger and bigger subnets (with 512, 1024, or more hosts), which would be unusable anyway. The good thing is that we have determined the sizes of the next networks so these can be set aside for future use.

I hope this has been helpful!

Laz

Hello.

If I use CIDR, can I go below the default mask’s boundary? So would for example a 196.0.0.0/6 be a possible subnet? Or does the default mask determine the lower bound in CIDR as well, and not just in classful subnetting?

Based on the output of some subnet calculators I tried, the answer should be yes, and this is what I think is implied by the materials that I’ve studied, but I just wanted to confirm if I didn’t jump to conclusions and that the calculators aren’t poorly programmed. This wasn’t explicitly stated in any material I covered, so I’m not completely sure.

The only exception seems to be Wendell Odom’s book, where he heavily implies what I wrote above:
ā€œClassless addressing: The concept that an IPv4 address has two parts—the prefix part plus the host part—as defined by the mask, with no consideration of the class (A, B, or C)
Classful addressing: The concept that an IPv4 address has three parts—network, subnet, and host—as defined by the mask and Class A, B, and C rules.ā€

What he calls ā€œnetworkā€ seems to be the range of the default mask, but I just want to double-check this with someone else as well.
Thanks.

EDIT: Sorry, I made a mistake! Originally, I thought you could somehow subnet networks backwards. For example, for some bizarre reason that I can’t understand, I thought that if you had, say the 192.168.0.0/16 network, you could turn it into something like a 192.0.0.0/6, based on this calculator: https://www.calculator.net/ip-subnet-calculator.html?cclass=any&csubnet=6&cip=192.168.0.0&ctype=ipv4&printit=0&x=66&y=17

But that is clearly wrong, because with 192.168.0.0/16, the very first IP in the list of all IPs that belong to that subnet IS 192.168.0.0, so the list can’t go backwards (ie I can’t subnet 192.168.0.0 into a 192.168.0.0/6, because then I’d have to use IPs that weren’t in my original list of IPs). The calculator is correct though, but what it’s saying is ā€œhypothetically speaking if you had control of every single IPv4 address in existence, here’s the /6s you could have.ā€ So I misunderstood its output. It’s using the 0.0.0.0/0 network, not 192.168.0.0/16.

I’ll leave this post here, for the whole world to see my mistake, in the hope that someone else might have this exact (or a similar) misunderstanding about this topic, and hopefully my mistake helps them see correctly.

Hello Attila

Yes you can. Just like the quote you stated says, classless addressing pays no regard to classful rules. So you can split the address between the network and host portions anywhere you like.
For your example, if we take 196.0.0.0/6 and change it to binary:

11000100.00000000.00000000.00000000

A /6 means that the first six bits define the network address like so:

11000100.00000000.00000000.00000000

So we have:

  • network address 196.0.0.0 (11000100.00000000.00000000.00000000)
  • 1st host address 196.0.0.1 (11000100.00000000.00000000.00000001)
  • last host address 199.255.255.254 (11000111.11111111.11111111.11111110)
  • broadcast address 199.255.255.255 (11000111.11111111.11111111.11111111)

That gives us 67,108,863 host addresses within this subnet.

I hope this has been helpful!

Laz

1 Like

Hi Laz,

Thank you.

So if I’m configuring my own private network, I’m allowed to use almost any IP addresses in the class A, B, and C ranges (exceptions are 0.0.0.0, and the 127.0.0.0/8 loopback range), as long as I’m not connecting hosts that I’m assigning those IPs to the Internet (or I’m using NAT or PAT to translate those IPs)? So I could use a 196.0.0.0/6 address range, but only within my own autonomous system.

And only ICANN (or specifically, IANA) is allowed to allocate the 196.0.0.0/6 network for using those IPs as individual host addresses on the public IPv4 Internet, correct?

Thank you again for all of your help.
Attila

Hello Atilla

If you are creating your own network that will not interface with any other networks or with the Internet, you can use any IP address in class A, B, C, D, or E with the exceptions that you mention. Indeed you could use the 196.0.0.0/6 address range within your own independent and separate network.

Allocation of public range IP addresses are assigned to individuals and businesses by the local Regional Internet Registry (RIR), depending upon the region of the world you are in.

IPv4 addresses are very difficult to register, especially larger ranges of addresses because of IPv4 exhaustion, however, IPv6 addresses are available in abundance.

I hope this has been helpful!

Laz

1 Like

hi rene
in the second example we played with the class b neetwork 176.16.0.0. when you write down the subnets with them network addresses, in subnet 2 we need a block of 256 and you write the network address as 176.16.2.0. what is the meaning of the number 2 in the thirt octet ?
thank you

Hello Diego

In the second example, the requirements are what determine what network address will be used for each subnet. Initially, we are given the class B network of 172.16.0.0, and we are told that we need a block of addresses to serve 340 hosts. For 340 hosts, we need a subnet mask large enough to accommodate those addresses.

A subnet mask of 255.255.255.0 gives us 256 addresses, and that is too small. The next largest subnet mask is 255.255.254.0 which gives us 512 addresses, which is large enough. So, our first subnet will have:

  • a network address of 172.16.0.0
  • a subnet mask of 255.255.254.0

This gives us the following elements of this particular subnet:

  • network address 172.16.0.0
  • first host address 172.16.0.1
  • last host address 172.16.1.254
  • broadcast address 172.16.1.255

Once you get these elements of the subnet, you’re finished, and you go on to the next subnet. The network address of the next subnet is the broadcast address of the previous subnet plus 1.

The broadcast address of the first subnet is 172.16.1.255. To get the network address of the next subnet, we add 1 to this to get 172.16.2.0. So the network address of subnet 2 is 172.16.2.0.

So what is the meaning of the ā€œ2ā€ in the third octet? Well it has no special meaning, other than the fact that it just happens to be the network address of the very next subnet that we are using.
Does that make sense?

I hope this has been helpful!

Laz

Hi all, and Happy New Year!

Just a question regarding VLSM.

On every blog or NW book, I’ve seen that to do subnetting in the right way, the greatest subnet should be allocated first, and consequently, the other subnets till the smallest.
I.e.

10.192.0.0/24

  • First subnet 10.192.0.0-127/25
  • Second subnet 10.192.128-159/27 and so on…

What if i mix the order maintaining the subnet i need?

For example:

10.192.0.0/24

  • First subnet 10.192.0.0-3/30
  • Second subnet 10.192.0.4-7/30
  • Third subnet 10.192.0.8-15/29
  • Fourth subnet again 10.192.0.16-19/30

Is this possible, or are there some limitations?

Thanks in advance for the feedback and your awesome lessons.

BR
Aronne

Hello Aronne

Happy New Year! That’s a great question. The reason why it is best practice to do subnetting from the largest subnet to the smallest is because there are cases where it won’t work otherwise.

For the example you shared, it just happens that subnetting would work just fine. However, if you try to do this one:

10.192.0.0/24

  • First subnet 10.192.0.0-3/30
  • Second subnet 10.192.0.4-11/29
  • Third subnet 10.192.0.12-19/29

You would find that the second subnet would not work. Let’s try it out!

Let’s write out the network address such that the final octet is in binary:

10.192.0.4 = 10.192.0.00000100

Now we’re using /29 as the subnet mask which when the last octet is written in binary we get:

255.255.255.248 = 255.255.255.11111000

Now by definition, for a network address, all of the bits in the same positions as the 0 bits in the subnet mask, must be set to zero. Our subnet mask has the last three bits set to zero. So that means that the last three bits of our network address must be set to zero. However, our network address is:

10.192.0.00000100

We see a ā€œ1ā€ in a position where there should be no 1. That means that this is an invalid network address for our specific subnet mask. Does that make sense?

So to avoid such situations, it’s best practice to work your way backwards from the largest subnet to the smallest.

I hope this has been helpful!

Laz

Hi Laz,
Thanks for the explanation. Very clear!
Wish you a great day
Aronne

1 Like

Hi, this is my solution.

Would appreciate any feedback as to whether my solution is correct.

network 10.0.0.0

subnet 1 - 600 hosts (size 1024)

network address 10.0.0.0
first ip address 10.0.0.1
last ip address 10.0.3.254
broadcast address 10.0.3.255

subnet mask 255.255.252.0

subnet 2 - 250 hosts (size 256)

network address 10.0.4.0
first ip address 10.0.4.1
last ip address 10.0.4.254
broadcast address 10.0.4.255

subnet mask 255.255.255.0

subnet 3 - 120 hosts (size 128)

network address 10.0.5.0
first ip address 10.0.5.1
last ip address 10.0.5.126
broadcast address 10.0.5.127

subnet mask 255.255.255.128

subnet 4 - 30 hosts (size 32)

network address 10.0.5.128
first ip address 10.0.5.129
last ip address 10.0.5.158
broadcast address 10.0.5.159

subnet mask 255.255.255.224

subnet 5 - 2 hosts (size 4)

network address 10.0.5.160
first ip address 10.0.5.161
last ip address 10.0.5.162
broadcast address 10.0.5.163

subnet mask 255.255.255.252

subnet 6 - free space

network address 10.0.5.164

Thank you,

Kader

Hello akader.

I’ve gone through your calculations and found them all to be correct. What you can do next time is to include the subnet mask in a /xx notation, for ex: 10.0.0.0/22 - it makes the calculations easier to read, but that’s just a recommendation!

Let us know if you have any further questions.

David

1 Like

Thanks a lot,

David

Hello Akader

I agree with @davidilles, the calculations are correct. Let me add one more thought, which has to do with real-world considerations. I know this wasn’t part of the actual exercise, but I believe it is beneficial to consider when applying this in practice.

If you have 250 hosts in a subnet, you must also consider future growth. Using a subnet size of 256 works, but you will quickly find that there will be an extra printer to be added, or another user will need connection, quickly reaching the limit. A rule of thumb is to use the 20% rule, where 20% of your subnet range remains initially unused.

This of course assumes that the original IP address range you are provided with has room to create larger subnets. In any case, it is a parameter that must be considered.

Finally, at the end, you mention the free space with a network address of 10.0.5.164. Ī…What was the original IP address space provided? If it was 10.0.0.0/21 that would give us a range from 10.0.0.0-10.0.7.255 which would work for the subnetting you created. So if you want to create new subnets, you would indeed begin with 10.0.5.164. Just keep in mind that if you do the calculations, you’ll find that the largest address space you can get for that network address is a /31. If you need larger subnet ranges, you would probably move on to 10.0.5.192/26 as the next network address space or even 10.0.6.0/24. If you do the calculations, you will see why this is.

This is not a problem with your calculations, you’ve worked them out correctly, it’s just the nature of the result. I hope this has given a bit more insight into the process, and not added more confusion… :innocent: :zany_face:

I hope this has been helpful!

Laz

1 Like

Hi Laz,

Thanks for the input.

But I do have one more question. If the CCNA exam asks to create a subnet with 14 hosts, my understanding is that I need to create a subnet of 16 total ip addresses.

Meaning stick to the question asked. Is that correct?

Thank you,
Kader

Hello Kader

Yes, absolutely. Stick to the specific question being asked. The info I added refers to the approach in a real-world scenario. For the exam, unless you are specifically asked to take additional information into account, answer exactly what is being asked.

I hope this has been helpful!

Laz

1 Like