# Classless Interdomain Routing (CIDR) Tutorial With Example

Till now we have covered the classful addressing . We learnt the advantages and disadvantages of classful addressing. We also learnt how to perform subnetting and supernetting in classful addressing. We will now move ahead towards the Classless Interdomain Routing (CIDR).

– The concept of classes is eliminated in CIDR. The IP address is mentioned as a.b.c.d/n ,
where n represents the no of bits present in network id.
– In Classless Interdomain routing, we can ask for the exact no of IP Addresses as per our requirement.
– CIDR could either represent one block or a particular IP address. Here, instead of network id we have block id.

Network ID division

– Example: – 20.10.50.100 / 20
Since 20 bits are network bits, (32-20= 12) bits represent host bits.
Therefore, a total of \$2^{12}\$ IP Addresses are present.

### Rules of forming CIDR blocks

Below are the rules of CIDR block that we use to form any CIDR block –
– All IP Addresses should be contiguous.
– Block size should always b in powers of 2.
– First IP Addresses in the block should be evenly divisible by size of block.

Note:
– First IP Address in a block always represents block ID.

###### Model Question 1 :

If the block contain 32 IP Addresses. Which of the following will be the first address of the block?
(i) 201.15.15.16
(ii) 201.15.16.8
(iii) 201.15.16.160
(iii) None

Solution:
The first address of the network should be divisible by total no of addresses. Therefore (iii) is the answer.

###### Model Question 2:

If the block contain 1024 IP Addresses. Which of the following will be the first address of the block?
(i) 201.15.1.0
(ii) 201.15.3.0
(iii) 201.15.4.1
(iv) 201.15.8.0

Solution:
The first address of the network should be divisible by total no of addresses. Since for 1024 addresses we need the entire last octet and two bits from the second last octet, thus in the first address the last octet should be 0 and the second last octet should be divisible by 4. Therefore (iv) is the answer.

### Supernettting in CIDR

– Example 1:
If one of the address of a block is 114.28.42.83/26. If this block is divided into 4 equal sub-blocks, then calculate the range of block and range of sub-blocks.

Solution:
No. of possible addresses in the block = 232-26 = 26 = 64 IP Addresses
Block ID = 114.28.42.64
Since the block is to be divided into 4 parts we require 2 bits for the subnet.
Range of block = 114.28.42.64/26 – 114.28.42.127/26 (Last octets 01000000-01111111)
Range of sub-blocks:
– 114.28.42.64/28 – 114.28.42.79/28 (Last octets 01000000-01001111)
– 114.28.42.80/28 – 114.28.42.95/28(Last octets 01010000-01011111)
– 114.28.42.96/28 – 114.28.42.111/28(Last octets 01100000-01101111)
– 114.28.42.96/112 – 114.28.42.127/28(Last octets 01110000-01111111)

### Variable Length Subnet Masking in CIDR

– Example 1:
An ISP has a block 191.16.0.0./16:
(a) 1st group has 128 customers, each customer requires 256 IP Addresses.
(b) 2nd group has 64 customers, each customer requires 128 IP Addresses.
(c) 3rd group has 16 customers, each customer requires 64 IP Addresses.
Assign IP Addresses in the given order.

Solution:

CIDR example

### Supernetting in CIDR:

– Example 1:
200.1.32.0/24
200.1.33.0/24
.
.
.
200.1.47.0/24
Find the size of the supernet.

Solution:
Since it satisfies all 3 rules of CIDR it can be supernetted.
Size of entire supernet = 24*28 = 212
How do we check if 200.1.32.0 is divisible by 212?
{32 should be divisible by 24}
{0 should be divisible by 28}