Classless Inter Domain Routing (CIDR) - GeeksforGeeks

08 Aug, 2019
As we have already learned about Classful Addressing, so in this article, we are going to learn about Classless Inter-Domain Routing. which is also known as Classless addressing. In the Classful addressing the no of Hosts within a network always remains the same depending upon the class of the Network.
Class A network contains 224 Hosts,
Class B network contains 216 Hosts,
Class C network contains 28 Hosts 
Now, let’s suppose an Organization requires 214 hosts, then it must have to purchase a Class B network. In this case, 49152 Hosts will be wasted. This is the major drawback of Classful Addressing.
In order to reduce the wastage of IP addresses a new concept of Classless Inter-Domain Routing is introduced. Now a days IANA is using this technique to provide the IP addresses. Whenever any user asks for IP addresses, IANA is going to assign that many IP addresses to the User.
Representation: It is as also a 32-bit address, which includes a special number which represents the number of bits that are present in the Block Id.
 a . b . c . d / n 
Where, n is number of bits that are present in Block Id / Network Id.Example:
20.10.50.100/20 
Rules for forming CIDR Blocks:
All IP addresses must be contiguous.Block size must be the power of 2 (2n).If the size of the block is the power of 2, then it will be easy to divide the Network. Finding out the Block Id is very easy if the block size is of the power of 2.Example:If the Block size is 25 then, Host Id will contain 5 bits and Network will contain 32 – 5 = 27 bits.First IP address of the Block must be evenly divisible by the size of the block. in simple words, the least significant part should always start with zeroes in Host Id. Since all the least significant bits of Host Id is zero, then we can use it as Block Id part.
All IP addresses must be contiguous.
Block size must be the power of 2 (2n).If the size of the block is the power of 2, then it will be easy to divide the Network. Finding out the Block Id is very easy if the block size is of the power of 2.Example:If the Block size is 25 then, Host Id will contain 5 bits and Network will contain 32 – 5 = 27 bits.
First IP address of the Block must be evenly divisible by the size of the block. in simple words, the least significant part should always start with zeroes in Host Id. Since all the least significant bits of Host Id is zero, then we can use it as Block Id part.
Example:Check whether 100.1.2.32 to 100.1.2.47 is a valid IP address block or not?
All the IP addresses are contiguous.Total number of IP addresses in the Block = 16 = 24.1st IP address: 100.1.2.00100000Since, Host Id will contains last 4 bits and all the least significant 4 bits are zero. Hence, first IP address is evenly divisible by the size of the block.
All the IP addresses are contiguous.
Total number of IP addresses in the Block = 16 = 24.
1st IP address: 100.1.2.00100000Since, Host Id will contains last 4 bits and all the least significant 4 bits are zero. Hence, first IP address is evenly divisible by the size of the block.
All the three rules are followed by this Block. Hence, it is a valid IP address block.
Computer Networks
GATE CS
Computer Networks
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
RSA Algorithm in Cryptography
TCP Server-Client implementation in C
Socket Programming in Python
Data encryption standard (DES) | Set 1
Types of Network Topology
ACID Properties in DBMS
Page Replacement Algorithms in Operating Systems
Types of Operating Systems
Normal Forms in DBMS
Semaphores in Process Synchronization