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.
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 Notation | Subnet mask | Number of Host Bits | Total address |
/1 | 128.0.0.0 | 31 | 2147483648 |
/2 | 192.0.0.0 | 30 | 1073741824 |
/3 | 224.0.0.0 | 29 | 536870912 |
/4 | 240.0.0.0 | 28 | 268435456 |
/5 | 248.0.0.0 | 27 | 134217728 |
/6 | 252.0.0.0 | 26 | 67108864 |
/7 | 254.0.0.0 | 25 | 33554432 |
/8 | 255.0.0.0 | 24 | 16777216 |
/9 | 255.128.0.0 | 23 | 16777216 |
/10 | 255.192.0.0 | 22 | 4194304 |
/11 | 255.224.0.0 | 21 | 2097152 |
/12 | 255.240.0.0 | 20 | 1048576 |
/13 | 255.248.0.0 | 19 | 524288 |
/14 | 255.252.0.0 | 18 | 262144 |
/15 | 255.254.0.0 | 17 | 131072 |
/16 | 255.255.0.0 | 16 | 65536 |
/17 | 255.255.128.0 | 15 | 32768 |
/18 | 255.255.192.0 | 14 | 16384 |
/19 | 255.255.224.0 | 13 | 8192 |
/20 | 255.255.240.0 | 12 | 4096 |
/21 | 255.255.248.0 | 11 | 2048 |
/22 | 255.255.252.0 | 10 | 1024 |
/23 | 255.255.254.0 | 9 | 512 |
/24 | 255.255.255.0 | 8 | 256 |
/25 | 255.255.255.128 | 7 | 128 |
/26 | 255.255.255.192 | 6 | 64 |
/27 | 255.255.255.224 | 5 | 32 |
/28 | 255.255.255.240 | 4 | 16 |
/29 | 255.255.255.248 | 3 | 8 |
/30 | 255.255.255.252 | 2 | 4 |
/31 | 255.255.255.254 | 1 | 2 |
/32 | 255.255.255.255 | 0 | 1 |
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
In the above diagram, you can see there are 8 networks with IP requirements as under:
Network | IP requirement | IP Pool | Valid IP address | CIDR notation |
1 | 2 | 4 | 2 | /30 |
2 | 2 | 4 | 2 | /30 |
3 | 2 | 4 | 2 | /30 |
4 | 32 | 64 | 62 | /26 |
5 | 42 | 64 | 62 | /26 |
6 | 18 | 32 | 30 | /27 |
7 | 28 | 32 | 30 | /27 |
8 | 6 | 8 | 6 | /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.
Network | Requirment | Block/Pool size | CIDR | IP Range |
First Network | 2 | 64 | 10.0.0.0/26 | 10.0.0.0-10.0.0.63 |
Second Network | 2 | 64 | 10.0.0.64/26 | 10.0.0.64-10.0.0.127 |
Third Network | 2 | 64 | 10.0.0.128/26 | 10.0.0.128-10.0.0.191 |
Fourth Network | 32 | 64 | 10.0.0.192/26 | 10.0.0.192-10.0.0.255 |
Fifth Network | 42 | 64 | 10.0.1.0/26 | 10.0.1.0-10.0.1.63 |
Sixth Network | 18 | 64 | 10.0.1.64/26 | 10.0.1.64-10.0.1.127 |
Seventh Network | 28 | 64 | 10.0.1.128/26 | 10.0.1.128-10.0.1.191 |
Eighth Network | 6 | 64 | 10.0.1.192/26 | 10.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.
See the table below, for detail.
Network | Requirement | Block/Pool size | CIDR | IP Range |
First Network | 32 | 64 | 10.0.0.0/26 | 10.0.0.0-10.0.0.63 |
Second Network | 42 | 64 | 10.0.0.64/26 | 10.0.0.64-10.0.0.127 |
Third Network | 18 | 32 | 10.0.0.128/27 | 10.0.0.128-10.0.0.159 |
Fourth Network | 28 | 32 | 10.0.0.160/27 | 10.0.0.160-10.0.0.191 |
Fifth Network | 6 | 8 | 10.0.0.192/29 | 10.0.0.192-10.0.0.199 |
Sixth Network | 2 | 4 | 10.0.0.200/30 | 10.0.0.200-10.0.0.203 |
Seventh Network | 2 | 4 | 10.0.0.204/30 | 10.0.0.204-10.0.0.207 |
Eighth Network | 2 | 4 | 10.0.0.208/30 | 10.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 block | IP Pool | Number of addresses | Description |
0.0.0.0/8 | 0.0.0.0- 0.255.255.255 | 17,777,216 | Invalid, unknown, non-routable target. Used to define any IP in default routing. |
10.0.0.0/8 | 10.0.0.0- 10.255.255.255 | 17,777,216 | Private IP |
127.0.0.0/8 | 127.0.0.0- 127.255.255.255 | 17,777,216 | Loopback IP |
169.254.0.0/16 | 169.254.0.0- 169.254.255.255 | 65536 | Link-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/12 | 172.16.0.0- 172.31.255.255 | 1048576 | Private IP |
192.168.0.0/16 | 192.168.0.0- 192.168.255.255 | 65536 | Private IP |
Here I Conclude the chapter Classless IP address version 4.
Take a Quiz on this topic :