Imagine: “I have written a letter to my friend working in a large company in the department, say x. When I sent my letter, I mentioned his office address and it had reached the destination. Now, as it is a large company it includes numerous departments. When my letter reaches his office, the administrator or the receptionist should check for the employee name matching with that of the letter. Isn’t that a hectic task for him/her? Yes. What if I mentioned a particular department, x, in the letter. The letter would reach my friend faster than that of the earlier scene in which I haven’t mentioned the department.” Isn’t it the same with the networks? Let us look into the details.
IP address:
It is the unique address assigned to each device on the network to identify it. It, IPv4, is a 32-bit number represented as four octets separated by a period. For example, 128.0.53.1 is an IPv4 address representing by 4 octets, each octet is 8 bits.
Each IP address has two parts. One is the network address that gives the information about the network to which that device belongs to and the other one is the host address that specifies the device on that network. The length of the “first part” depends on the network class it belongs to.
Network Classes:
| Class | Network ID | Range | Possible no.of hosts |
| A | First octet | 0.0.0.0 to 127.255.255.255 | 16777214 |
| B | First two octets | 128.0.0.0 to 191.255.255.255 | 65534 |
| C | First three octets | 192.0.0.0 to 223.255.255.255 | <=254 |
Subnet:
Remember the imaginary situation? Now, let’s say that the letter is ‘data’, the office address is ‘IP address of the router’ and my friend is ‘device’. Suppose the data has reached the router with the IP address given and now it has to reach the device connected in the network. There could be millions of devices connected (depending upon the class) in the network with IP address of different classes. It takes too long if the data visits every device on the network and then confirm if it is the destination.
Here comes the subnet! It is analogous to the department in the company. As the administrator has the details of the departments, the router has the details of subnet masks. When the data reaches the router, it then searches for the device with the subnet that is intended to. Hence, the data reaches its destination.
The usage of subnets increases the efficiency of the network by decreasing the time taken to reach the destination.
A subnet mask is a 32-bit number that defines the range of IP addresses available within a network. Systems within the same subnet can communicate with each other directly whereas systems on different subnets should communicate with router as a medium.
Default subnet masks:
Class A: 255.0.0.0
Class B: 255.255.0.0
Class C: 255.255.255.0
Understanding the concept of IP address and Subnet:
Let’s take the IP address: 192.168.1.0
Class: C
Default subnet mask: 255.255.255.0
Now, we have a network with IP address 192.168.1.0.
Since it is class C, the first three octets represent the Network ID and the last octet Host ID. Heads-up! The topic will get little confusing. Shall take it slow!
Let’s say we need 30 hosts. We can use class C for the range of IP addresses, available 256. How? First three octets are constant for class C and the last octet has 8 bits which gives 256 possibilities when converted to binary (0-255). But only 254 are usable IP addresses as the first and last bits are reserved for network and broadcast addresses respectively. Do not worry if you are not aware of them (Given at the end). But for now, remember that two addresses are always reserved.
We have the formula now, if you observe, i.e. 2no.of host ID bits – 2 which is in this case, 28 – 2 = 256-2 = 254. In the same way, if class A or B is used, then there is a large scale wastage of IP addresses. Even for class C, only 20 are usable and the remaining 254 – 20 = 234 are not used. Here comes the efficiency of subnetting.
If you have observed, 25 – 2 = 30 gives me the required number of IP addresses. In this case the number of host ID bits required are 5. It means that we can use the other three bits for something else. Why can’t we do that for subnets!? Yes, let’s see how.
Binary representation of 192.168.1.0 is 11000000.10101000.00000001.00000000.
If we take 3-bits from Host ID, we can form 8 subnets. Again, how? It will be more clear when the binary conversion is made.

Possible subnets are:
- 192.168.1.0
- 192.168.1.32
- 192.168.1.64
- 192.168.1.96
- 192.168.1.128
- 192.168.1.160
- 192.168.1.192
- 192.168.1.224
How many bits did we reserve for subnet? Yes, 3. If you are unclear about the concept, kindly revise again. We will take this little forward from here. So, let’s be clear.
Now in the default subnet of class C: 255.255.255.0 in binary 11111111.11111111.1111111.00000000, the last octet’s first three bits will be “111” as three bits from Host ID is taken for subnet. If four bits are taken, then total of four ones “1111” will be the first four bits of the last octet. Here is the pictorial representation.
Now, how many ones we got in the binary representation of subnet? 27. We can represent the IP address along with subnet as follows; 192.168.1.32/27, that /27 indicates there are 27 1s in the subnet and the subnet is 255.255.255.224.
Clear? Hopefully, yes! With the help of turned on bits, 1s, in the subnet the network to which the device belongs can be identified. Let’s get more clear with a short example.
IP address: 172.17.250.145 with subnet mask 255.255.248.0. Now this IP address belongs to subnet 172.17.248.0. Think for sometime and if not understanding, let’s see.
Read this explanation with sync look on the Figure. The IP address 172.17.250.145 belongs to class B and default subnet mask is 255.255.0.0. Now the given subnet mask given is 255.255.248.0. If we observe, there are 5 1s in the given IP address’s binary form. It is in the third octet and the first five bits. So, it can be concluded that the subnet has “ first five bits of third octet as 1s and all the remaining 11 bits in Host ID as 0s”. What will the resulting subnetting would be? Yes, 255.255.248.0. The given IP address is nothing but the permutation (of 0s and 1s) of the IP of subnet 172.17.248.0. Got clear? That is all. Here is a short example to get things in a different view!
Q: Required subnets are say 6. Number of needed hosts are 30. Given IP address is 200.168.56.0. Find subnet address.
Number of subnets=6
Number of host bits allocated => 2x=6 i.e. x=3 where 8 subnets are available.
X indicates the number of host bits for the subnet.
Now, the subnet binary representation will be 11111111.11111111.11111111.11100000 which results as 255.255.255.224.
Each subnet gives 32 addresses. How? The total Host ID bits are 5 that gives 25 i.e. 32 addresses. As such 8 subnets are available.
Ranges would be:
Subnet 1: 200.168.56.0 to 200.168.56.31
Subnet 2: 200.168.56.32 to 200.168.56.63
Subnet 3: 200.168.56.64 to 200.168.56.95
Subnet 4: 200.168.56.96 to 200.168.56.127
Subnet 5: 200.168.56.128 to 200.168.56.159
Subnet 6: 200.168.56.160 to 200.168.56.191
Subnet 7: 200.168.56.192 to 200.168.56.223
Subnet 8: 200.168.56.224 to 200.168.56.255
To each subnet (sub network), the boundary IP addresses cannot be allocated to any device. This is same as the network’s ignorance of IP addresses. One is for subnet ID and broadcast ID.
Classless Inter-domain Routing (CIDR):
It is a standard notation of the IP address including subnet notation. Remember how we alternatively represented the IP address along with the subnet? 192.168.1.32/27; /27 specifies that there are 27 1s in the subnet (from the beginning) and the subnet is 255.255.255.224 i.e. 11111111.11111111.11111111.11100000 in binary.
Network Address: It is the first address in the network and is used to identify the particular network segment. All the IP addresses, using the same network address part, belong to the same network segment.
Broadcast Address: It is the last address in the network and is used to address all the nodes of the network at the same time. If the same data has to be sent to all the devices in a network segment, then the broadcast address is used.
Disadvantage of subnet:
Apart from the advantage of increasing efficiency, there exists one disadvantage of the subnet, that too in efficiency. When not subnet, the packet should resolve the Network address → Host ID → Port. But when the subnet is used, the resolving process would be Network address → Subnet →Host ID →Port. This increases a step in the process of identification of the destination.
We don’t expect or it isn’t common that one will expertise things in one go. It takes time. But if you are ready to give your time, you are going to nail it. If any queries or suggestions, we are always at the door to welcome you!