Previously, we have discussed that IPv4 addressing are done in two categories;

- Classful Addressing
- Classless Addressing

## Classless Addressing

In these days, classful addressing is almost obsolete and are

**replaced by**Classless Addressing.
To overcome the flaws of classful addressing such as the address depletion and to provide more organizations to access the internet,

**classless addressing**was designed and implemented.
In this type of addressing, there are no classes but still the addresses are granted in blocks.

### Address Block

In classless addressing, when an organization , small or large needs to connect the internet; it is granted a block (means a range) of addresses. The size of the block means the number of addresses varies based on the nature and need of the organization.

Although, there are some restrictions before implementation of classless addresses.

###
**Restrictions**

To facilitate the handling of addresses, the authority of Internet imposed three restrictions on classless address blocks, such as:

- All the addresses in a block must be contiguous, one after the another.
- The number of addresses in block must be a power of 2, means 1, 2, 4 6 8 ...n (Where n is an even number)
- The first address of the block must be divisible by the number of addresses in the block.

Let us come to the mathematics then.

**For First Address:**The first address of any block can be found by setting the rightmost 32-n bits to 0's, where 'n' is mask.

**Example 1.**

A block of addresses is granted to a small organization, where one of the address is 205.16.37.39/28. What is the first address of the block?

**Solution.**

The binary representation of 205.16.37.39 is :

11001101 00010000 00100101 00100111

if we set the right most 32-n bit to 0, i.e 32-28 = 4

We get, 11001101 00010000 00100101 0010

**0000**
which is, 205.16.37.32

So, the first address of the block is 205.16.37.32.

**For Last Address:**The last address of any block can be found by setting the rightmost 32-n bits to 1's, where 'n' is the mask.

**Example 2.**

Find the last address of Example 1.

**Solution.**

The binary representation of 205.16.37.39 is :

11001101 00010000 00100101 00100111

if we set the right most 32-n bit to 1, i.e 32-28 = 4

We get, 11001101 00010000 00100101 0010

**1111**
So, the last address of the block is 205.16.37.47.

**For Total Number of Addresses:**The total number of addresses in the block can be found by using the formula 2

^{32-n}

^{}

where 'n' is the musk.

**Example 3.**

Find the number of addresses of Example 1.

**Solution.**

The value of n is 28, which means the number of addresses is 2

^{32-28 }^{}

^{which is 16.}

^{}

###
**There is another way to solve the above problems:**

There is another way to
find the first address, last address, no. of address is to represent mask into
32-bit binary format. Like, from example 1. the musk is 28, so the 32-bit
binary format is:

11111111 11111111 11111111 11110000 (

**twenty eight 1s and four 0s**)**For first address:**Perform a

**Logical AND**between the given address and the 32-bit binary format of the mask.

**For Last Address**: Perform

**a**

**Logical OR**between

**given address and the complement of the mask.**

**For No. of addresses in the block:**No. of addresses can be found by complementing the mask, then interpreting it as a decimal no., and adding 1 to it.

This way is particularly
useful

**when you are writing programs**to find any piece of information.Free image downloaded from unsplash.com |

^{}

^{}

## No comments:

## Post a Comment