Subnetting is the process of dividing a large IP network into smaller logical networks called subnets.
It is done by borrowing bits from the host portion of an IP address and using them as network bits.
Subnetting helps in organizing networks efficiently and improves network management.
Subnetting means breaking a large network into smaller manageable networks.
Example:
Instead of using one large network for an entire organization, it can be divided into multiple smaller networks for different departments such as:
Each department can have its own subnet.
An IPv4 address consists of two parts:
1️⃣ Network Portion – Identifies the network
2️⃣ Host Portion – Identifies the device within that network
During subnetting:
Consider the network:
192.168.1.0/24
This network contains:
If we divide it into two subnets, each subnet will have:
Example subnets:
| Subnet | Network Address | Host Range | Broadcast Address |
| Subnet 1 | 192.168.1.0 | 192.168.1.1 – 192.168.1.126 | 192.168.1.127 |
| Subnet 2 | 192.168.1.128 | 192.168.1.129 – 192.168.1.254 | 192.168.1.255 |
Subnetting is used to:
A company has one network:
192.168.10.0/24
Departments:
Using subnetting, the network can be divided into four smaller networks so each department has its own subnet.
Subnetting provides several advantages in network design and management. By dividing a large network into smaller subnets, organizations can improve performance, security, and efficient utilization of IP addresses.
One of the most important benefits of subnetting is efficient use of IP addresses.
Without subnetting, a large block of IP addresses may be wasted. By dividing the network into smaller subnets, IP addresses can be assigned according to the actual number of hosts required.
Network: 192.168.1.0/24
Total IP addresses = 256
If an organization has three departments:
Subnetting allows the network administrator to divide the IP addresses so each department receives only the required number of addresses instead of wasting the entire network.
In a large network, broadcast traffic increases and can slow down network performance.
Subnetting reduces broadcast domains because each subnet has its own broadcast address. As a result, broadcast traffic remains within that subnet only.
This helps improve network performance.
Subnetting allows administrators to separate departments or services into different subnets.
Example:
Using routers or firewalls, access between these networks can be controlled, which improves overall security.
Smaller networks are easier to manage compared to one large network.
Network administrators can easily:
Each subnet can be managed independently.
When a network is divided into smaller subnets:
This improves the overall speed and efficiency of the network.
Subnetting helps organize networks according to departments, floors, or locations.
Example:
| Department | Subnet |
| IT | 192.168.1.0/26 |
| HR | 192.168.1.64/26 |
| Finance | 192.168.1.128/26 |
| Sales | 192.168.1.192/26 |
This logical organization makes network design cleaner and easier to maintain.
Subnetting can be classified mainly into two types based on how the subnet masks are used to divide a network.
FLSM (Fixed Length Subnet Mask) is a subnetting method where all subnets have the same subnet mask and the same number of hosts.
This means every subnet created from the network has equal size.
Network: 192.168.1.0/24
If we divide it using /26, we get 4 equal subnets.
| Subnet | Network Address | Host Range | Broadcast |
| 1 | 192.168.1.0 | 192.168.1.1 – 192.168.1.62 | 192.168.1.63 |
| 2 | 192.168.1.64 | 192.168.1.65 – 192.168.1.126 | 192.168.1.127 |
| 3 | 192.168.1.128 | 192.168.1.129 – 192.168.1.190 | 192.168.1.191 |
| 4 | 192.168.1.192 | 192.168.1.193 – 192.168.1.254 | 192.168.1.255 |
Each subnet contains the same number of hosts.
It may cause IP address wastage when different departments require different numbers of hosts.
VLSM (Variable Length Subnet Mask) is a subnetting technique where subnets are created with different subnet masks based on host requirements.
This allows more efficient use of IP addresses.
Network: 192.168.1.0/24
Host requirements:
| Department | Hosts Needed |
| IT | 120 |
| HR | 50 |
| Finance | 25 |
| Sales | 10 |
Using VLSM:
| Department | Subnet |
| IT | 192.168.1.0/25 |
| HR | 192.168.1.128/26 |
| Finance | 192.168.1.192/27 |
| Sales | 192.168.1.224/28 |
Each subnet is created according to the required host size.
| Feature | FLSM | VLSM |
| Subnet Size | Same | Different |
| Subnet Mask | Fixed | Variable |
| IP Utilization | Less efficient | More efficient |
| Flexibility | Low | High |
There are two types of subnetting:
1️⃣ FLSM (Fixed Length Subnet Mask) – all subnets are equal in size.
2️⃣ VLSM (Variable Length Subnet Mask) – subnets have different sizes based on host requirements.
VLSM (Variable Length Subnet Mask) is a subnetting technique that allows a network to be divided into subnets of different sizes based on the number of hosts required.
Unlike traditional subnetting, where all subnets have the same size, VLSM allows more flexibility and efficient use of IP addresses.
VLSM means creating subnets of different sizes according to the requirement of hosts.
Example:
If a company has departments with different numbers of devices:
Instead of assigning the same subnet size to every department, VLSM allows assigning larger subnets to large departments and smaller subnets to small departments.
In VLSM, subnetting is performed in such a way that:
1️⃣ The largest network requirement is allocated first.
2️⃣ Then the remaining networks are assigned smaller subnet sizes.
This ensures efficient IP address utilization.
Network: 192.168.1.0/24
Host requirements:
| Department | Hosts Needed |
| IT | 120 |
| HR | 50 |
| Finance | 25 |
| Sales | 10 |
Using VLSM:
| Department | Subnet |
| IT | 192.168.1.0/25 |
| HR | 192.168.1.128/26 |
| Finance | 192.168.1.192/27 |
| Sales | 192.168.1.224/28 |
Each subnet is created based on the required number of hosts.
| Feature | Traditional Subnetting | VLSM |
| Subnet Size | Same size | Different sizes |
| IP Utilization | Less efficient | More efficient |
| Flexibility | Low | High |
Choose the value of 2ⁿ (power of 2) such that the result is greater than or equal to the required number of hosts.
The power value (n) represents the number of host bits (0s) in the subnet mask.
Use this to determine the new CIDR/subnet mask.
The Network Address is the starting address of the subnet, represented using the given or newly calculated CIDR notation.
The first usable host address is obtained by adding 1 to the last octet of the network address.
The block size is calculated using the formula:
Block Size = 256 − (value of the last octet of the new subnet mask)
The next subnet address is obtained by adding the block size to the last octet of the current network address.
The broadcast address is found by subtracting 1 from the next subnet address.
The last usable host address is obtained by subtracting 1 from the broadcast address.
🔢 Host Calculation
2⁷ = 128 − 2 = 126 Valid Host Addresses
🧱 New Subnet Mask = 11111111.11111111.11111111.10000000 = 255.255.255.128 = /25
🌐 Network Address = 192.168.50.0/25
👤 First Valid Host (FVH) = 192.168.50.1/25
👤 Last Valid Host (LVH) = 192.168.50.126/25
📢 Broadcast Address = 192.168.50.127/25
📏 Block Size = 256 − 128 = 128
➡️ Next Subnet Address = 192.168.50.128/25
🔢 Host Calculation
2⁶ = 64 − 2 = 62 Valid Host Addresses
🧱 New Subnet Mask = 11111111.11111111.11111111.11000000 = 255.255.255.192 = /26
🌐 Network Address = 192.168.50.128/26
👤 First Valid Host (FVH) = 192.168.50.129/26
👤 Last Valid Host (LVH) = 192.168.50.190/26
📢 Broadcast Address = 192.168.50.191/26
📏 Block Size = 256 − 192 = 64
➡️ Next Subnet Address = 192.168.50.192/26
🔢 Host Calculation
2⁵ = 32 − 2 = 30 Valid Host Addresses
🧱 New Subnet Mask = 11111111.11111111.11111111.11100000 = 255.255.255.224 = /27
🌐 Network Address = 192.168.50.192/27
👤 First Valid Host (FVH) = 192.168.50.193/27
👤 Last Valid Host (LVH) = 192.168.50.222/27
📢 Broadcast Address = 192.168.50.223/27
📏 Block Size = 256 − 224 = 32
➡️ Next Subnet Address = 192.168.50.224/27
🔢 Host Calculation
2⁴ = 16 − 2 = 14 Valid Host Addresses
🧱 New Subnet Mask = 11111111.11111111.11111111.11110000 = 255.255.255.240 = /28
🌐 Network Address = 192.168.50.224/28
👤 First Valid Host (FVH) = 192.168.50.225/28
👤 Last Valid Host (LVH) = 192.168.50.238/28
📢 Broadcast Address = 192.168.50.239/28
📏 Block Size = 256 − 240 = 16
➡️ Next Subnet Address = 192.168.50.240/28
📌 In VLSM (Variable Length Subnet Mask), subnetting is always performed first for the subnet that requires the highest number of hosts.
This approach ensures that larger networks receive sufficient IP addresses, and the remaining address space can then be efficiently divided among smaller subnets.
✅ In simple words:
Always arrange the subnets in descending order of host requirements and allocate IP addresses starting from the largest subnet to the smallest subnet.