Skip to main content

IP in Practice: Classless Addressing & Subnetting

 In the previous posts, we looked at what an IPv4 address is and how it is used.  Subnetting builds on that foundation and plays a major role in IP addressing, but many learners find it challenging at first.I was in the same boat at first. Now, it is a breeze. What has helped me, and how can you fly through subnetting? In this post, we will specifically focus on how classless addressing and variable length subnet masking is implemented within networks.

If you would like to learn more about subnetting or need a refresher, see my other posts Subnets: Key to Network Organization and Subnetting Tips 

Classful vs Classless

What's the difference between these two addressing schemes? Let me ask you this: Have you ever tried on clothes and never could find the right size? It is too big or too small. The store doesn't have your size. What if you can get it tailor-made just for you? 

Now imagine you could design a subnet the same way you design a custom shirt. That's the contrast between classful and classless addressing. 

Classful addressing is like wearing one of those set sizes that don't fit what you are looking for.  That would be like giving everyone the same sized shirt. For example, the HR department has ten users, and the Finance department has 50 users. Giving both a full Class C block is a waste of space. That wasted space could be used for other departments that actually need it. Understanding the structure of your organization helps you avoid overprovisioning or under provisioning. 
 
Classless addressing is like having clothes tailored just for you. You are able to adjust the size of a network to fit your organization's needs. It gives you the flexibility to size networks correctly and use IP space efficiently. For example, a company can have different departments (IT, Finance, HR, etc) with different amounts of users. 

How do we meet the needs of each department? Classless addressing uses CIDR notation to do this. When you see a slash followed by a number, such as /24, it shows the number of network bits. Think of CIDR as the clothing label that tells you which part of the address is fixed. The network bits are like the size printed on the tag, which sets the main fit. The remaining bits, or host bits, give you room for individual device addresses.
 
Understanding this split between the network portion and host portion is the key to mastering CIDR.
 
CIDR Refresher
  • IPv4 addresses have 32 bits.
  • CIDR notation (/24, /30, /22, /16, /10) tells you the number of bits within your network - giving you the network ID.
  • Host bits: 32 - CIDR
  • Total number of IP addresses: 2host bits
  • Subtract 2 from the total number of IP addresses to find the number of available hosts. 
  • Subnet masks are longhand versions of CIDR values.
Understanding CIDR basics helps you build multiple subnet sizes. This becomes important when working with VLSM. 

Variable Length Subnet Mask

Imagine if every department had the same amount of space from a CIDR block. Some would have too much space while others would not have enough. Designing a subnet is similar to choosing a house. You size it for what you need and for what you can afford.

Network planning begins with understanding which departments need more address space. VLSM gives you a way to size each subnet with precision. This saves costs and address space. How does it work? Let's walk through an example. 

An organization has four departments that need dedicated space for their devices:
  • IT: 160 devices
  • Research & Development (R & D): 90 devices
  • HR: 50 devices
  • Legal: 30 devices 
RFC1918 Private Block: 10.1.0.0/22 
 
Devices include computers, phones, printers, IoT devices, and more. 

Step 1: Understand the Block (/22) 

The /22 prefix tells the network and host ID, the number of total IP addresses, the maximum number of host devices, and your IP address range.
 
It is important to understand certain CIDR values. Octet boundaries (/8, /16, /24) create clean subnet masks with full 255 values, which makes identifying network IDs easier.

A /22 does not land on a clean octet boundary. Since 22 is not a multiple of 8, you find the last full boundary instead. If you jump up to the next one, you lose a large amount of address space. For example, a /24 gives you only 256 addresses. A /16 gives you 65,536 addresses. The difference is huge and can affect your entire network design.
  • Last full boundary: /16 
  • /16 means the first two octets of the subnet masks are filled: 255.255.x.x
Where there is a 255, match that with the IP address. 
  • IP Block: 10.1.0.0
  • Subnet Mask: 255.255.x.x
  • Network ID: 10.1.0.0  
That is your network ID. If you need help filling in the rest of the subnet mask, see Subnetting Tips
 
Next, find the number of total IP addresses within the /22 block
First subtract the CIDR value from the number of bits within an IPv4 address (32 bits)
  • Host bits: 32 - 22 = 10

Once you have the number of host bits, use that as the exponent.  

  • Total addresses = 2^10 = 1024
  • Subtract 2 to find the number of hosts, which is 1022. 

Recap:

/22 Overview
IP Address Block 10.1.0.0/22
Subnet Mask 255.255.252.0
Network ID 10.1.0.0

 Step 2: Create your subnets

Now that we know how many hosts are available, we can break up the /22 block for the four departments. Which department needs the most space? Sort the subnets from largest to smallest. Always assign the biggest subnet first. The smaller ones then fit neatly into the remaining space.
 
See Subnetting Tips to see the process of creating subnets.
 
Using the 10.1.0.0/22 block, calculate the CIDR, number of IPs and usable hosts, and the subnet range for each:
  • IT: 160 devices
  • Research & Development (R & D): 90 devices
  • HR: 50 devices
  • Legal: 30 devices
  •  
     

    IT (160 devices)

    CIDR:

    Number of IPs:

    Usable Hosts:

    Network ID:

    First Host:

    Last Host:

    Broadcast:

    Research & Development (90 devices)

    CIDR:

    Number of IPs:

    Usable Hosts:

    Network ID:

    First Host:

    Last Host:

    Broadcast:

    HR (50 devices)

    CIDR:

    Number of IPs:

    Usable Hosts:

    Network ID:

    First Host:

    Last Host:

    Broadcast:

    Legal (30 devices)

    CIDR:

    Number of IPs:

    Usable Hosts:

    Network ID:

    First Host:

    Last Host:

    Broadcast:

     
     Consider these:
    • Do you have enough of an address space? Subnets are only as good as its address space. If the block of addresses is not sufficient, then it limits how many devices can get on the network.
    • Do you have too much space within a network? Extra space can be helpful because it gives the network room to grow and supports DHCP. It can also be risky because unused space can become wasteful or allow unauthorized devices. It begins with knowing how many devices your organization will need. If possible, break up that subnet even more.
    • Do you have too little space? The Legal department has just enough IPs, but it will not allow for growth. Consider your network plan if this is intentional or may need redesigning for future growth.  
    • In this scenario, the four departments do not use the entire /22 block. Realistically, companies are not limited to four departments. You can even create subnets within subnets. For example, the IT department might set aside a smaller block for VoIP phones. It all depends on your company needs. 

    Summary

    We are nearing the end of IPv4 and stepping closer to IPv6. How do you feel about subnetting now? If you still use pencil and paper, that is normal. Managing subnets at scale always requires documentation. As time goes on, you will find tiny tricks that can save you time. One such trick is a subnet calculator. In the next post, you will find an interactive calculator to see the breakdown that goes into subnetting.

    As the IPv4 section draws to an end, we will look at special types of IPv4 addresses and what can be done with the limited space it has.  

     


    Comments

    Popular posts from this blog

    How to Set Up a Cisco Router as a DHCP Server (Step-by-Step Guide)

    Lab time! Want to build a DHCP server?  In this lab, I will show you how to build your own DHCP server on a router using Cisco Packet Tracer, as shown above. By the end of this post, you will be able to create your own DHCP server with a Cisco 2911 router, perhaps in a home lab setting, and prepare you to build your own on other hardware.  Why a Router?  A DHCP server is a centralized, automated service that assigns important network configuration details to devices on a network, such as IP addresses. Without it, we would have to create manual entries for our entire network, which can be time-consuming and lead to errors. Traditionally, there are dedicated servers to handle these functions. There are many ways to implement a DHCP server in your topology, including a dedicated physical server, a virtual machine, cloud-based gateways, and firewalls. However, there are specific benefits to using a router as your DHCP server: Reduced infrastructure: While havi...

    Subnetting Tips

    When I was first introduced to subnetting, it was difficult to understand the math and the process behind it. I watched videos but it did not click. I focused more on how to calculate it than on the reasoning behind it. Why do we subnet? I remember seeing forward slashes followed by numbers, classes, letters, network and broadcast addresses - important terms that was overshadowed by just trying to grasp why certain numbers were used.  Years later, I hear the word "subnetting" in one of my courses, and it reminded me of my struggles. Yet, I was excited. It was a time for redemption. Example after example, I started to get them right but also got to understand how to create a subnet with sufficient space for devices. Because of this, I have grown to love subnetting.  For me, it took time - a break that lasted about two years followed by a curriculum that focused on the topic for a few weeks. If you find yourself struggling with subnetting, do not worry. It takes time. If someth...

    New Series: IP in Practice

    I have done a few posts on subnetting and the inner workings of DHCP. I wanted to do a post on IPv6 and a hands-on demo on implementing DHCP on actual networking equipment. However, I missed a few parts that I would like to cover that would particularly help in understanding how IP works and why it is needed. Unlike the previous series, this will be a direct approach to a certain protocol: Internet Protocol (IP). I recently started my first series, covering important ports, protocols, and acronyms used in the networking field. However, I realized not only is it difficult to address the ones to mention, but for some letters it's hard to find. The intended structure was to have several per letter not just one. The idea seemed fun and engaging, however, doing over 20 posts alphabetically on acronyms, ports, and protocols lacks order and deviates from the direct approach I want this blog to have. For that reason, I am putting it on hold indefinitely. It was fun at first, but it was not...