Classless Interdomain Routing (CIDR) Tutorial With Example

Greetings!
We have recently published 100+ articles on android tutorials with kotlin and java. If you need, you may visit Android Tutorial for beginners page. You can also check Kotlin Tutorial for beginners. Also, if you are interested in content writing, you can mail us at tutorialwing@gmail.com.

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.

Tutorialwing classless interdomain routing Network ID division

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.
– Last IP Address always represents directed broadcast address.

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:

Variable Length Subnet masking Example

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}
Supernet Mask: 11111111.11111111.11110000.00000000 (255.255.240.0}

– Example 2:
100.1.2.0/25
100.1.2.128/26
100.1.2.192/26
Find the size of the supernet.

Solution:
They are contiguous but not of equal size. Thus, supernetting can’t be applied directly. We can however supernet the last two addresses to get 100.1.2.128/25 and then the result can be supernetted with first address to get 100.1.2.0/24.

Hope this gives a clear idea of classless interdomain routing (CIDR). In the next tutorial, we move on to the flow control methods.
[latexpage]

Support Us

If you like Tutorialwing and would like to contribute, you can email an article on any educational topic at tutorialwing@gmail.com. We would love to publish your article. See your article on Tutorialwing and help others with your knowledge. Follow Facebook, LinkedIn, Google+, Twitter, Youtube for latest updates.
Greetings!
We have recently published 100+ articles on android tutorials with kotlin and java. If you need, you may visit Android Tutorial for beginners page. You can also check Kotlin Tutorial for beginners