Classless addressing is a concept of addressing the IPv4 addresses. It was adopted after the failure of classful addressing. The classful addressing leads to wastage of addresses as it assigns a fixed-size block of addresses to the customer. But, the classless addressing assigns a block of addresses to the customer according to its requirement which prevents the wastage of addresses.
In this section, we will discuss the classless addressing, CIDR notation, classless addressing blocks. We will also discuss one example of classless addressing in which we will calculate the block size, first and last address of the block.
Content: Classless Addressing in IPv4
- What is Classless IPv4 Addressing?
- What is CIDR Blocks?
- What is CIDR notation?
- Classless Addressing Example
- Key Takeaways
What is Classless Addressing?
The classless IPv4 addressing does not divide the address space into classes like classful addressing. It provides a variable-length of blocks, which have a range of addresses according to the need of users.
Reasons for Adopting Classes Addressing
As classful addressing failed in providing the fair share of addresses to each organization there was a need to bring change in the distribution process of addresses. As we know the classful addressing assigns a block from class A, B & C to an organization which has a fixed number of addresses.
In classful addressing sometimes the addresses in a block were more than enough and sometimes the addresses in the block were less than required. Subnetting and supernetting in classful addressing also failed to solve the problem of address depletion.
As we all know in 1990 ‘Internet Service Provider’ (ISP) an organization that became famous for providing internet access to midsize organizations, small commercial companies or even to an individual that require internet services such as e-mail services, surfing to extract information about something and many more.
Internet Corporation for Assigned Names and Numbers (ICANN) a global authority that assigns a large block of addresses to ISP which it further subdivides to provide a required range of addresses to small commercial organizations.
So, in 1996 a new architecture was introduced for the distribution of addresses namely ‘Classless Addressing’. The classless addressing provides the block of addresses of variable length. One can request for a block having 1 address, 2 addresses, 4 addresses, 8 addresses and so on. It means that the number of addresses that a customer can request should be the power of 2. The classless addressing prevents the wastage of addresses.
In classful addressing, if an address is provided then we can detect its class as its first few bits help us in recognizing the class of address. Knowing the class of address, we can find the length of net-id as it would be 8, 16 or 24.
Like in classful addressing, the address was divided into two parts net-id and host-id. Where net-id would define the address of the network and host-id would define the host address in the corresponding network. And the net-id part and host-id part would vary with the classes.
The same way the classless addressing also divides the IPv4 address into two parts referred to as ‘prefix‘ and ‘suffix‘. Prefix defines the network id whereas suffix defines the host address in the corresponding network.
Addresses belonging to the same block persist the same prefix whereas each host in a block has a different suffix. As in classful addressing the length of net-id depend on the class to which the address belongs and it can only be 8, 16 and 24. On the other hand, the length of a prefix (n) can be 0, 1, 2, 3, . . . . ., 32. So, the value of suffix would automatically be (32- length of the prefix).
In classless addressing, for a given address prefix length, could not be calculated as it can belong to a block of any prefix length. So, here the length of the prefix is included with each address to ease the extraction of block information.
The length of the prefix (n) is added to the last of address separated by a slash. This is called slash notation and more formally it is known as Classless Inter-Domain Routing (CIDR) notation.
IPv4 address 220.127.116.11/27 have an added value ’27 ‘ which is separated by a slash, is a CIDR notation of classless IPv4 address. The value ‘27‘ denotes the length of the prefix. So, the length of the suffix would be ‘32-27= 5‘.
For the correct working of CIDR blocks, three restrictions are implemented on the blocks of classless addressing.
- A block of addresses allocated to an organization must have the contiguous unallocated addresses.
- The number of addresses in a block allocated to an organization must be the power of 2.
- The first address of every block must be divisible by the length of the block.
Extraction of block information:
- The number of host addresses in a block
N is the number of host addresses in a block and n is the length of the prefix.
- The first address of a block
First Address = (any address) AND (network mask)
- Last address of a block
Last Address = (any address) OR [NOT (network mask)]
Classless Addressing Example
Let us take an IPv4 classless address in CIDR notation i.e. 18.104.22.168/27 and from the given address we will calculate the number of addresses in the corresponding network, the first address of the network and last address of the network.
Our given address is 22.214.171.124/27. As we know that the value after the slash in IP address is prefix (n) value=27.
The number of addresses in the network can be calculated with the formula below:
So, there are 32 addresses in the corresponding network block and it can be assigned to 32 hosts in the network.
The first address of the network can be calculated with the formula below:
First address = (given address) AND (network mask)
The given address is 126.96.36.199
The decimal notation of the first address in the block is 188.8.131.52.
The last address can be calculated with the formula below:
Last address = (given address) OR [NOT (network mask)]
The decimal notation of the last address in the block would be 184.108.40.206.
So, we conclude that the given address 220.127.116.11 is from the block who’s first address is 18.104.22.168 and last address is 22.214.171.124 and the number of the hosts in the network is 32.
Now, let us verify the rules for CIDR blocks :
- The number of addresses in a block must be in power of 2 i.e. in the above case the number of addresses in the block is 32 which is equal to 25.
- The first address of block must be divisible by the number size of the block. So, the first address of the block 126.96.36.199 is divisible by 25 as the last five bits of 10100111 11000111 10101010 01000000 address (binary notation of first address 188.8.131.52) is ‘0’.
- The block (first address is 184.108.40.206 and last address is 220.127.116.11) contain contiguous 32 unallocated addresses.
- Classless addressing does not divide the address space of 32-bit IPv4 addresses into classes like classful addressing.
- ICANN (Internet Corporation for Assigned Names and Numbers) assigns a large block of addresses to ISP (Internet service provider) from which ISP assigns a variable-size block of addresses to the midsize organization, individual, small commercial companies.
- In classless addressing, the block of addresses assigned to the customers is according to their requirement which prevents the wastage of addresses.
- The customer can request for the block of 1 address, 2 addresses, 4 addresses, 8 address and so on.
- The number of addresses requested by the customer should be the power of 2.
- The block of addresses assigned must have contiguous unallocated addresses in it.
- The first address of any block should be divisible by the size of the block.
- The classless IPv4 address has two parts prefix and suffix.
- The prefix of the address denotes the network id of the address.
- Suffix denotes the host-id of the address.
- To extract the information of the assigned block the length of the prefix (n) is added to the last of address separated with a slash. This is called slash notation or CIDR notation.
- The full form of CIDR notation is classless inter-domain routing.
So, this is all about the classless addressing which resolves the problem of address wastage in classful addressing. The classless addressing assigns the block of addresses according to the requirement of customer.