Classless Inter-Domain Routing — is how the abbreviation CIDR stands for. It came to replace the original so-called classful IPv4 routing and address allocation policies. That is, CIDR is an IP addressing scheme, which is useful because it improves the allocation of IPv4 addresses.
Initially, there were three classes — “A”, “B” and “C”, in which IPv4 blocks were divided. Class “A” contained 16 million addresses, Class “B” — 65 thousand, Class “C” — 256 addresses. Due to the lack of granularity, the allocations and usage of IPv4 addresses, in which there was an increasing shortage, was inefficient. So CIDR solved this problem.
Instead of classes, the nomenclature is used, which allows blocks of variable size. The CIDR notation is a compact representation of an IP address and its associated network mask. The CIDR notation defines an IP address, a slash character /), and a decimal number. Since the total number of bits in an IPv4 address is 32 bits, the size of the subnet mask can vary from a/0 to a/32. This made it possible to describe any IPv4 block size without class restriction of three sizes.
For example, the smallest original class “C” contains 256 addresses. In the CIDR notation, it is written as a/24. That is, having 32 bits of address space — 24 bits are masked, leaving only 8 bits of address space in the block. In binary, 8 bits = 256 possible numbers. Also with class “A”, it is written as a/8, and 24 bits of address space remain in the block. In binary, 24 bits = 16 million possible addresses.
The advantage is that with this allocation we get more available address space. For example, a company needs 500 addresses. With the original system we were considering, Class “B” was required, since “C” would not be enough. And CIDR allows you to distribute addresses in such a way as not to waste a whole class B. Thus, the distribution can be a /23, twice as large as a /24, and provide 512 addresses.
Thanks to CIDR, IPv4 addresses are still available. Whereas in 1990 it was expected that in a few years they would be completely exhausted.