In this Cisco CCNA training tutorial, you’ll learn how to subnet Class C networks and how Variable Length Subnet Masking or VLSM works. Scroll down for the video and also text tutorial.

#### Subnetting Class C Networks and VLSM Video Tutorial

### Robert Kilroy

Hi Neil, I’m one of your students and I’m writing to inform you that I passed the CCNA yesterday. I initially studied with books, but wasn’t satisfied with my practice test results, so I picked up your course and it helped greatly.

I’m a recent college graduate, and I took Cisco Networking Academy courses while I was in high school, so the CCNA had been a goal of mine for a long time. Now I’ve received a job offer and I start next month; I’m excited for the opportunities this certification will bring me.

Thanks for creating such a quality course. I definitely will use your content again when it comes time to re-certify.

**Class C /31 Subnet**

Let's say that we've been allocated the Class C network 200.15.10.0/24. We're going to move the line all the way to the right and we're going to go with a /31.

Obviously, we can't do a /32 if we want to have more than one available host. You can use a /32 subnet for a single host which is mostly used for loopback addresses.

If we wrote that subnet mask in dotted-decimal notation, it would be 255.255.255.254. We get the 254 because it's 128 plus 64, 32, 16, 8, 4 plus 2 comes up to 254. That leaves one bit for the host address, which has a possible value of a one or a zero.

Class C /31 borrows 7 bits for the network address from the host address. That gives us 128 subnets, which is 2 to the power of 7. /31 can accommodate two hosts each.

The valid host addresses would be 200.15.10.0 to 200.15.10.1, 200.15.10.2 to 200.15.10.3, 200.15.10.4 to 200.15.10.5, all the way up to 200.15.10.254 and 200.15.10.255. We're using 200.15.10.0, the first three octets are never going to change. The last octet you just start will all zeros. Then, it would be 0000001 and zero and one, 0000010 and zero and one, etc.

But wait, if we're using a /31, there are only two possible values to assign to the host. What about the network and broadcast address?

/31 subnet breaks the standard rules of IP addressing where we have to have the network address and the broadcast address. /31 subnets are supported on Cisco routers for point to point links.

If you think about it, a point to point link is for just one side and the other side. Any traffic that comes from this side needs to go out on the other side and vice versa. The traffic has nowhere else to go, therefore, there’s no point in having a network and a broadcast address. Hence, Cisco allowed that exception.

**Class C /30 Subnet**

Next up, we're going to create a /30. The subnet mask in dotted-decimal is 255.255.255.252 and it will be going to leave 2 bits for the host address.

That is 2 to the power of 2 is 4, minus 2 for the network and the broadcast address, and that gives us 2 possible hosts. It borrows 6 bits for the network address and it can accommodate 2 hosts each.

On the first subnet, the network address is 200.15.10.0 and the broadcast address is 200.15.10.3. The valid addresses are 200.15.10.1 and 200.15.10.2. The next subnet has the network 200.15.10.4 and the broadcast is 200.15.10.7. The valid range would be 200.15.10.5 to 200.15.10.6.

In the next subnet, the network would be 200.15.10.8, the valid addresses would be 200.15.10.9 and 200.15.10.10, and the broadcast would be 200.15.10.11, and so on.

As you look at this, you can calculate what the different valid subnets are going to be by noticing where the line is. It's after number 4, so the network address is going to go up in values of 4. The first network address is 200.15.10.0, next would be network address 200.15.10.4. The next network address is 200.15.10.8, 200.15.10.12, 200.15.10.16, etc.

We know the network addresses therefore, we can work out what the broadcast and the range of valid IP addresses are going to be. In our example, it's going up in values of 4.

The first subnet is going to be a zero. 200.15.10.0 is the network address and because the next range starts at 200.15.10.4, the broadcast address must be 200.15.10.3.

If 200.15.10.0 is the network address, and 200.15.10.3 is the broadcast address, the valid host addresses must be 200.15.10.1 and 200.15.10.2. The next subnet starts at 200.15.10.4.

The next subnet after that is 200.15.10.8, so the broadcast address must be 200.15.10.7. The network address of 200.15.10.4 and broadcast address of 200.15.10.7 leaves the addresses in between 200.15.10.5 and 200.15.10.6 which are available to be assigned to our hosts.

**/31 vs /30**

/31 and /30 both supported two hosts per subnet. But a /31 supports 128 subnetworks and a /30 only supports 64 subnets. You're maybe thinking, "Oh well we're always going to use /31 then." A /31 is useful if you need to maximize the use of your address space, but a /30 is more commonly used. It's more standardized.

For the CCNA exam, if you get a question where you've got to choose whether you would use either a /31 or a /30, always use a /30. If the question requires you to come up with a subnet that supports 2 hosts, use a /30 unless the question explicitly tells you to use a /31.

**Class C /29 Subnet**

Next up is a /29, we're going to move the line back a space again. A /29 in dotted decimal is 255.255.255.248. Again, we got the 248 because it's 128, plus 64, plus 32, plus 16, plus 8, up to where the line is.

That leaves 3 bits for the host address. 2 to the power of 3 is 8 minus 2 for the network address and the broadcast address will give us 6 available host addresses. The default subnet mask for Class C is /24.

Here, we're using a /29 so we're borrowing 5 bits for the network address. 2 to the power of 5 is 32 so, we've got 32 available subnets here.

Notice that the line is after the 8, therefore, the network addresses are going to go up in values of 8. The first one will be 200.15.10.0, then 200.15.10.8, then 200.15.10.16 and so on.

In the first subnet, the network address is 200.15.10.0. The next subnet the network address is 200.15.10.8, so the broadcast address for the first subnet must be one less, which is 200.15.10.7. If the network address is 200.15.10.0 and the broadcast address is 200.15.10.7, that leaves 200.15.10.1 to 200.15.10.6 available addresses to be assigned for our hosts.

The next subnet starts with 200.15.10.8, and the following subnet is at 200.15.10.16. Our broadcast address now must be 200.15.10.15, which leaves the available host addresses of 200.15.10.9 to 200.15.10.14. We can go on up to network address 200.15.10.248 and 200.15.10.255 broadcast address, with host addresses 200.15.10.249 to 200.15.10.254.

**Other Class C Subnet Masks**

We can carry on moving the line back a place. We did /31, /30, /29. We could also do a /28, which is 255.255.255.240. It will give us 16 networks of 14 hosts each on a Class C. Again, the default is a /24.

If we are using a /28 we've borrowed 4 bits and 16 available subnets. We've also got 4 bits available for our host addressing. That is 2 raised to the power of 4 equals 16 minus 2, for the network and broadcast addresses, and it gives us 14 usable hosts.

We can move the line back again to a /27. That's going to be borrowing 3 bits. So that is 8 available networks. Leaving 5 bits available for our hosts, which will be 32 minus 2, gives us 30 available hosts.

A /26 is 4 networks and 62 hosts. A /25 is 2 networks and 126 hosts. /24 is the default 1 network with 254 hosts. That's how we carry out subnetting and figure out how many networks, and how many hosts we're going to have.

**Variable-Length Subnet Masks VLSM**

The next thing to tell you about is Variable-Length Subnet Masks. With early routing protocols, like RIP version 1, they only supported fixed-length subnet masks. It means that you could perform subnetting but all subnets in a particular network had to be the same size.

All of your different subnets had to accommodate 14 hosts, for example, or 30 hosts for example. If you had one subnet that needed up to 30 hosts, you have to allot all your subnets a size of 30 hosts even if only one of them had 3 hosts in it.

With later routing protocols, they came out with support for Variable-Length Subnet Masks. That means that within the same range you can have different sizes of subnets in there.

Let’s say, I've got one part of my network which has got 10 hosts in it. I could give them 14 available hosts and another part of the network that's got 28 hosts there. I could give them a subnet mask that gives them 30 available hosts.

Variable-Length Subnet Masking means we can use different length subnet masks within the same network. This is a good thing because it lets us be much more precise with the size of our networks and we're going to be wasting a lot fewer addresses.

**Additional Resources**

Cisco Networking Basics: IP Addressing: https://www.networkcomputing.com/networking/cisco-networking-basics-ip-addressing

Constructing an IP Network Addressing Scheme: https://www.learncisco.net/courses/icnd-1/lan-connections/network-addressing-scheme.html

Cisco CCENT Practice and Study Guide: Subnetting IP Networks: https://www.ciscopress.com/articles/article.asp?p=2169292&seqNum=2

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