CIDR — What It Is, How It Works, and Why It Matters
What is CIDR?
Classless Inter-Domain Routing (CIDR) is an IP addressing method that replaced the old class-based system (Class A/B/C). CIDR represents IP address blocks using a prefix notation: an IP address, followed by a slash and a number (for example, 192.168.1.0/24). The number after the slash is the prefix length and indicates how many bits are fixed for the network portion.
Why CIDR replaced classful addressing
- Flexibility: CIDR allows networks of any size, avoiding wasted address space inherent in fixed classes.
- Aggregation: CIDR supports route aggregation (supernetting), shrinking global routing tables and improving routing efficiency.
- Efficient address use: ISPs can allocate address blocks closely matched to customer needs.
How CIDR notation maps to masks and hosts
- The prefix length (/n) tells you how many bits are the network part. The remaining (32 − n) bits are for hosts.
- Subnet mask example: /24 → 255.255.255.0
- Hosts per subnet: usable hosts = 2^(32 − n) − 2 (subtract network and broadcast), except in special cases where those are usable.
Quick examples:
- /32 — single host (1 address)
- /30 — 2 usable hosts (commonly for point-to-point links)
- /24 — 254 usable hosts
Calculating network, broadcast, and host range
- Convert IP and mask to binary.
- Apply the mask: network = IP & mask.
- Broadcast = network | (~mask).
- First usable = network + 1. Last usable = broadcast − 1.
CIDR aggregation (supernetting)
Combine contiguous blocks with the same prefix lengths to form a larger block with a shorter prefix when possible (e.g., two /25 blocks → one /24).
Best practices
- Plan address allocation hierarchically (ISP → region → site → subnet).
- Use smallest subnets that meet needs to conserve space.
- Reserve /32s for loopbacks and /127 for point-to-point IPv6 links where applicable.
Tools and commands
- Linux: ipcalc, sipcalc
- Windows: PowerShell’s IPAddress class or third-party calculators
- Routers: Most vendor CLIs support CIDR prefixes directly.
Conclusion
CIDR is fundamental to modern IP networking—enabling efficient address allocation, scalable routing, and flexible subnetting. Understanding prefix lengths, mask conversions, and aggregation is essential for network design and troubleshooting.
Leave a Reply