CIDR

What is CIDR?

CIDR, short for Classless Inter-Domain Routing, is the modern and more efficient alternative for allocating and routing IP addresses on the internet. It was developed as an alternative to the ‘Classful’ architecture to solve its major limitations:

  • The rapid exhaustion of IPV4 addresses.
  • To mitigate the growth of routing tables.

Why was CIDR Needed?

The primary need for CIDR was to overcome the problems created by and the limitations of the older Classful architecture of IP  allocation. Simply put, this architecture divided the divided the IPv4 address space (0.0.0.0-255.255.255.255) into five classes: A, B, C, D, and E.

Class Network Mask No of Networks Number of Hosts per network IP address range
A 255.0.0.0 128 16,777,214 0.0.0.0 – 127.255.255.255
B 255.255.0.0 16,384 65,534 128.0.0.0 – 191.255.255.255
C 255.255.255.0 2,097,152 254 192.0.0.0 – 223.255.255.255
D N/A N/A N/A 224.0.0.0 – 239.255.255.255
E N/A N/A N/A 240.0.0.0 – 255.255.255.255

Each class was reserved for a specific purpose:

  • Class A IP addresses were reserved for Reserved for large organizations, universities, etc.
  • Class B  IP addresses were allocated to medium-sized organizations
  • Class C for smaller networks
  • Class D for multicast communication, and
  • Class E IP addresses were reserved for future use

Take, for example, a small organization that required only 5000 addresses. They would have been assigned a Class B network that can support 65,534 addresses. As a result, a whopping 60,534 addresses remained unused on the network. This rigid system of allocation resulted in inefficient use of IP addresses and faster exhaustion of IPv4 address space.

How Does CIDR Allocation Work Around this Problem?

Classless Inter-Domain Routing is based on the preface that IP addresses can be allocated and routed based on their network prefix rather than their class, which was how IP address allocation was carried out in the previous system. It does this by using the concept of subnetting to divide IP address space into smaller, more manageable blocks.

This means that network prefixes can have variable lengths, ranging from 1 to 32 bits, depending on the size of the network or subnet.

Continuing with the same example as earlier, a /19 CIDR block has 8,192 IP addresses, which is enough for a small organization that requires only 5,000 addresses.

As a result, there is less waste of IP addresses (3192 as opposed to  60,534 in the previous system), and because the organization now is just allocated a smaller number of IP addresses (8192 vs 65,534) routing tables too don’t need to grow as much improving efficiency.

CIDR Notation and Blocks

CIDR notation is a compact way of representing a network prefix and its length. It consists of an IP address followed by a slash (/) and a number that indicates how many bits are used for the network prefix.

For example, 192.168.1.0/24 means that the first 24 bits of the IP address are used for the network prefix, and the remaining 8 bits are used for the host identifier.

A CIDR block is a contiguous range of IP addresses that share the same network prefix.

For example, 192.168.1.0/24 is a CIDR block that contains 256 IP addresses, from 192.168.1.0 to 192.168.1.255. CIDR blocks can be subdivided into smaller blocks by increasing the network prefix length. For example, 192.168.1.0/24 can be divided into two CIDR blocks of /25, each containing 128 IP addresses.

This combination allows for more flexible and efficient allocation and routing of IP addresses, as they can accommodate networks of different sizes and reduce the number of entries in routing tables.

CIDR blocks on the IPV6 standard use 128 bits (compared to the 32 bits of the IPV4 standard) which allows for 340 undecillion unique IP addresses.