Introduction to CIDR
Classless inter-domain routing (CIDR) is a method for allocating IP addresses and IP routing. A collection of Internet Protocol (IP) standards is used to create unique identifiers for networks and individual devices. The IP addresses allow the transmission of unique packets of information to specific computers.
What is CIDR?
CIDR is mainly used to use IP addresses and solve the routing table explosion efficiently. It is defined in RFC (Request for comments) 1518 and RFC 4632. It is an address block allocation. There are five different classes in the IPV4 addressing system. The IP address classes are used for Internet IP addresses assignment.
They are Class A address, Class B address, Class C address, Class D address, Class E address.
Class A address: In Class A, the first bit is considered. It is always set to zero. It can take the IP address from 1.X.X.X to 126.X.X.X.
Class B address: In Class B, the first two bits are considered. It can take the IP address from 128.0.X.X to 191.255.X.X.
Class C address: In Class C, the first three bits are considered. It can take the IP address from 192.0.0.X to 223.255.255.X.
Class D address: In-Class D first four bits are considered. It can take the IP address from 224.0.0.0 to 239.255.255.255. This Class is used for multicasting.
Class E address: The IP addresses in Class E are reserved for Research and Development. It can take the IP address from 240.0.0.0 to 255.255.255.254.
So based on the requirement, we can choose the IP addresses.
For host addresses, we use the IP addresses of Class A/ Class B/ Class C.
Today the networking address ranges are using classless Interdomain Routing. By using CIDR, the old way of using the IP address for class A, class B, class C is replaced. In the older method, if we take the example of Class B as it is mostly used. If any institute or any organization requires hosts, they will be provided with the hosts, but in most of the cases, all the allocated hosts are not getting used, and it even leads to the routing table to the explosion.
In CIDR, the person who requires the IP addresses has to purchase the IP address allocator from the service provider; it can be any size that the purchaser requires. Whenever it is enabled based on the address prefix, it allows different routers at different levels to route on prefixes of different lengths. The CIDR is used for IPV4. IPV4 is 32 bits, and the most commonly used network are/8, /16, /24 and /32.
How does CIDR Works?
CIDR is an alternative to traditional subnetting. It is also called classless Addressing. It consists of CIDR blocks; by this, it dynamically allocates the IP addresses on the requirement of the users based on certain rules. Internet Assigned Number Authority (IANA) handles the assignment of CIDR blocks.
CIDR block
This block contains IP addresses. This block consists of 3 basic rules.
The 3 basic rules mentioned below:
Rule 1: In the CIDR block, the IP addresses which are allocated to the hosts should be continuous.
Rule 2: The size of the block should be of power 2 and should be equal to the total number of IP addresses.
Rule 3: The size of the block must be divisible by the first IP address of the block.
CIDR Notation
A CIDR IP address representation is the same as the IP address; it ends with a backward slash followed by a number. The n represents the number of network bits. It is called as IP network prefix.
The general way of representation of the CIDR IP address is
a.b.c.d / n
Examples
If we are given the CIDR representation, we can find the range of IP addresses.
We can see this with examples.
Example #1
The CIDR representation is 21.19.35.40/24. Find the IP addresses of the CIDR block?
24 represents the number of bits used for the identification of the network.
The 5 bits are used for the identification of hosts.
The CIDR address is 21.19.35.40/24.
The first IP address is 21.19.35.0
The last IP address is 21.19.35.255
The total cost is 256.
Netmask is 255.255.255.0.
Example #2
The representation is 255.255.255.255/31. Find the IP addresses of the CIDR block?
31 represents the number of bits used for the identification of the network.
The 1 bit is used for the identification of hosts.
The CIDR address is 255.255.255.255/31.
The first IP address is 255.255.255.254
The last IP address is 255.255.255.255
The total cost is 2.
Netmask is 255.255.255.254.
We can find the CIDR block from the block of IP addresses.
Example #3
The IP addresses range is from 21.19.35.64 and 21.19.35.127. Find the CIDR block?
The IP address ranges are from 21.19.35.64 and 21.19.35.127.
Before preceding further, the CIDR block rules, which are mentioned above, should be checked if they are satisfied, then it is a CIDR block.
So the size of the block is 26. (i.e., 127 – 64 + 1 = 64)
Number of bits = 32 – 6 = 26.
CIDR block is 21.19.35.64/26.
Example #4
The IP addresses range is from 255.255.255.32 and 255.255.255.63. Find the CIDR block?
The IP address ranges are from 255.255.255.32 and 255.255.255.63.
Before preceding further, the CIDR block rules, which are mentioned above, should be checked if they are satisfied, then it is a CIDR block.
So the size of the block is 25. (i.e., 63 – 32 + 1 = 64)
Number of bits = 32 – 5 = 27.
CIDR block is 255.255.255.32/27.
Recommended Articles
This is a guide to What is CIDR. Here we discuss how does CIDR Works and examples to find the range of the IP addresses. You may also have a look at the following articles to learn more –