In this article we understand what is CIDR (Classless Inter Domain Routing) in sub netting and Why we use it instead of class full addressing. Before understand the concept of CIDR let’s first understand why this technique is comes in sub netting means why we use in it.
Why we use CIDR:-
In now a day’s class full addressing is used. Which may be class A, B, C. These class full addressing are not sufficient because of now a days in world many small networks so the class C is used more. This is also called class C depletion ( Excessive use of Class C addressing). In Class full addressing if we use class C then we force to use last 8 bit as a host id’s. That is not efficient division of IP addresses. In Current scenario we need such technique so that we can assign IP address space according to user’s need. So the CIDR technique comes in action. In CIDR we divided class into different blocks of IP addresses. So that we can use class A and divided into many blocks and use it. This is only possible using CIDR.
What is CIDR:-
CIDR stands for Classless Inter Domain Routing. As name suggest that the this is not class full technique means that the it use classless technique. In CIDR we use prefix bits along with simple IP address. This prefix bit’s may be from 13 to 27. And prefix bit’s tells about the number of 1’s in IP address used for network ID or Block ID’s. CIDR address is looks like P.Q.R.S/Prefix bit ( 18.104.22.168/27).
In Classless inter domain routing some rules is defined for creating CIDR block’s. Which is as following.
All the IP’s addresses in one block should be in contiguous manner. Means that the in one block IP’s must be in continues increasing order. If the first IP of block is 22.214.171.124 and block size is 16 then the last IP of this block must be 126.96.36.199.
Size of each block in CIDR should be a power of 2. Because of in computer science we can perform division N bit’s number with 2 power K then the remainder will be the least significant K bit and the quotients will be most significant (N-K) bits. That’s why block should be power of 2.
First IP address in CIDR block should be evenly divisible by size of the that block. Means that the if we divide first IP address by the size of that block then the remainder must be zero. This first IP address is nothing else it is Network ID or Block ID of that block.
How to find number of host in CIDR and the given block is possible or not
Number of host ID’s possible for given CIDR block can calculate as
If the total 32 bit’s is used to represent IP address and prefix for given block is N bit then Number of Host ID’s = 2^(32-N) – 2. Here we subtract 2 because of the first IP address of block is Net ID or Block ID of that block which contain host bit’s all zero and host id bit’s is all one then this address is Direct Broadcast Address of that block.
If any CIDR block satisfied above three rules then we can say that the given block of CIDR is possible.
Example of CIDR
In this figure indigo colour is used after the 20 bit prefix of CIDR for dividing address into 4 subnets. Means that the remaining bit’s is used for host id’s. If we place all host id bit’s as a zero then we get first address of that subnet. Which is also called subnet ID of that subnet. And if we place all one’s at host id bit’s then this is the last address of that subnet and it is also called as Direct broadcast address.