What is CIDR and how does it work
CIDR (Classless Inter-Domain Routing) is the modern way to represent IP networks without relying on the old A/B/C classes. Instead of a “class,” we use a slash suffix that indicates how many bits of the mask belong to the network (e.g., /24).
The larger the prefix (e.g., /28, /29, /30), the fewer available hosts; the smaller the prefix (e.g., /16, /17, /18), the larger the network. This flexibility reduces address waste and simplifies routing.
How to convert CIDR to decimal mask (step by step)
1) Take the prefix (e.g., /26). 2) Fill 26 bits with 1 and the rest with 0 (32 bits total). 3) Split into groups of 8 bits (octets). 4) Convert each octet to decimal. Example: /26 → 11111111.11111111.11111111.11000000 → 255.255.255.192.
Common mistakes (and how to avoid them)
- Confusing prefix with mask: “/24” is not the same as “/16”. Always verify the generated mask.
- Mixing IPv4 and IPv6 logic: their sizes and masks differ.
- Ignoring the real subnet size when planning VLANs and ACLs.
- Forgetting that very large networks can cause excessive broadcast traffic in legacy setups.
Best planning practices
- Define blocks with expected growth: choose prefixes that allow expansion without readdressing everything.
- Standardize ranges by function (users, servers, IoT) to make filtering and security easier.
- Document each subnet: CIDR, mask, gateway, host range, and purpose.
- Automate checks with scripts or tools to reduce manual errors.
Practical example
If you have 4 teams with up to 50 devices each, a /24 network can be divided into four /26 subnets (each with 62 usable hosts): easy to manage and scalable.