Classless Addressing in IPv4 has erupted after the failure of Classful Addressing. The concept of Classless Addressing is adopted to serve every range of hosts in a network.
In Classful Addressing, Class A and Class B dictate a large chunk of IP address. So, if a large portion of the IP address remains unused, it can lead to the wastage of IP addresses.
On the other hand, Class C addressing architecture does not have enough available address space to serve large organizations.
If you are not clear about what Classful Addressing is, you can follow the basic understanding of Classful Addressing.
The Classless Addressing technique prevents the wastage of addresses by assigning a block of IP address as per the requirement.
Here, you will learn what Classless Addressing is, how CIDR notation is applied in Classless Addressing, and how to create Classless addressing blocks.
What is Classless Addressing?
Classless Addressing provides a method to generate any range of IP address blocks, serving user requirements.
Unlike Classful Addressing, Classless Addressing does not divide address space into fixed parts.
Why is Classless Addressing better than Classful Addressing?
The following reason will let you know why Classless Addressing is preferred over Classful Addressing.
Wastage of IP address
The Classful Addressing classifies IP addresses in Class A, B, C, D, and E. Each class of IP address has a fixed number of IP address blocks, which creates a big problem while distributing to the organization.
Class A and B serve many addresses, which doesn’t require most of the organizations. As a result, it can lead to wastage of IP addresses, because it remains unused.
On the contrary, the Class C IP address doesn’t have enough IP addresses which can serve the purpose of the organization.
To compensate above loss, the Classful Addressing has adopted another technique. It has been introduced to Subnetting and Supernetting, but this does not able to solve the problem.
No scope of variable length address blocks
The wastage of IP addresses is one aspect, as discussed above, which makes Classful addressing absolute.
But, what is most important is the customer requirement, which was not fulfilled by Classful Addressing.
In Classless Addressing, they have adopted a technique to generate a block of IP addresses of variable length. It can fulfill almost every requirement of IP address blocks for the customer.
But, the only condition is that the request of the IP address should be in 2^n, where n=1,2,3,4,5.. and so on.
So, the request should be in the order of one address, two addresses, four address, eight address, 16 address, and so on.
As a result, it becomes easier for ICANN (Internet Corporation of Assigned Names and Numbers), a global authority, to assign blocks of IP address to ISP (Internet Service Provider). The ISP further subdivide the blocks of IP address as per the request made by a commercial organization or end customer.
What is CIDR Notation? How is it related to Classless Addressing?
The Classless Inter-Domain Routing, in short CIDR, is a method that is adopted to distribute and allocate blocks of IP addresses and further assist in IP routing.
The CIDR was first introduced in 1993 by the Internet Engineering Task Force to replace the previous Classful addressing scheme on the Internet.
How is CIDR notation defined in Classless Addressing?
In Classful Addressing, we know that address space is divided as per the class of IP address. Also, each class of IP address divides IP address into network and host of fixed length.
It means that Class A, B, and C can have a fixed-length of 8, 16, and 24 bits of the network ID.
In Classless Addressing, it follows a somewhat same method but with a different twist.
Here, in Classless Addressing, the IP address is divided into two parts: Prefix and Suffix.
The “Prefix” part refers to the network ID, and the “Suffix” part refers to the host ID. So, if we know that Prefix is n, then the Suffix would be 32-n.
Here, in a network, the value of “Prefix” will be the same, but the value of “Suffix” will vary with the number of hosts.
So, the length of Prefix (n) can have value as 0,1,3,4….,32, and the Suffix value automatically calculated as 32 – length of Prefix (n).
In Classless Addressing, we can always have the length of the Prefix(n) of the IP address. You can find at the end of the IP address with a slash (/n).
This slash notation in Classless Addressing is formally known as Classless Inter-Domain Routing (CIDR) notation.
For instance, if the IPv4 address is in CIDR notation like 192.168.170.82/27, then 27 is the length of Prefix that is the number of bits allocated to the network ID. Also, the suffix length we can calculate as 32-27 = 5.
How is the CIDR block implemented in Classless Addressing?
The implementation of the CIDR block in Classless Addressing is achieved with three rules.
- The allocated block of IP address must have a contiguous unallocated address.
- The number of IP addresses given to the customer must be in the power of 2.
- The first address of the address blocks must be divisible by the length of the block.
How to extract information from the block of IP address?
The block of IP address can reveal necessary information, which can be extracted as below:
The number of host address from the given block of address is calculated as
N = 2^32-n, where N is the number of host addresses, and n is the length of the Prefix.
The first address of the block
First address = (given address) AND (network mask)
The last address of the block
Last address = (given address) Or [NOT (network address)]
Extraction formula with an example
Let’s implement the above extraction formula with an example.
We have taken IP address 184.108.40.206/27, which is in CIDR notation and belongs to a Classless address.
Here, the length of the Prefix (n) = 27
So, using the above formula, the number host (N) = 2^32-27 = 2^5 = 32.
To calculate the first address of the IP address block, we can use the below formula:
First address = (given address) AND (network mask)
The given IP address is 220.127.116.11
When we convert into a binary number, the whole thing will look as below.
Given address in binary notation = 10100111 11000111 10101010 01010010
Network mask of given address = 11111111 11111111 11111111 11100000
Here, we will use the AND operator to get the result. For the AND operator, 1 AND 1 = 1, 1 AND 0 = 0 and 0 AND 0 = 0
The result for the First address would be 10100111 11000111 10101010 01000000
The decimal notation of the First address would be 167.199. 170.64
Similarly, the Last address we can calculate as below.
The given address in binary notation = 10100111 11000111 10101010 01010010
The Not(Network Mask given address) = 00000000 00000000 00000000 00011111
So, the Last address = (given address) OR [Not(Network Mask from given address)]
Here, the NOT operator will change the value just opposite (True to False and False to True), whereas the OR operator follows the addition rule. So, 0 OR 1 = 1, 1 OR 1 = 1 and 0 OR 0 = 0.
Now, the Last address would be 10100111 11000111 10101010 01011111
The decimal notation of the Last address would be 18.104.22.168.
From the above example, we have concluded that 22.214.171.124 is the given address, 126.96.36.199 is the First address, and 188.8.131.52 is the Last address. The total number of hosts is 32.
Checking CIDR rule
If we check the above result with the CIDR rule, then.
- The block of address (184.108.40.206 to 220.127.116.11) has a contiguous unallocated address.
- The number of addresses in an IP address block must be to the power of 2. Here, the total available address block is 32, which is equal to 2^5.
- The first address, 18.104.22.168, must be divisible by 2^5. If we convert decimal notation to binary notation, then it will be 10100111 11000111 10101010 01000000. We can see that the last five bits are zero, which means that it is divisible by the number of address blocks.
It is also to be noted that any binary pattern is divisible by 2^n, if and only if its least significant n bits is zero.
Classless Addressing creates a new scope of addressing in IPv4. The Classless Addressing can generate variable length of address blocks as per the requirement.
Moreover, Classless Addressing adopts CIDR notation, which is denoted as xx.xx.xx.xx/n, where “n” is the Prefix of the given IP address. The Prefix indicates the network ID, and the Suffix indicates the host ID.
Also, from the given Classless IP address, we can easily calculate the first and last address of the address block.