What is CIDR? Classless Inter Domain Routing, or CIDR, is a method used to allocate IP addresses and route IP packets flexibly and efficiently. Introduced by the Internet Engineering Task Force (IETF) in 1993, CIDR was designed to replace the previous addressing architecture of classful network design on the Internet. The primary goals of CIDR were to slow the growth of routing tables on routers across the Internet and to help slow the rapid exhaustion of IPv4 addresses. But before we dive into the details of CIDR, let’s take a step back and understand the basics.
Table of Contents
The Basics: IP Addresses
An IP (Internet Protocol) address is a unique identifier for a device connected to a network. It’s like the postal address of your home but for your computer, smartphone, or any other device connected to the internet. IP addresses are fundamental to how the internet works, allowing devices to communicate with each other.
There are two types of IP addresses: IPv4 and IPv6. IPv4 addresses are written as four sets of numbers from 0-255, separated by periods, like 192.168.0.1. However, due to the growing number of devices connected to the internet, IPv4 addresses are running out. Hence, IPv6 was introduced, which uses a more complex system of alphanumeric characters, providing a much larger pool of addresses.
The Problem with Classful Networks
Initially, IP addresses were divided into classes (Class A, B, C, D, and E) based on the first few bits of the address. This system, known as classful networking, was simple but had significant drawbacks. It was inefficient and led to wasted IP addresses. For example, a Class A network could support over 16 million hosts, far more than most organizations needed. This led to the rapid exhaustion of the available IP address space.
The Solution: Classless Inter-Domain Routing (CIDR)
What is CIDR?
To overcome the limitations of classful networking, CIDR was introduced in 1993. CIDR is a more flexible way to allocate IP addresses and route IP packets. So, how does CIDR work? Instead of segregating IP addresses into rigid classes, CIDR uses a method known as variable-length subnet masking (VLSM).
In CIDR notation, an IP address is followed by a slash (/) and then a number, like 192.168.0.0/24. The number after the slash represents the number of bits used for the network portion of the address. This allows for more granular control over the IP address allocation, reducing the wastage of IP addresses.
What is CIDR Notation?
CIDR notation is a compact representation of an IP address and its associated routing prefix. The notation is constructed from an IP address, a slash (‘/’) character, and a decimal number. The number is the count of leading 1 bits in the routing mask, often called the network mask. CIDR notation is a syntax for representing a network or a subnet.
For example, CIDR notation might look something like this:
- IPv4: 192.0.2.0/24
- IPv6: 2001:db8::/32
In these examples, the number after the slash represents the count of leading 1 bit in the routing mask, also known as the network mask.
Here’s a simple breakdown of a CIDR address:
CIDR Address | IP Address | Prefix Length |
203.0.113.0/24 | 203.0.113.0 | 24 |
The number after the slash in CIDR notation is the prefix length. The prefix length specifies how many bits are used for the network prefix. For example, in the CIDR address 203.0.113.0/24, the prefix length is 24. The IP address part, 203.0.113.0, is the network address, and the /24 indicates that the first 24 bits are used for the network prefix.
Benefits of CIDR
CIDR offers several benefits:
- Efficient use of IP address space: CIDR allows for close matching of the IP address to the number of hosts. This reduces the wastage of IP addresses.
- Scalability: CIDR’s flexible allocation method supports more levels of hierarchy, improving the scalability of the internet.
- Improved routing: CIDR supports route aggregation, also known as route summarization, which reduces the size of routing tables and makes routing more efficient.
CIDR and IP Routing
CIDR plays a crucial role in IP routing. The routing table stores the destination network prefixes and the router’s next hop addresses. The router uses the longest prefix match rule to forward the packets. The longest prefix match means that out of all routes that match, the one with the longest prefix is chosen.
In the above scenario, all packets within the range 192.24.12.0 to 192.24.15.255 are forwarded to the next hop B, as B has a longer prefix of 22 bits compared to D’s 18 bits.
Classful vs. Classless Routing
Feature | Classful Routing | Classless Routing |
IP Address Structure | Divided into fixed classes (A, B, C, D, E). | No fixed classes; uses CIDR. |
Subnetting | Does not support variable length subnet masking (VLSM). | Supports VLSM, allowing more efficient use of IP addresses. |
Supernetting | Does not support supernetting. | Supports supernetting, useful for aggregating multiple networks into a larger address block. |
Flexibility | Less flexible due to fixed class structure. | More flexible in IP address allocation and management. |
Efficiency | Less efficient in utilizing IP addresses. | More efficient, reducing the wastage of IP addresses. |
Routing Protocol Support | Supported by older routing protocols (e.g., RIPv1, IGRP). | Supported by newer protocols (e.g., RIPv2, OSPF, EIGRP, BGP). |
Broadcast Domains | Larger broadcast domains, leading to potential network inefficiencies. | Smaller and more controlled broadcast domains. |
Network Mask | Default network masks based on class (e.g., 255.0.0.0 for Class A). | Custom subnet masks specified using CIDR notation (e.g., /24). |
Route Summarization | Less efficient, as it does not support CIDR. | More efficient due to CIDR, leading to simpler routing tables. |
Implementation | Common in older, simpler networks. | Widely used in modern networking for better IP address management. |
Waste of IP Addresses | More wastage due to rigid class structure. | Reduces wastage by allowing allocation based on need. |
Also Read: What is an IPv4 address?
Frequently Asked Questions
What is CIDR?
CIDR is a method used to allocate IP addresses and route IP packets flexibly and efficiently. Introduced by the Internet Engineering Task Force (IETF) in 1993, CIDR was designed to replace the previous addressing architecture of classful network design on the Internet.
What was the problem with Classful Networks?
Initially, IP addresses were divided into classes (Class A, B, C, D, and E) based on the first few bits of the address. This system, known as classful networking, was simple but had significant drawbacks. It was inefficient and led to wasted IP addresses, leading to the rapid exhaustion of the available IP address space.
What is the solution to the limitations of Classful Networks?
To overcome the limitations of classful networking, CIDR was introduced in 1993. CIDR is a more flexible way to allocate IP addresses and route IP packets. Instead of segregating IP addresses into rigid classes, CIDR uses a method known as variable-length subnet masking (VLSM).
What is CIDR notation?
CIDR notation is a compact representation of an IP address and its associated routing prefix. The notation is constructed from an IP address, a slash (‘/’) character, and a decimal number. The number is the count of leading 1 bits in the routing mask, often called the network mask. CIDR notation is a syntax for representing a network or a subnet.
What are the benefits of CIDR?
CIDR offers several benefits including efficient use of IP address space, scalability, and improved routing. CIDR allows for close matching of the IP address to the number of hosts, reducing the wastage of IP addresses. CIDR’s flexible allocation method supports more levels of hierarchy, improving the scalability of the internet. CIDR also supports route aggregation, which reduces the size of routing tables and makes routing more efficient.
What role does CIDR play in IP routing?
CIDR plays a crucial role in IP routing. The routing table stores the destination network prefixes and the router’s next hop addresses. The router uses the longest prefix match rule to forward the packets. The longest prefix match means that out of all routes that match, the one with the longest prefix is chosen.