IP Subnetting is the process of partitioning a bigger network into smaller networks by making use of some portion of the IP addresses normally allotted to hosts (i.e. one or more bytes are borrowed from the host portion of the IP address to partition the main network into different sub networks).
It is typically used when there is an administrative need to have more networks internally with lesser number of hosts in each of these small networks rather than a single big network with large number of hosts.
The concept of borrowing host bits to create subnets is illustrated in the diagram given below:
The above example splits a single big network (18.104.22.168) with 255 hosts into two equal smaller subnetworks (22.214.171.124 and 126.96.36.199), each with 128 IP addresses.
- Subnet mask is similar in format to IP address : E.g. a.b.c.d
- It contains a one for bit positions belonging to the network or subnetwork and contains a zero for the host portion
- For example, the default subnet masks for class A, B and C are:
- Class A – 255.0.0.0 or FF.0.0.0 or /8
- Class B – 255.255.0.0 or FF.FF.0.0 or /16
- Class C – 255.255.255.0 or FF.FF.FF.00 or /24
Note that the subnet masks can be denoted in three different formats as shown above. The first form (e.g. 255.0.0.0) is in decimal notation, the second form (e,g.FF.0.0.0) is in hexadecimal notation and the third form (e.g. /8) is in the /no-of-bits-for-network-and-subnetwork format.
In the above example, /8 for class A denotes that 8 bits are allotted to the network and subnetwork put together and the remaining 24 bits are for the host portion.
Getting the Subnet Address from the Host IP address and Subnet Mask
If we are given an end host address and the subnet mask, then we can get the subnetwork address by bit wise AND operation of the above two. The example in the diagram given below illustrates the same:
The above diagram illustrates the method used to get the subnetwork address, given an end host IP address and the subnet mask used in the network.