How CIDR work.
I remember sometime back when a Software Engineer at Amazon reached out to me for assistance in writing black box tests for their team. I was a Freelance Software Engineer at that point and apparently, he was a newly hired Junior Software Engineer. He was scared of asking his team for support every day. Long story short, I stumbled upon humongous files referencing CIDR blocks. For those who have successfully written test cases and comprehensively tested their applications, understanding how the different modules and components interact together is fundamental.
I stopped working with him for ethical reasons and Company security concerns, however, I left with a burning passion to understand how CIDR and other unrelated components work.
CIDR is an abbreviation for Classless Inter-domain routing which basically, is a method for specifying IP addresses and their associated subnet masks in a compact and flexible format.
CIDR Notation Format:
CIDR notation uses a format like this: IP_address/Prefix_length. For example: 192.168.1.0/24.
IP address and Prefix Length.
The IP Address (e.g., 192.168.1.0) is the base address of the Subnet. The Prefix-length (e.g., /24) indicates the number of bits set to 1 in the Subnet mask.
Advantages.
CIDR simplifies IP Address allocation, making it more efficient and flexible. It allows for IP address aggregation, reducing the size of routing tables in large networks.
Prefix Length and Subnet size.
A shorter prefix length represents a larger subnet(e.g., /16 covers more range of IP addresses than /24).
A longer prefix length represents a smaller Subnet (e.g., /28 provides a fewer IP addresses than /24).
CIDR examples.
/24 notation represents a subnet with a subnet mask of 255.255.255.0.
/16 notation represents a subnet with a subnet mask of 255.255.255.240.
Aggregation Using CIDR.
CIDR notation is particularly valuable for IP address aggregation. Multiple smaller IP address ranges can be represented as a single, larger range. This reduces the size of the routing tables and makes network management more efficient. For example, the CIDR notation 192.168.0.0/23 aggregates 192.168.1.0/24 and 192.168.2.0/24.
Variable -Length Subnetting Mask(VLSM).
CIDR enables Variable-Length Subnetting Mask (VLSM), a technique that allows subnets of different sizes within the same network. This flexibility is vital for optimizing IP Address allocation in complex network designs.
IPv6 and CIDR:
CIDR notation is also used in IPv6, which uses a much larger address space than IPv4. IPv6 CIDR notation follows the same principles, allowing for efficient address allocation in IPv6 networks.
Steps for Using CIDR.
To work with CIDR, the following steps should be followed.
Identify the base IP address for the Subnet.
Determine the prefix length (e.g., /24).
Calculate the Subnet mask based on the Prefix length.
Understand the size of the Subnet and the number of available host addresses.
In conclusion, CIDR is fundamental in network design, especially in large networks, as it allows for efficient allocation of IP addresses and simplifies routing.
Below is how to calculate the prefix length.
Thank you for your time.
Subscribe to my newsletter
Read articles from Ian Carson directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Ian Carson
Ian Carson
A Disciplined, keen on details, and curious problem solver. I read and code a lot. I believe in Teamwork, Accountability, Transparency, and Competency.