Support

Find answers, guides, and tutorials to supercharge your content delivery.

What Is CIDR (Classless Inter-Domain Routing)?

Updated on October 4, 2018
What Is CIDR (Classless Inter-Domain Routing)?

CIDR, which stands for Classless Inter-Domain Routing, is an IP addressing scheme that improves the allocation of IP addresses. It replaces the old system based on classes A, B, and C. This scheme also helped greatly extend the life of IPv4 as well as slow the growth of routing tables.

In this article, we'll explore how CIDR actually works, as well as provide examples to better demonstrate the concepts explained.

Problems with class-based IP addressing

The old method of IP addressing came with inefficiencies that exhausted the availability of IPv4 addresses faster than it needed to. The classful routing system included classes A, B, and C:

  • Class A - Over 16 million host identifiers
  • Class B - 65,535 host identifiers
  • Class C - 254 host identifiers

The problem would commonly occur when an organization required more than 254 host machines and therefore would no longer fall into class C but rather class B. This means that the organization would use a class B license even though they had far less than 65,535 hosts. Therefore if an organization only required 2,500 hosts, they would be wasting about 63,000 hosts by holding a class B license which would greatly decrease the availability of IPv4 addresses unnecessarily.

How does CIDR work?

CIDR is based on variable-length subnet masking (VLSM). This allows it to define prefixes of arbitrary lengths making it much more efficient than the old system. CIDR IP addresses are composed of two sets of numbers. The network address is written as a prefix, like you would see a normal IP address (e.g. 192.255.255.255). The second part is the suffix which indicates how many bits are in the entire address (e.g. /12). Putting it together, a CIDR IP address would look like the following:

192.255.255.255/12

The network prefix is also specified as part of the IP address. This varies depending upon the number of bits required. Therefore, taking the example above, we can say that the first 12 bits are the network part of the address while the last 20 bits are for host addresses.

Wikipedia's IPv4 CIDR blocks table below provides a good overview of how varying address formats render a different number of addresses. Formats are also categorized by typical uses.

CIDR example

We've already covered what a CIDR IP address looks like, now let's go over a couple of examples that break down their formatting. The CIDR Calculation tool is great if you want to easily determine what IP range a particular CIDR address equates to. Simply enter the CIDR address into the tool and click Calculate. This will return information such as the first IP, last IP, number of hosts and more.

Similarly, you can also convert an IP range to a CIDR. For example, let's say you wanted the CIDR notation for IP ranges between 192.0.0.0 and 192.0.0.255. You would simply plug these two numbers into the IP Range to CIDR tool and have it return the corresponding CIDR address.

Summary

CIDR is a great way to improve the efficiency of IP address distribution. It was vital with IPv4 as IP addresses were quickly being exhausted. IPv6 is now rolling out and although running out of IP address is now less of a problem, CIDR will continue to be used. Read our IPv6 tutorial guide to learn more about what differences exist in the newest version of the Internet Protocol.

Supercharge your content delivery 🚀

Try KeyCDN with a free 14 day trial, no credit card required.

Get started
KeyCDN uses cookies to make its website easier to use. Learn more