What is a CIDR
If you have been responsible for creating AWS accounts and allocating IP address ranges you already know what this is and all about it. However, the first time I heard CIDR, all I could think of is the drink.

Strongbow apple cider
And then I learned more.
It stands for Classless Inter-Domain Routing.
This is an IP Address allocation technique.
While we are at it, just wanted to state the obvious: IP Addresses are limited in number. And this limitation led to the development of a new version of the internet protocol, IPV6.
Some history and details IPv4 vs IPV6
IPv4 uses 32-bit addresses, which can support up to 4.3 billion unique IP Addresses. Let us look at what that means.
Let’s look at an example: 125.133.5.43
. Every number separated by a dot is a segment of the IP Address which can hold a value of 0-255
. This is because each segment is 1 byte
, which translates to 8 bits
. i.e. each segment can store up to \(2^8\) numbers, which is 256
, but we start counting at 0
so 0-255
. So by that logic, the number of IP addresses that can be allocated by using the IPv4 system is \(2^{32}\), that comes upto 4.3 billion! This at the time of creation of the protocol, sounded like a big enough number.
However, technology has exploded over the last century! We have more devices connecting to the internet that we never thought would connect at all! Home appliances - your TV, washing machine, fridge, smart devices, phones, tablets, etc all have IP addresses! So suddenly 4.3 billion felt quite small.
Thus, IPV6 uses 128 bit addressing. That allows the allocation of 340 undecillion unique addresses! Large enough by today’s standards.
There were other reasons for creating IPv6 which includes improved packet processing efficiency, extensibility, security and others.
However, the question still remains - why have we not run out of IPv4 addresses yet?
This is due to the various strategies used by organisations and houses to enable clever local address range allocation like NAT, subnetting, etc. CIDR is one such address allocation method.
Why CIDR
What CIDR allows us to do is to divide an IP address space into multiple ranges based on a prefix. CIDRs are generally represented using a slash notation. This notation specifies the number of bits in the address used as a prefix.
For example, an IP address of 192.168.1.0
with a prefix length of 24 would be represented as 192.168.1.0/24
. This notation indicates that the first 24 bits of the IP address are the network prefix and the remaining 8 bits are the host identifier.
What is classless? Was there ever a class?
Yes.
Once upon a time, between 1981 and 1993, network addresses were allocated using 5 classes. A, B, C, D and E. Each defined by the first few bits of the address and serving specific ranges of purposes. The idea was to enable make configuration of networks easier. But this isn’t used any more.
For more information, I recommend reading Classful CIDR.
Why classy went out of fashion?
Because…no discrimination allowed based on class. Just Kidding.
Address wastage according the rules of the classy algorithm was a major concern. Reserving a range of addresses that may never be needed in the first place. Address allocation in classes were done by fixed-size reservations for A, B, and C classes. The size of the network required was never a consideration when allocating addresses, this resulted in reserved several amounting to millions of IPs that ended being unused.
To give you some additional context, let me try delving deeper. Even if an organisation required only a few thousand hosts in the network, with the classful addressing method, the full class A network block was assigned to the org. That would mean approximately \(128 \times 2^{24}\) addresses for the org.
If you are wondering how I came up with that number, you need to understood how the networks and classes are determined in classful addressing. I’m going to use the picture on GeeksForGeeks to demonstrate this.

Classful addressing
In classful addressing, for class A, 7 bits of the first octet are used for network ID and 0
and 127
are reserved. So of the 128
network IDs, you are left with 126 networks within Class A. That leaves 3-8byte blocks for addressing the hosts within the network \(2^{3 \times 8}\)
I don’t think I explain this in better detail than what’s already out there on the internet like on Classy IDR on geeksforgeeks. So I strongly recommend reading that first.
How classless is better?
Unlike the fixed block addressing in classful addressing, in the classless world, you have variable-length subnet masks. The Variable length subnet masks allows you to limit the address range required in a network.
Where in the classful networking work, address allocations were done primarily by the ISP, classless addressing focusses on aggregating multiple subnets into a single prefix.
There are multiple advantages to this as it helps delay IPv4 exhaustion, the aggregation results in smaller routing tables, more efficient routing with smaller routing tables, simpler network design!