VLSM Variable Length Subnet Mask Example

In this Cisco CCNA tutorial, we’re going to carry on with our subnetting theme and by the end of the tutorial, you will be able to carry out a variable length subnet mask design for real-world network topology. Scroll down for the video and text tutorial.

 

VLSM Variable Length Subnet Mask Example Video Tutorial

YouTube video

Abdulai Fadiga

Abdulai Fadiga

I had studied many courses before and failed the CCNA exam twice.

I found your course and quickly realized that it was designed to help candidates not only pass the exam, but also to help them understand how networks functions in the real world and serve as a reference for any real-world projects.

Five weeks later, after thoroughly studying your course, I was able to pass the CCNA exam.

I am now a Technical Consultant at a telecommunication service provider here in West Africa.

Abdulai Fadiga

It's only a small network in the example of it we're going to work through, but you can apply the same things that you're going to learn here to larger networks in the real world.

 

Back in the day with early routing protocols, whenever you did subnetting, each of the subnets had to be exactly the same size. If you had one subnet that was a /28 for example, they all had to be a /28. You couldn't mix and match /27, /28, /29 within the same larger network.

 

That ended up wasting a lot of addresses. So with later routing protocols, they did have support for variable length subnet masks and now we can mix and match the size of our subnets within that greater network.

 

VLSM Variable Length Subnet Mask Example

 

Subnetting Considerations

 

The things that we need to consider when we're going to do the design are:

  • How many different locations do we have in the network that are going to need subnets?
  • How many hosts are going to be in each of those subnets?
  • What are the IP addressing requirements for each of the different locations? Should different departments or types of hosts be in different subnets?
  • What size is appropriate for each subnet?

 

 

For example, you might have one office but within that office, you've got a sales department, a research and development department, and an accounting department. You want the accounting department to be secured from different departments.

 

In that case, you would put it in its own subnet because we have to route between different subnets. It's easy to secure them at the layer 3 level based on their IP address.

 

For the last question, we don't want to waste addresses, but we want to leave some room for growth. Don't make it too big, we're wasting addresses, but don't make it too small that we're going to run out of addresses and then going to have to do a redesign later.

 

Network Topology Diagram

 

For example, this is our network topology diagram shown below. We've got an organization and they've got an office in New York and a branch office in Boston.

 

New York is our headquarters and they've got 28 hosts in the engineering department and 14 hosts in sales. In Boston, they also got engineering and sales. They got 28 in engineering. The same as in New York and evenly got seven hosts in the sales department.

 

 

So these are the different parts of the network that we need to apply IP addresses to and we've been allocated the class C network of 200.15.10.0/24 from our internet service provider.

 

Another thing that we need to do is don't forget about our point to point links between the routers. They need to have connectivity between each other and each is going to need IP addresses. The outside interface in the New York router is connected to the outside interface on the Boston router.

 

Subnetting Design Steps

 

You would create that subnet at the start of our available address space and then just keep working your way down. So you start with the largest subnet. Then move to the next one until you've allocated addresses for all of your different subnets.

 

In a real-world deployment, you want to have a scalable design. You want to have room for growth in your networking design.

 

Let's say that I've got a subnet that has got 14 hosts on there. Well, you know that one of our subnet sizes is exactly for 14 hosts. Don't give a subnet that exact size because maybe in a few weeks, a couple of extra people are going to join the department, and now how are you going to fix that problem?

 

Make the subnet size big enough that it's going to be able to grow. Another thing is because we're going to sequentially go from largest down to smallest. Let’s say we're going to have a subnet with 30 hosts and then another subnet with 30 hosts and then a subnet with 14 hosts.

 

 

We have a spare subnet with 30 hosts in it, so don't just do two subnets of 30. Do three or four subnets or 30 because if you do have a new department that acquires up to 30 hosts later, you've got a spare subnet and everything is still sequential, contiguous, and logical, going from largest down to smallest.

 

Doing design for what is right right now, designed for what is going to be the best fit in the future. Leave some scalability there, for a room for growth. That's what you do in the real world.

 

However, don't do that in the CCNA exam. Do not think about, "Oh, this is what I would do in the real world. This would be the best practice." Do exactly what the exam question tells you to do even if you think that would be a stupid thing to do.

 

Don't overthink things. Don't think, "Oh, well it would be better to do it this way." Do exactly black and white, do what the question asks you to do and then you're going to get the question right.

 

Engineering Departments

 

For our example, we had the engineering departments in New York and Boston and they have got 28 hosts each and that was the largest subnets we required.

 

Let's say the exam question says that the departments will not grow and we need to use the smallest subnets possible to maximize our available address space. So do not leave any room for future growth here because the question says "Make it optimal. Maximize your use of the address space."

 

So back to question. We will calculate the optimal subnet mask for the engineering departments. So no bigger than is necessary, but make sure it's at least big enough to support 28 hosts. Once you've done that, you'll be able to determine the network and broadcast addresses.

 

Do that for both engineering departments, for both New York and Boston, and figure out what the range of host addresses will be.

 

 

We have been allocated 200.15.10.0/24, a class C network. We've got two different departments that we want two different subnets for and they had got 28 hosts each.

 

A /27 supports 30 hosts. A /28 supports 14, it's not big enough so, we can't use that. The smallest that we can use is a /27. In real-world, you might argue that you'd prefer to use a /26. Again, this is not the real world, it's an exam question and we're going to use the smallest possible, which was a /27.

 

/27 in dotted decimal notation is 255.255.255.224. So that was the first part of the question, figure out the subnet mask. The next thing we have to do is to divide up our address space.

 

 

The headquarters was in New York, so let's give them the first subnet. The server network address is going to be 200.15.10.0/27 and if we look at the line, we can see it's after 32. Therefore, /27 is going to go up in increments of 32.

 

The next network address is going to be 200.15.10.32 which means that the first subnet's broadcast address is going to be one less than that, it's going to be 200.15.10.31. That leaves addresses available for our hosts of 200.15.10.1 up to 200.15.10.30. So, that's for the engineering subnet.

 

Next is the Boston engineering subnet. The last broadcast address used was 200.15.10.31 so the network address we're going to be using is 200.15.10.32. We’re still using that /27 where the line is after the 32. So, the next network address would be 200.15.10.64.

 

Our broadcast address must be 200.15.10.63 which is one less, and our hosts are going to be what's between the network and broadcast address that's 200.15.10.33 up to 200.15.10.62. That was the engineering departments taken care of.

 

New York Sales Department

 

The next largest subnet is New York sales which requires 14 hosts. The smallest possible subnet we can use is a /28. /28 means we've got four bits available for host addresses that gives us the 14 hosts. 200.15.10.0 to 200.15.10.63 were already being used by the engineering departments.

 

 

So for the network address, we'll start with 200.15.10.64. If we look at the line, we can see it's after the 16. 64 plus 16 is 200.15.10.80, take one away for our broadcast address and it is going to be 200.15.10.79.

 

The available host addresses are 200.15.10.65 to 200.15.10.78 which are the addresses that are between the network address and the broadcast address.

 

 

Boston Sales Department

 

That's our first three departments done. The last department was Boston sales which requires seven hosts. We're going to use a /28 again here, same as what we did for the last department.

 

 

A /29 supports six hosts which is not enough, so we're going to use a /28 which supports 14 hosts. The last broadcast address was 200.15.10.79, therefore, our network address will be 200.15.10.80. Again, the line is after the 16 so the next network address would be 200.15.10.96.

 

Our broadcast address is going to be 200.15.10.95. The valid host addresses are 200.15.10.81 to 200.15.10.94. So that's it. That was our four departments. So we're done. Right? No.

 

 

Subnetting

 

Remember we have to allocate addresses for the point to point link between the routers in Boston and New York. Another number thing you would do in the real world is you would also allocate address space for your loopback addresses.

 

Loopback addresses are used for management, but a logical address. So there's not anything physical in the other end. We'll usually allocate a /32 to our loopback addresses. Again, we'll talk about loopback addresses more in later lectures.

 

 

New York to Boston Link

 

The last subnet is the link between the New York and Boston routers. We want to support two hosts. Remember a /31 and a /30 supports two hosts.

 

Hopefully, you remember I told you before, unless the exam explicitly tells you, if you need to support two hosts, go with a /30 because that's the standard that we use. It complies with all of the internet standards.

 

 

We're going to use a /30 here for our two hosts. We're already using up to 200.15.10.95 for our departments. So our network address will be one up from there, 200.15.10.96. If you look at the line, it's after the four, therefore, the network address is going to go up in increments of four.

 

The network address would be 200.15.10.100. One less of that gives us our broadcast of 200.15.10.99. Which leaves the host addresses to be 200.15.10.97 and 200.15.10.98.

 

 

Network Topology Diagram

 

When we did our design, we started off with the largest subnets which were the engineering departments:

  • 200.15.10.0/27 for New York
  • 200.15.10.32/27 for Boston

 

Then I got my sales department:

  • 200.15.10.64/28 for New York
  • 200.15.10.80/28 for Boston

 

The subnet I used for my point to point link: 200.15.10.96/30.

 

Next, we're going to use the first available address as the IP address in our router interfaces:

  • 200.15.10.1 for New York engineering department
  • 200.15.10.33 for Boston engineering department
  • 200.15.10.65 for New York sales department
  • 200.15.10.81 for Boston sales department
  • 200.15.10.97 on the New York point to point link
  • 200.15.10.98 on the Boston point to point link

 

This would be an acceptable network diagram in a real-world environment.

 

Additional Resources

 

Advanced IP Addressing Management: https://www.ciscopress.com/articles/article.asp?p=330807&seqNum=4

Concepts in IP Addressing: https://www.pearsonitcertification.com/articles/article.aspx?p=2169746&seqNum=6

VLSM Subnetting Explained with Examples: https://www.computernetworkingnotes.com/ccna-study-guide/vlsm-subnetting-explained-with-examples.html

 

Want to practice Cisco CCNA technologies on your laptop? Download my complete 350-page Cisco CCNA Lab Guide for free.

Libby Teofilo

Text by Libby Teofilo, Technical Writer at www.flackbox.com

With a mission to spread network awareness through writing, Libby consistently immerses herself into the unrelenting process of knowledge acquisition and dissemination. If not engrossed in technology, you might see her with a book in one hand and a coffee in the other.