Understanding CIDR and Subnetting: A Practical Guide
You see them everywhere in cloud configurations, routers, and firewalls: IP addresses with a slash and a number at the end, like 192.168.1.0/24 or 10.0.0.0/16. This is CIDR notation. If you don't know how to read it, setting up any secure network is guesswork. Subnetting is how we partition a network, and it is a fundamental skill for any network engineer.
The Problem CIDR Solved
In the early days of the internet, IP addresses were divided into Class A, B, and C networks. If you needed 300 IP addresses, a Class C network (256 addresses) was too small, so you had to buy a Class B network (65,536 addresses). This wasted millions of IP addresses. In 1993, RFC 1519 introduced CIDR (Classless Inter-Domain Routing). CIDR allowed custom-sized networks by using variable-length subnet masking (VLSM).
What the Slash Number Means
An IPv4 address consists of 32 bits, divided into 4 octets (each having 8 bits). The number after the slash (e.g., /24) represents the **Prefix Length** — the number of bits reserved for the network portion of the address. The remaining bits (32 minus prefix length) are used for host devices on that network.
For example, in **192.168.1.0/24**:
- 24 bits are for the network.
- 8 bits are left for hosts (32 - 24 = 8).
- 8 bits allows for 28 = 256 total IP addresses.
The Reserved Addresses
In every subnet, you cannot use all the available IP addresses for devices. Two addresses are always reserved:
1. **Network Address:** The first address in the block (e.g., 192.168.1.0). It represents the subnet itself.
2. **Broadcast Address:** The last address in the block (e.g., 192.168.1.255). It is used to send data to all hosts on the subnet.
Therefore, the number of usable host addresses is always **2(32 - prefix) - 2**.
Common CIDR Prefix Cheat Sheet
Here is a quick reference for common prefix sizes:
- **/30:** 4 total IPs (2 usable). Often used for point-to-point router links.
- **/28:** 16 total IPs (14 usable). Useful for small office departments.
- **/24:** 256 total IPs (254 usable). The standard size for most local home networks.
- **/16:** 65,536 total IPs (65,534 usable). Typically used for cloud VPC environments.
Calculate Subnets Instantly
Use our Subnet Calculator to instantly partition your IP range, get network details, and plan your network layout.
Use Subnet CalculatorAbout Kunal Khatri
Kunal is a network security specialist and systems administrator with 8+ years of experience auditing secure connections and building network infrastructure.
Related Articles
Network Latency: What It Is and How to Actually Reduce It
Latency is the delay in network communication. It's not the same as bandwidth, it can't be fully eliminated, and most advice for reducing it misses the real causes.
TTL (Time to Live) in Networking: A Real Explanation
TTL appears in both DNS records and IP packets, doing different but related jobs in each context. Understanding both uses makes network troubleshooting much easier.
MAC Address vs IP Address: What's the Difference
MAC addresses and IP addresses both identify devices on networks — but at different layers, for different purposes, with different implications for privacy and security.
Port Forwarding: When You Need It and How to Set It Up
Port forwarding is how you make services running inside your home network accessible from the internet. The setup is simple. The security implications deserve more attention.
