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 /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:

    Subnet:

    First Host:

    Last Host:

    Broadcast:

    Research & Development (90 devices)

    CIDR:

    Number of IPs:

    Usable Hosts:

    Subnet:

    First Host:

    Last Host:

    Broadcast:

    HR (50 devices)

    CIDR:

    Number of IPs:

    Usable Hosts:

    Subnet:

    First Host:

    Last Host:

    Broadcast:

    Legal (30 devices)

    CIDR:

    Number of IPs:

    Usable Hosts:

    Subnet:

    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

    IP in Practice: Special IPv4 Addresses

    We have already discussed three private ranges used in classful and classless subnetting. The list does not stop there. This post identifies six types of special IP addresses that you will encounter. By the end of this post, you should have a clearer understanding of how these addresses are used in troubleshooting, how they appear on certification exams, and how they shape the way traffic moves across the Internet. 1. Loopback Address (127.0.0.1) Every networked device has a loopback address. Most commonly, it is 127.0.0.1 . The loopback address is typically used to test internal connections. You may wonder, “Why do I need to know if my device can connect to itself? Shouldn’t it connect to other resources and the Internet?” Think about it this way. Before you walk out the door, you make sure you look presentable by taking a shower, brushing your teeth, ironing your clothes, and checking yourself in the mirror. Once everything looks good, you are ready to go. Similarly, your compute...

    IP in Practice: Public and Private IP Addresses

    Do you speak another language? Personally, I love learning new languages, but one of the hardest parts is translation. When it comes to networking, it is something similar. Devices within our home and office networks do not directly go to the internet. There needs to be a "translator". What does this have to do with public and private IPv4 addresses? In this post, we will explore: IPv4 Addresses Private Ranges  The difference and teamwork between NAT and PAT Helpful troubleshooting commands such as ipconfig or ping A demo that puts it altogether.  (Link to topology here .) By the end of this post, you will see how public and private IP addresses work together in action.  IPv4 Address Private Ranges RFC1918 Private IP Address Ranges Class IANA Blocks Range Total Addresses A 10.0.0.0/8 10.0.0.0 - 10.255.255.255 16.7 million (16,777,216) ...

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