How to become Iron Man of Subnetting?
Network Inside Network

During my examination preparation, one of the topics that always remained painful was Subnetting in a computer network. After reading many different authors' books, I understood things in different ways. Some say don’t change network bits, and some say only change the zero parts of a subnet mask, which made me frustrated. However, after various ups and downs, I came through it. I will explain how to become the Iron Man of Subnetting easily.
So sit back and enjoy the content, I suggest you take a pen and paper and note important things in this following article.
Table of Content
· What is a Subnet?
· Different Parts of IP Address
· Subnet Mask:
· Subnetting in Classful Addressing
∘ Different Classes of IP addresses
∘ Subnetting
· Subnetting in Classless Addressing In CIDR
∘ What is Classless addressing
∘ Subnetting
· VLSM (Variable Length Subnet Masking):
∘ Why?
∘ How?
∘ Advantages of VLSM
∘ Disadvantages of VLSM
What is a Subnet?
So the first question is what is a subnet and what is necessity, so a subnet is a smaller group of networks in a large network. It is just a way to divide the whole network into small networks so that each device in the network can able to communicate and transmit data easily by using the network ID or the broadcast ID in case all hosts in the network receive the data.
Key necessities of subnetting:
- Efficient use of IP address space.
- Reduced network congestion.
- Improved network performance and security.
Different Parts of IP Address
For the IPV4(which is also the 4th version of IP addressing) 4 octets(8 bits) define the network and the host bits of an IP address which are separated by dots(for eg., 192.168.1.1) that collectively make 32-bit, so simply each part of an IP address tells us 2 things which is one part is network bits and the other part is host bits.
- Network Portion: This is defined as the IP address of the network to which hosts belong to
- Host Portion: The remaining portion. This is the actual IP address to which each device is assigned to that network. This part makes each device in the network unique within the network.
Now we have 2 types of addressing:-
- Classful Addressing
- Classless Addressing
Subnet Mask:
To study further we need to master this concept for sure, so in Simple languages, it is a way to identify the number of network bits in an IP address. This is also a 32-bit number used in IP addressing to separate the network portion of an IP address from the host portion I formally told this, LOL!
This determines the number of bits allocated for the network ID in an IP address. If any network ID looks (11111111.11111111.10000000.0000000) which is also similar to(255.255.128.0) so here 17 bits are reserved for the network while the remaining 15 are for hosts
So here 1’s reserved for the network ID, while all 0’s are for hosts
This subnet allows for 2¹⁵−2 = 32,7662 usable host addresses (subtracting 2 for the network and broadcast addresses).
Note: If we do logical and (&) operations of the subnet mask with IP Address then we get an address which is called the network ID of the IP address.
Subnetting in Classful Addressing
Different Classes of IP addresses
The 32-bit IP address is divided into sub-classes. These are given below:
- Class A: The network ID is 8 bits long and the host ID is 24 bits long. The first octet is reserved with network bits. The Subnet Mask of Class-A is 255.0.0.0
- Class B: The network ID is 16 bits long and the host ID is 16 bits long. The first and second octet is reserved with network bits. The Subnet Mask of Class-B is 255.255.0.0
- Class C: The network ID is 24 bits long and the host ID is 8 bits long. The first, second, and third octet is reserved with network bits. The Subnet Mask of Class-C is 255.255.255.0
The other 2 Class D and Class E are reserved for research purposes, military, and future use cases.
Subnetting
Let’s say we want to do a subnet with the Class C IP address(for eg., 193.1.2.00000000) into two subnets, in which 3 octets are reserved for network bits.
For subnet-1: The first bit of the host bit is reserved and toggled for subnetting into 2 parts, let’s say for part 1 we reserve the first part and make it Zero, so it looks like(193.1.2.00000000) and the last IP address in which are other than a reserved bit all are 1's(193.1.2.01111111).
Thus, the range of subnet 1 is: 193.1.2.0 to 193.1.2.127
Subnet id of Subnet-1 is : 193.1.2.0
The direct Broadcast ID of Subnet-1 is: 193.1.2.127
The total number of hosts possible is 126Why only 126 are usable as two of them are reserved for different works like the first one is for network identification(193.1.2.0) and the last one is for Broadcasting ID which is used to send messages to all of the hosts in the network(193.1.2.127). So from a total of 128, we have 128-2 = 126 usable hosts.
For Subnet-2: Similarly, as the first bit Is reserved in subnet-1 here also it reserved but this time it changed to 1, so this time it looks like(193.1.2.10000000) and the last IP address in which all are 1’s so it looks like something like this(193.1.2.11111111)
Thus the range of subnet 2 is: 193.1.2.128 to 193.1.2.255
The subnet ID of Subnet-2 is: 193.1.2.128
The direct Broadcast ID of Subnet-2 is: 193.1.2.255
The total number of hosts possible is 126(128-2)Note:
- To divide a network into four (2²) parts you need to choose two bits from the host ID part for each subnet i.e., (00, 01, 10, 11).
- To divide a network into eight (2³) parts you need to choose three bits from the host ID part for each subnet i.e., (000, 001, 010, 011, 100, 101, 110, 111) and so on.
- So we can say that if the total number of subnets in a network increases the total number of usable hosts decreases or vice-versa.
Subnetting in Classless Addressing In CIDR
What is Classless addressing
Classless addressing is introduced because around 268 million are wasted in classful addressing. As the company doesn't need 1 million IP addresses it only requires some 1000 IPs so to tackle this problem, this concept in which we allow flexible allocation of IPs by not fixing the number of network bits. Instead, an arbitrary number of network bits can be defined based on the specific requirements, optimizing the utilization of the IPv4 address space.
So a new concept in this classful addressing comes is CIDR notation(‘/’), its significance is that we first define the IP address and then a number followed by ‘/’ which represents the number of bits.
For example, 192.168.122.0/25, which represents as follows:
- The part before ‘/’ is the IP address.
- Part after ‘/’ is the number of bits reserved for the network IDs(11111111.11111111.11111111.10000000).
- The number of bits left over is for the Host IDs(which are 32–25 = 7).
Subnetting
As we did in Classful addressing same happens here in Classless, we just toggle the fixed number of bits to divide the massive big network into small chunks of a network. This is overwhelming let’s understand it with an example.
Consider we have a network of
Network ID: 192.168.128.0/17
Subnet mask: 11111111.11111111.10000000.00000000
Number of Subnets Required: 2
let’s say I want to divide this into 2 different subnets(Subnet-1 and Subnet-2)
So as we did in the classful addressing similarly, here we borrow a bit from the host bit and use it to create two different subnets.
The first bit of the borrowed bit determines the subnet which needs to be toggled to create subnets:
Subnet-1: The borrowed bit is 0.
Network ID: 192.168.128.0/18
Range: 192.168.128.0 to 192.168.191.255VLSM (Variable Length Subnet Masking):
Why?
An essential feature of subnetting is that we are dividing the whole big network into fragments of a network of different or variable length of range requirements. This feature most importantly works well for classless addressing, it eliminates the wastage of IPs which leads to efficient usage for sure.
How?
It is a 3 step approach that was created by me while I was studying VLSM
Step 1: Start with a large network address and do the subnetting based on the largest network requirement.
Step 2: Subdivide the remaining address space further using smaller subnet masks for smaller subnets.
Step 3: Repeat the process until all subnet requirements are fulfilled.
I think this is wholesome so let’s understand with an example.
Consider an example in which you have given a network with a network ID 192.168.1.0/24 and you want to make the subnets as follows:
- Subnet A: 50 hosts
- Subnet B: 20 hosts
- Subnet C: 10 hosts
A. For Subnet A: 50 hosts are required → nearest power of 50 in multiple of 2 (2⁶ = 64)
- Required: (50 + 2) hosts → Nearest power of 2 = 64.
- We need 6 host bits as 2⁶ = 64
- Total Network bits = (32–6) = 26
- Subnet mask:
/26(255.255.255.192). - Network:
192.168.1.0/26(usable IPs:192.168.1.1-192.168.1.62).
B. For Subnet B: 20 hosts are required → nearest power of 20 in multiple of 2 (2⁵ = 32)
- Required: (20 + 2) hosts → Nearest power of 2 = 32.
- We need 6 host bits as 2⁵ = 32
- Total Network bits = (32–5) = 27
- Subnet mask:
/27(255.255.255.224). - Network:
192.168.1.64/27(usable IPs:192.168.1.65-192.168.1.94).
C. For Subnet C: 10 hosts are required → nearest power of 10 in multiple of 2 (2⁴ = 16)
- Required: (10 + 2) hosts → Nearest power of 2 = 16.
- We need 6 host bits as 2⁴= 32
- Total Network bits = (32–4) = 28
- Subnet mask:
/28(255.255.255.240). - Network:
192.168.1.96/28(usable IPs:192.168.1.97-192.168.1.110).
You will notice that I added 2 to every host because as you know about 2 unusual host IPs which are:
- Network ID
- Broadcast ID
Advantages of VLSM
- Efficient IP address utilization.
- Scalable for hierarchical networks.
- Reduces wastage compared to fixed-length subnetting.
Disadvantages of VLSM
- More complex design and management.
- Requires proper planning to avoid overlap.
- May increase routing table size.
So finally, this concludes our Subnetting Master article, Now you are the Iron Man of Subnetting, if you have any questions or find something wrong in this article then comment freely I will try to change the issue as speed as possible.