Classless IP address version 4

Classless IPv4

Let us discuss the Classless IP address version 4. IP address version 4 is categorized as a Classful and Classless IP address. In our previous tutorial, I have explained the Classful IP address, IP address version 4 Classes, and Network ID and Broadcast ID.

Need for Classless IP address version 4

As we have seen in a classful IP address, Class A address covered a total of 50% available IP addresses in merely 126 usable blocks. The first block of 0 and the last block of 127 is not free for general use. Or you can say, over 2.1 billion IP addresses allocated to 126 organizations only. That was a wastage of IP addresses. Similarly, each network block in Class B, there are 65,536 hosts, which is pretty large for any organization. Class C has a reasonably small network of 256. If we need to connect 2 routers, using a 256 host size block is again a wastage.

There were no available blocks between 256 and 65,536, as the subnet mask was limited to 8, 16, and 24 network prefixes in a classful scheme. With the exponential growth of the Internet and the invention of DNS, a classful IP address became difficult to implement.

Due to the non-scalability of the classful IP scheme, the subnetting technique and CIDR was devised by IETF in 1993. The limitation of network class was removed, hence it is called a classless IP address version 4.

Subnetting

Subnetting is the method that divides the network into two or more subnets. The IP network is logically subdivided into subnets. In simple words, few bits from the extreme left of host bits are borrowed towards network bits. Or the network identifier bits will be shifted to the right by a number say n.

The result has a network identifier, subnet identifier, and the host identifier. The network and subnet identifier collectively serves as routing prefix, which is expressed in CIDR notation. The image below illustrates the subdivision of the network into subnets.

Classless IP address version 4: Subnetting

Let’s take an example, IP address 192.168.1.1 is an IP address of class C with default netmask 255.255.255.0.

Or, the number of Network identifier is 8, and the host identifier is 32-8= 24 by default.

In CIDR notation it is written as 192.168.1.1/24. The first 3 octets are network part and last octets constitute the host part.

The default subnet mask is :
11111111.11111111.11111111.00000000
or, 255.255.255.0
Number of host= 28 = 256
We will see later how to calculate the network ID, broadcast ID, block size, and usable IP address.
Here, we can say the IP addresses 192.168.1.x (x may be any number between 0 to 255) falls in this network. In simple words, as long as the IP address belonging to the network part does not change, it remains in the same network. If you replace the third octet number to 2, i.e., 192.168.2.1, it will be the part of another network block.

As I earlier said, in subnetting you borrow few bits from host side to network side. Let us see an example below:

In the image above, it is clear that the IP 192.168.1.1/24 is sub-netted by borrowing 2 bits.

No of subnets= 2 number of bits borrowed= 22=4

New subnet mask is as shown in figure 255.255.255.192.

Number of Network prefix= 32-6= 26
CIDR notation is (/26).

No of host bits = 8-2 =6

Hence the block size will be=2number of host bits = 26 = 256

You can also find the block size by subtracting the value of the Subnet mask of the octet where subnetting is done from 256. Here the value of the 4th octet is 192.

Hence the block size = 256-192= 64

First block

Now you can find each block by adding 64 from the start. The First block starts from 192.168.1.0.

The first block is 192.168.1.0- 192.168.1.63.
Subnet Mask – 255.255.255.192, CIDR notation 192.168.1.0/26
Network ID- 192.168.1.0
Broadcast ID- 192.168.1.63
Usable host 64-2= 62. 192.168.1.1 – 192.168.1.62

Second block

192.168.1.64- 192.168.1.127
Subnet Mask – 255.255.255.192, CIDR notation 192.168.1.64/26
Network ID- 192.168.1.64
Broadcast ID- 192.168.1.127
Usable host 64-2= 62. 192.168.1.65 – 192.168.1.126

Third Block

192.168.1.128- 192.168.1.191
Subnet Mask – 255.255.255.192, CIDR notation 192.168.1.128/26
Network ID- 192.168.1.128
Broadcast ID- 192.168.1.191
Usable host 64-2= 62. 192.168.1.129 – 192.168.1.190

Fourth Block

192.168.1.192- 192.168.1.255
Subnet Mask – 255.255.255.192, CIDR notation 192.168.1.192/26
Network ID- 192.168.1.192
Broadcast ID- 192.168.1.255
Usable host 64-2= 62. 192.168.1.193 – 192.168.1.254

As you can see in the above example, the subnet mask remains the same for all the subnets. Also, the distribution of IP block is contiguous, i.e., there is no gap between two adjacent blocks. This type of distribution is called FLSM (Fixed Length Subnet Mask). Another type is VLSM (Variable Length Subnet Mask), which I shall discuss in the next section.

Supernetting

Supernetting is exactly the opposite of subnetting. It is the process of combining multiple networks in a single network. It is primarily used by routers for route aggregation. The route aggregation is the process where the router combines the multiple contiguous networks into one and makes a single entry in the routing table.
In the above example, we have seen a class C IP subdivided to the smaller networks by shifting the network identifier bits to the right. In subnetting, the network bits will be shifted towards left. Or you may say bits from the network side will be borrowed by the host side.

let’s take the IP 192.168.0.0/24
It has 256 addresses as we have seen earlier. Similarly, the network 192.168.1.0/24 will have 256 hosts. If we shift the network bit towards left by 1, those two networks will merge and have 512 hosts.
Let’s see:-
Shifting network bit to left means-

11111111. 11111111. 11111111. 00000000– is the default mask
11111111. 11111111. 11111110. 00000000– Borrowing one bit from host to network.
The subnet mask now is- 255.255.254.0 and CIDR value is (/23)
No of host bits = 9
No of host addresses = 29= 512
No of usable IP is = 512-2= 510
Here the block size is calculated in the third octet. Since bit manipulation is done in the third octet only. The value of the subnet mask is 254 and the number of host bits is 1 in the third octet.
Hence the block size= 256-254= 21=2

Hence the third octet will contain a block of two in each network. The first block will start at 0. Put all 0’s in the 4th octet for Network ID and all 1’s in 4th octet for broadcast ID.

Hence the IP range will be 192.168.0.0 to 192.168.1.255

Network ID- 192.168.0.0
Broadcast ID- 192.168.1.255
Block size- 2
Number of addresses- 29 = 512
Number of usable addresses = 512-2=510
Usable IP range = 192.168.0.1 to 192.168.1.254
Subnet mask-255.255.254.0 and CIDR value is (/23)

Similarly, if you shift the network bit to left by 2,
the number of hosts will be 210 = 1024.
valid IP address- 1024-2= 1022
The subnet mask will be 255.255.252.0 and CIDR value (/22).
The block size =22 =4, The third octet will have 0,1,2,& 3 blocks.
IP range- 192.168.0.0 – 192.168.3.255

Classless IP address version 4:
CIDR (Classless Inter Domain Routing)

CIDR was introduced by the Internet Engineering Task Force in 1993 as a measure to slow down the exhaustion of IP addresses. It is the method of allocating IP addresses which are not limited to the classes.

The IP classes A, B, and C, which is also known as the unicast range. The whole range can be assigned to any organization without the /8, /16, & /24 limits as they were in classful IP. If an organization needs 600 IPs, they can be allocated a CIDR range of /22, irrespective of the Class.
CIDR also reduced the entry in the global routing table by enhancing the possibilities of route aggregation.

CIDR also have the concept of VLSM, which can be used to assign different length subnet mask in subnetting. And it also started the Slash notation or CIDR notation, a method to write the network prefix.

The following table shows the relation of CIDR notation with the subnet mask and the number of hosts.

CIDR NotationSubnet maskNumber of Host BitsTotal address
/1128.0.0.0312147483648
/2192.0.0.0301073741824
/3224.0.0.029536870912
/4240.0.0.028268435456
/5248.0.0.027134217728
/6252.0.0.02667108864
/7254.0.0.02533554432
/8255.0.0.02416777216
/9255.128.0.02316777216
/10255.192.0.0224194304
/11255.224.0.0212097152
/12255.240.0.0201048576
/13255.248.0.019524288
/14255.252.0.018262144
/15255.254.0.017131072
/16255.255.0.01665536
/17255.255.128.01532768
/18255.255.192.01416384
/19255.255.224.0138192
/20255.255.240.0124096
/21255.255.248.0112048
/22255.255.252.0101024
/23255.255.254.09512
/24255.255.255.08256
/25255.255.255.1287128
/26255.255.255.192664
/27255.255.255.224532
/28255.255.255.240416
/29255.255.255.24838
/30255.255.255.25224
/31255.255.255.25412
/32255.255.255.25501

Classless IP address version 4:
VLSM (Variable Length Subnet Mask)

VLSM is a method by which, one can assign different subnet masks to different subnets as required. In the example of subnetting in the above section, we have seen that all the subnets were having the same subnet mask, and hence the same block size. In VLSM, we can distribute different IP pools with different block sizes. VLSM is far more efficient in distributing the IP pool and save the IP address space. Let us see this in the following illustration.

Assigning IP in a Network: Example using FLSM and VLSM

Classless IP address version 4

In the above diagram, you can see there are 8 networks with IP requirements as under:

Network IP requirementIP PoolValid IP addressCIDR notation
1242/30
2242/30
3242/30
43264 62/26
5426462/26
6183230/27
7283230/27
8686/29

Using FLSM

If you choose to use FLSM, here all subnets should have a pool of 64. Since 2 out of 4 networks require a block of 64. Since in FLSM all subnets will have the same subnet mask/block size. The following image illustrates the FLSM.

Classless IP address: FLSM
NetworkRequirmentBlock/Pool sizeCIDRIP Range
First Network26410.0.0.0/2610.0.0.0-10.0.0.63
Second Network26410.0.0.64/2610.0.0.64-10.0.0.127
Third Network26410.0.0.128/2610.0.0.128-10.0.0.191
Fourth Network326410.0.0.192/2610.0.0.192-10.0.0.255
Fifth Network426410.0.1.0/2610.0.1.0-10.0.1.63
Sixth Network186410.0.1.64/2610.0.1.64-10.0.1.127
Seventh Network286410.0.1.128/2610.0.1.128-10.0.1.191
Eighth Network66410.0.1.192/2610.0.1.192-10.0.1.255

Hence you need a total of 512 IP addresses or two pools each of a Slash (/) 24 addresses to cover the entire network. Even the networks that require 2 addresses is assigned a block of 64. The wastage of IP addresses still exists even after subnetting. By using the VLSM technique we can further minimize the address wastage.

Using VLSM

In VLSM you can assign a block of different sizes as per the requirement. The following image will show you the assignment of IP pools using VLSM. I am taking the larger block at first for the sake of convenience. Otherwise, it may be assigned from any network.

Classless IP address: VLSM

See the table below, for detail.

NetworkRequirementBlock/Pool sizeCIDRIP Range
First Network326410.0.0.0/2610.0.0.0-10.0.0.63
Second Network426410.0.0.64/2610.0.0.64-10.0.0.127
Third Network183210.0.0.128/2710.0.0.128-10.0.0.159
Fourth Network283210.0.0.160/2710.0.0.160-10.0.0.191
Fifth Network6810.0.0.192/2910.0.0.192-10.0.0.199
Sixth Network2410.0.0.200/3010.0.0.200-10.0.0.203
Seventh Network2410.0.0.204/3010.0.0.204-10.0.0.207
Eighth Network2410.0.0.208/3010.0.0.208-10.0.0.211

So, you can see in VLSM, the allocated IP addresses are reduced to a great extent. Now you will require only 212 IP addresses to cover the entire 8 segments.

The allocation of IP addresses from ICANN to RIR, RIRs to the Countries, and ISPs are done in VLSM. It is the most efficient technique of IP assignment.

Reserved IP addresses in Unicast Range

There are reserved IP addresses in the unicast range. The unicast range belongs to Class A, B, and C IP addresses. The following table shows all the reserved IP pools in those three classes.

Address blockIP PoolNumber of addressesDescription
0.0.0.0/80.0.0.0- 0.255.255.25517,777,216Invalid, unknown, non-routable target. Used to define any IP in default routing.
10.0.0.0/810.0.0.0- 10.255.255.25517,777,216Private IP
127.0.0.0/8127.0.0.0- 127.255.255.25517,777,216Loopback IP
169.254.0.0/16169.254.0.0- 169.254.255.25565536Link-local address, used as autoconfigured IP for the local segment when no manual IP or DHCP server is found. APIPA (Automatic Private IP address)
172.16.0.0/12172.16.0.0- 172.31.255.2551048576Private IP
192.168.0.0/16192.168.0.0- 192.168.255.25565536Private IP

Here I Conclude the chapter Classless IP address version 4.

Take a Quiz on this topic :

Share this article.


Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *