There are around 4 billion IPv4 addresses in the world. It might sound crazy, but those 4 billion addresses are somehow enough for even more users and devices. But how? Shouldn’t the IPv4 pool have been depleted by now? Maybe it’s due to how regions distribute IPs, in which case you might end up sharing the same IP address with 23,999 other people, like in North Korea.
Or maybe it’s about clever and less drastic solutions, designed to increase the lifespan of IPv4. And you will see that one of the most important is CIDR (Classless Inter-Domain Routing), an alternate method of representing a subnet mask.
What is CIDR notation?
Classless Inter-Domain Routing (CIDR) is used to better allocate and manage IP resources. This notation is simply a count of the number of network bits (bits that are set to 1) in a subnet mask.
CIDR was designed to slow down the increase of routing tables (a set of information that is used by routers to determine the optimal path data can take to arrive at its destination) and preserve the IPv4 lifespan.
CIDR notation by itself is not necessarily something over-complicated, but it is important to understand how it works and how it relates to the process of subnetting and supernetting.
A long time ago, we discussed subnetting and its significant contribution to keeping IPv4 alive. This is why you might find some things discussed here quite familiar. If this is your first time hearing about subnetting, don’t worry, we will put them into context so you can easily understand what this is all about.
What is a subnet mask?
A subnet mask divides an IP address into a network and host parts. An IP address is made up of four octets, like in this example: 126.96.36.199. We call them octets because IP addresses are actually 32-bit addresses, interpreted by computers in binary code. Here’s what the address looks like in binary:
So, four dots, meaning four divisions, multiplied by those eight bits, equal 32 bits. For IPv4 addresses, the first three octets are the network part, and the fourth octet represents the host part, so for our example, the address 188.8.131.52 is divided as follows:
Subnet masks do more than just separate the network part from the host part. They come as a hint that helps us determine how many IP addresses can exist based on that class and respective subnet mask.
What are IP classes?
In simplest terms, it’s about a network addressing technique that CIDR aims to make super easy. IPv4 addresses are usually divided into five classes, but the most commonly used classes are A, B, and C.
You can identify the class of an IP address by looking at its first octet (the first numbers before the first dot). The classes themselves mainly describe the IP range, based on intervals:
Just a quick reminder that each IPv4 class has its own default subnet mask as well. Subnet masks are also important for subnetting (the process of dividing a network into smaller networks). But in order to keep it nice and clean, IPs are joined by a slash notation, which brings us again to CIDR.
This is pretty much a compact way to show or write an IPv4 subnet mask. When you use slash notation, you write the IP address, a forward slash (/), and the subnet mask number. For example, the subnet mask 255.255.255.0 has the slash equivalent /24, which implies that 256 IP addresses can connect on a single host. To be more specific, you can have 256 devices that can connect to a single network.
The process of finding the slash equivalent of the desired subnet mask can be time-consuming since you have to do binary conversions and count all the ‘1’ bits. For your convenience, you can check our in-depth guide on subnetting that also provides a complete IPv4 subnet mask cheat sheet you can always refer to.
CIDR blocks and Supernetting – What are they?
While CIDR is super useful for subnetting, it also brings advantages in other networking processes. Enter CIDR blocks! These are groups of IP addresses that have the same network prefixes and number of bits.
Taking CIDR blocks that share a network prefix and combining them into a larger network is called supernetting. In essence, supernetting is the opposite of subnetting.
Whereas subnetting means dividing a network into smaller networks, supernetting means combining multiple networks into a Supernetwork. Literally. And that’s one of the most important traits of CIDR.
A CIDR block always contains IPs that have identical address prefix in their binary notation and the same number of bits. Large blocks can be told apart from small blocks based on the length of the prefix.
To be more specific, a short prefix shows that more addresses that form a bigger block, while a longer prefix indicates a smaller block with fewer IP addresses.
How are CIDR blocks allocated?
When it comes to assignment, the Internet Assigned Numbers Authority (IANA) allocates larger CIDR blocks to Regional Internet Registries (RIRs). Next, RIRs divide them into blocks and assign them to Local Internet Registries (LIRs). Then, these smaller blocks are further split into separate addresses for end-users.
When it comes to assigning blocks to end-users for private networks, ISPs (Internet Service Providers) do that. But, if an organization works with multiple ISPs, then it can get CIDR blocks straight from RIRs or LIRs, without the implication of ISPs.
You should also remember that for routed subnets that are bigger than /31 or /32, two addresses are always reserved and must be taken away from the total number of available addresses.
The largest one is used as a broadcast address. The smallest one is used to identify the network itself.
Why is CIDR so important?
Class Inter-domain Routing was created in 1993 by the Internet Engineering Task Force. It is a way of slowing down the IPv4 depletion process, as those 4 billion addresses we mentioned before are simply just not enough for our modern needs anymore.
CIDR lets us manage and assign IPv4 addresses more efficiently and spares us the hassle of having to deal with multiple other inconveniences, such as a classful routing system and less efficient data traveling, and extra routing tables. Let’s take them one by one.
To begin with, the original class-based IP addressing we discussed above became inefficient in keeping enough IPv4 addresses for our modern needs. That is because each class has a maximum number of possible hosts, like so:
This traditional classful addressing can be unreliable and wasteful. If an organization wants more host identifiers than a class can provide, it can move its network to another class.
But if the organization does not need or does not make use of all the host identifiers within the new class, the unused ones go to waste
Faster network traffic
Since it does not have to do with classes, CIDR can organize IP addresses into multiple subnets without being dependent on the IP’s value.
CIDR allows routers to reach network traffic destinations much more quickly compared to the old subnetting that was based on classful addressing.
More efficient network routing
CIDR allows for supernetting, which translates into more efficient network routing. Instead of multiple entries in the routing table, CIDR lets you get away with route aggregation, meaning a singular routing table entry.
Thus, you will benefit from less wasted address space and a more efficient way of defining network addresses, because only the router closer to the destination actually needs to know the details.
Clarity and reliability
Before CIDR was invented, some subnet masks could not be used because their binary equivalents would be easily mistaken for network identifiers. The introduction of CIDR was extremely helpful in distinguishing the two and creating unique identifiers.
Using subnet masks to their fullest means better subnetting, which means:
A. Increased IPv4 lifespan because fewer resources are wasted;
B. Increased speed and overall performance of the network. That is because the traffic never leaves its designated subnet.
Are there any disadvantages to CIDR?
The majority of network engineers and administrators agree that CIDR is a lifesaver. At least in general. What gives them some trouble, however, is the complexity of CIDR.
This method is a bit more tedious compared to old-school classful addressing. When you use the latter, you can easily find the subnet by examining the IP address.
With CIDR, you would have to explicitly define the network masks. So you need to keep an eye on more things at once if you want the network to work properly.
Regardless, CIDR has become the backbone of the Internet’s routing system, and every ISP uses it. CIDR fully works with Border Gateway Protocol (BGP), the prevailing exterior (interdomain) gateway protocol, and the Open Shortest Path First (OSPF) gateway protocol.
Networking does not have to get more complicated than it already might be. CIDR aims to facilitate the process of managing and assigning IPv4 addresses in order to increase IPv4 lifespan and ensure optimal network performance.
CIDR helps network administrators break down an IP address space into subnets of various sizes. The equivalent notation, also known as slash notation, is a cleaner and more compact way to show or write an IPv4 subnet mask.
This method gives administrators more flexibility and helps them state a single entry in a routing table for a group of networks instead of more. The result is smoother and quicker operations. At the end of the day, CIDR is just one of the many implementations designed to keep IPv4 around for more and a pillar of the Internet’s modern routing system. And it seems it’s doing a great job.