What is CIDR? A Complete Guide to Classless Inter-Domain Routing
CIDR (Classless Inter-Domain Routing) is a method for allocating IP addresses and routing Internet Protocol packets that replaced the older classful addressing system. Introduced in 1993 by the Internet Engineering Task Force (IETF) in RFC 1518 and RFC 1519, CIDR was designed to slow the growth of routing tables and help delay the exhaustion of IPv4 addresses. Today, it is the foundation of modern IP networking and subnetting.
The Problem with Classful Addressing
Under the classful system, IP addresses were divided into fixed classes: Class A (1.0.0.0 to 126.0.0.0 with a /8 mask), Class B (128.0.0.0 to 191.255.0.0 with a /16 mask), and Class C (192.0.0.0 to 223.255.255.0 with a /24 mask). This rigid structure led to massive address waste because organizations received far more addresses than they needed. A company requiring only 50 hosts would be forced to take a Class C block of 254 addresses, wasting over 80% of the allocation. The internet routing table was also growing at an unsustainable rate.
CIDR solves this problem by allowing any prefix length from /0 to /32. Instead of being locked into /8, /16, or /24, network administrators can choose the exact prefix that matches their host requirements. For example, an office with 30 devices can use a /27 prefix (providing 30 usable hosts) instead of a wasteful /24. This flexibility is known as Variable Length Subnet Masking (VLSM), which enables hierarchical subnetting where different subnets within the same network can have different sizes.
How CIDR Notation Works
CIDR notation combines an IP address with a prefix length separated by a slash. The format is 192.168.1.0/24. The number after the slash tells you how many bits are used for the network portion. Since IPv4 addresses are 32 bits total, the remaining bits are available for host addresses. In 192.168.1.0/24, the first 24 bits are the network, leaving 8 bits for hosts, which gives 2^8 - 2 = 254 usable addresses (subtracting the network address and broadcast address).
Calculating the subnet mask from the prefix length is straightforward. Write the prefix as a binary number of that many 1s followed by 0s for the remaining bits, then convert to dotted decimal. A /24 becomes 24 ones followed by 8 zeros: 11111111.11111111.11111111.00000000, which is 255.255.255.0. A /26 is 255.255.255.192, providing 62 usable hosts. Each increment in prefix length halves the number of available host addresses.
Quick Reference
Key CIDR Calculations
Every CIDR calculation produces several critical values. The network address is the first address in the block where all host bits are zero. The broadcast address is the last address where all host bits are one. Between them lie the usable host addresses. The wildcard mask is the inverse of the subnet mask and is used in access control lists (ACLs). The total number of hosts is 2^(32-prefix), and the usable hosts subtracts the network and broadcast addresses (2^(32-prefix) - 2).
For example, take 10.0.0.0/8. The prefix is 8, meaning 8 network bits and 24 host bits. The subnet mask is 255.0.0.0. The network address is 10.0.0.0, broadcast is 10.255.255.255. The first usable host is 10.0.0.1 and the last is 10.255.255.254. Total hosts are 2^24 = 16,777,216, with 16,777,214 usable. This massive range is why large organizations use /8 blocks.
In contrast, 192.168.1.128/28 has a 28-bit prefix, mask 255.255.255.240, network address 192.168.1.128, broadcast 192.168.1.143, and only 14 usable hosts. This is perfect for a small department or a point-to-point link where only a few addresses are needed.
CIDR to Subnet Mask Conversion Table
Understanding the relationship between CIDR prefixes and subnet masks is essential. A /24 corresponds to 255.255.255.0, /25 to 255.255.255.128, /26 to 255.255.255.192, /27 to 255.255.255.224, /28 to 255.255.255.240, /29 to 255.255.255.248, and /30 to 255.255.255.252. Each step increases the network portion by one bit, halving the available host addresses. This table is a fundamental reference for any network engineer working with IP planning and subnet design.
Practical Applications of CIDR
CIDR is fundamental to modern networking. Internet Service Providers (ISPs) use CIDR to allocate address blocks to customers efficiently. Without CIDR, the global routing table would have collapsed under the weight of classful routing entries. Route summarization (also called supernetting) allows multiple CIDR blocks to be advertised as a single larger block, reducing routing table size. For instance, four /24 networks (192.168.0.0/24 through 192.168.3.0/24) can be summarized as 192.168.0.0/22.
Cloud providers like AWS, Azure, and GCP rely on CIDR for Virtual Private Cloud (VPC) design. When creating a VPC on AWS, you specify a CIDR block such as 10.0.0.0/16, then carve it into smaller subnets across availability zones. Understanding CIDR is essential for designing scalable cloud architectures, avoiding IP overlap when connecting networks via VPN or peering, and managing security group rules.
CIDR also plays a vital role in firewall rules, routing policies, and network access control lists. A single CIDR rule can permit or deny traffic to an entire address range, simplifying security management. As IPv4 exhaustion continues, efficient CIDR usage becomes even more critical, and tools like this CIDR calculator help network professionals make precise allocations quickly.