menuGamaTrain
search

chevron_left CIDR (Classless Inter-Domain Routing): A method for allocating IP addresses chevron_right

CIDR (Classless Inter-Domain Routing): A method for allocating IP addresses
Anna Kowalski
share
visibility7
calendar_month2026-02-06

CIDR: Smarter Internet Address Bookkeeping

Understanding how the internet's addressing system evolved from rigid classes to flexible networks.
Imagine trying to distribute library cards but only having three box sizes: one for a single card, one for 65,000 cards, and one for 16 million cards. This was the old, wasteful internet addressing system. Classless Inter-Domain Routing (CIDR) fixed this by introducing a flexible, precise method for allocating IP addresses. This article explains how CIDR replaced the inefficient classful system using concepts like subnet masks and variable-length subnet masking (VLSM) to prevent address exhaustion and organize networks efficiently.

The Problem with the Old Classful System

Before CIDR, the internet used a classful addressing system. Think of it like a pizza shop that only sells pizzas in three fixed sizes: Small (for a single person), Medium (for a small party), and Large (for a huge festival). The problem was, if you needed to feed 20 people, you were forced to buy the "Large" festival-size pizza, wasting most of it. This is exactly how IP[1] addresses were wasted.

IP addresses are unique numbers assigned to every device on a network, like a home address for your computer. The old system divided all possible addresses into rigid classes:

ClassRange (First Bits)Network SizeHosts per NetworkAnalogy
A0...Very Few (126)16,777,214A country
B10...Many (16,384)65,534A large city
C110...Very Many (2 million+)254An apartment building

If a company needed 1,000 addresses for its computers, it had to take a whole Class B network (with 65,534 addresses), wasting over 64,000 addresses! This system was unsustainable as the internet grew rapidly in the 1990s, leading to the risk of running out of addresses entirely.

Key Takeaway: The classful system was inefficient because it forced organizations into one of three fixed network sizes, causing massive waste of precious IP addresses.

How CIDR Works: The Power of the Slash

CIDR, introduced in 1993, solved this by making network sizes flexible. Instead of predefined classes, it uses a concept called a prefix length, written with a slash (/). Think of it like being able to cut a pizza into any number of slices you want, not just three fixed options.

An IP address is a 32-bit binary number (for IPv4[2]). CIDR notation tells us how many of the starting bits are the network portion (the shared "street name") and how many are the host portion (the individual "house number").

Example: The address 192.168.1.0/24.

  • 192.168.1.0 is the network address.
  • /24 means the first 24 bits define the network. The remaining 32 - 24 = 8 bits are for hosts.
  • With 8 host bits, we can have $2^8 = 256$ total addresses. Subtracting the network and broadcast addresses gives us 254 usable addresses for devices.

The beauty of CIDR is that the slash number can be changed to create networks of almost any size:

CIDR NotationSubnet MaskNumber of Usable HostsBest For
/30255.255.255.2522A link between two routers
/26255.255.255.19262A small business office
/22255.255.252.01022A medium-sized school
/16255.255.0.065,534A large corporation

The formula to calculate usable hosts is: $ \text{Usable Hosts} = 2^{(32 - \text{Prefix Length})} - 2 $. We subtract 2 because each network reserves the first address (network address) and the last address (broadcast address).

Supernetting: Combining Small Networks

CIDR also enables supernetting or route aggregation. This is the opposite of dividing a network into smaller parts. Instead, it combines several small, contiguous networks into one larger announcement. This is crucial for the internet's backbone routers.

Real-World Analogy: Imagine a postal system. Without aggregation, a post office in another country would need a separate routing instruction for every single street in your city. With aggregation, it just needs one instruction for your entire city's ZIP code. Supernetting works the same way for internet traffic.

Technical Example: An Internet Service Provider (ISP) has been given these four contiguous Class C networks:

  • 203.0.113.0/24
  • 203.0.114.0/24
  • 203.0.115.0/24
  • 203.0.116.0/24

Instead of advertising four separate routes to the global internet, the ISP can combine them into one supernet: 203.0.113.0/22. This single entry covers all four original networks, dramatically reducing the size of the global routing table and making the internet faster and more scalable.

CIDR in Action: Planning a School Network

Let's see how a network administrator for a school district would use CIDR and VLSM[3] to efficiently allocate addresses from a single block.

Scenario: The school is assigned the IP block 172.16.0.0/21. This provides $2^{(32-21)} - 2 = 2046$ usable addresses. The district needs to divide this for:

  • Main High School: 500 devices
  • Elementary School: 250 devices
  • District Office: 60 devices
  • Connections between buildings: 2 devices each (4 links total)

The administrator uses VLSM to create custom-sized subnets without waste:

  1. High School: Needs a block for at least 500 hosts. The closest power of two is $2^9 = 512$ addresses. This requires $32 - 9 = 23$ host bits, so the prefix length is /23. The first subnet is 172.16.0.0/23.
  2. Elementary School: Needs ~250 hosts. $2^8 = 256$ addresses fits. Prefix length: /24. Next available subnet: 172.16.2.0/24.
  3. District Office: Needs ~60 hosts. $2^6 = 64$ addresses fits. Prefix length: /26. Next subnet: 172.16.3.0/26.
  4. Point-to-Point Links: Need only 2 hosts each. $2^2 = 4$ addresses is enough. Prefix length: /30. Four tiny subnets are carved from the remaining space, e.g., 172.16.3.64/30, 172.16.3.68/30, etc.

This efficient planning, impossible under the classful system, leaves room for future growth within the original /21 block.

Formula for Network Engineers: To find the number of subnets of a certain size you can create from a larger block, or to find the next available subnet address, network administrators use binary math and the concept of the "block size," which is $2^{(32 - \text{Prefix Length})}$.

Important Questions

Q1: Is CIDR only for IPv4, or does it work with IPv6 too? 
CIDR is even more critical for IPv6! IPv6 addresses are 128 bits long, an astronomically large space. Managing this without CIDR's flexible prefix notation would be impossible. IPv6 uses CIDR notation in exactly the same way, e.g., 2001:0db8::/32. The principles of defining a network portion and a host portion are identical.
Q2: I see subnet masks like 255.255.255.0 and CIDR like /24. What's the relationship? 
They are two ways of saying the same thing. A subnet mask is a 32-bit number where the network bits are all 1s and the host bits are all 0s. The mask 255.255.255.0 in binary is 11111111.11111111.11111111.00000000. If you count the '1's, you get 24. So, 255.255.255.0 is equivalent to /24. CIDR notation is just a shorter, more convenient way to write the subnet mask.
Q3: Did CIDR completely solve the IP address shortage? 
CIDR dramatically slowed down the exhaustion of IPv4 addresses by making allocation efficient and enabling route aggregation. However, it was a "stalling tactic," not a permanent solution. The finite pool of about 4.3 billion IPv4 addresses was still being used up. The long-term solution is the transition to IPv6, which has a nearly limitless address space. CIDR remains essential for managing both IPv4 and IPv6 networks efficiently during this transition and beyond.
Conclusion
Classless Inter-Domain Routing (CIDR) is a foundational technology that made the modern internet possible. By replacing the rigid, wasteful classful system with a flexible, prefix-based model, it conserved the limited IPv4 address space and allowed the internet's routing infrastructure to scale to global proportions. Through concepts like variable-length subnet masking (VLSM) and supernetting, CIDR gives network administrators the precision tools needed to design efficient networks of any size, from a home Wi-Fi to a multinational corporation. Understanding CIDR's "slash notation" is key to grasping how devices find each other on the vast digital map of the internet.

Footnote

[1] IP (Internet Protocol): The principal communications protocol for relaying datagrams (packets) across network boundaries. It defines the format of addresses (IP addresses) and the rules for routing packets from a source to a destination.

[2] IPv4 (Internet Protocol version 4): The fourth version of the Internet Protocol, which uses 32-bit addresses, providing approximately 4.3 billion unique addresses. It is the most widely deployed internet layer protocol.

[3] VLSM (Variable-Length Subnet Masking): The process of subnetting a network into subnets of various sizes, made possible by CIDR. It allows for much more efficient use of IP address space compared to fixed-size subnetting.

Did you like this article?

home
grid_view
add
explore
account_circle