Introduction
In today’s world of computer networking, understanding IP address subnetting is a crucial skill for anyone managing or configuring networks. Subnetting helps divide large networks into smaller, more manageable subnetworks (or subnets). It improves network performance, enhances security, and makes efficient use of available IP addresses.
Whether you’re an IT student, network administrator, or someone preparing for certifications like CCNA, learning how to calculate subnets is essential. In this article, we’ll break down the process step-by-step to make subnetting easier to understand — even for beginners.
What Is an IP Address?
An IP (Internet Protocol) address is a unique number assigned to every device connected to a network. It helps identify and communicate with other devices on the same or different networks.
There are two main versions of IP addresses:
IPv4 (Internet Protocol version 4): Uses 32 bits, written in the format 192.168.1.1
IPv6 (Internet Protocol version 6): Uses 128 bits, written in hexadecimal format
In this article, we’ll focus on IPv4 subnetting, as it’s the most commonly used format in traditional networks.
Understanding Subnetting
Subnetting is the process of dividing a large network (called a Class A, B, or C network) into smaller subnetworks. Each subnet functions as an independent network, but all belong to the same larger network.
This process is useful for:
Reducing network congestion
Increasing security by isolating network segments
Efficiently managing IP address allocation
IP Address Structure
An IPv4 address consists of 32 bits, divided into four sections (called octets), each containing 8 bits:
192.168.10.5 → 11000000.10101000.00001010.00000101
Each bit can be 0 or 1, which gives 2³² (4,294,967,296) possible IPv4 addresses.
Every IP address has two parts:
Network ID: Identifies the specific network.
Host ID: Identifies a device (host) within that network.
Subnetting allows you to borrow bits from the host portion to create more networks.
What Is a Subnet Mask?
A subnet mask determines which portion of an IP address refers to the network and which refers to the host.
For example:
IP Address: 192.168.1.10
Subnet Mask: 255.255.255.0
In binary, this looks like:
IP Address: 11000000.10101000.00000001.00001010
Subnet Mask: 11111111.11111111.11111111.00000000
Here, the first 24 bits (1s) represent the network part, and the last 8 bits (0s) represent the host part.
So, this is a /24 subnet (because 24 bits are used for the network).
Subnetting Example
Let’s go step-by-step through a subnetting example.
Example:
You have a network:
192.168.10.0/24
You need 4 subnets.
Step 1: Determine the Number of Bits to Borrow
The formula to calculate required subnets is:
2ⁿ ≥ Number of Subnets
To create 4 subnets:
2ⁿ ≥ 4 → n = 2 bits
So, borrow 2 bits from the host portion.
Step 2: Calculate New Subnet Mask
The original mask /24 plus 2 borrowed bits becomes /26.
Now the subnet mask becomes:
255.255.255.192
(Each borrowed bit adds value to the mask — 128 + 64 = 192)
Step 3: Determine Subnet Increments
The increment is calculated using the last subnet octet:
256 – 192 = 64
So, each subnet increases by 64.
Subnets will be:
192.168.10.0/26
192.168.10.64/26
192.168.10.128/26
192.168.10.192/26
Step 4: Determine Host Range for Each Subnet
Each /26 network has 64 total addresses. But remember, 2 addresses are reserved:
One for Network ID
One for Broadcast Address
So, usable hosts per subnet:
64 – 2 = 62 hosts
Now, let’s define each subnet range:
Subnet Network Address Usable Range Broadcast Address
1 192.168.10.0 192.168.10.1 – 192.168.10.62 192.168.10.63
2 192.168.10.64 192.168.10.65 – 192.168.10.126 192.168.10.127
3 192.168.10.128 192.168.10.129 – 192.168.10.190 192.168.10.191
4 192.168.10.192 192.168.10.193 – 192.168.10.254 192.168.10.255
Subnetting Formulas
Here are some quick formulas for subnet calculations:
Formula Description
2ⁿ Number of Subnets (n = bits borrowed)
2ʰ – 2 Number of Usable Hosts (h = host bits left)
256 – Subnet Mask Value Block Size (increment between subnets)
Subnetting Classes Overview
Class Default Subnet Mask Default Prefix Network Bits Host Bits
Class A 255.0.0.0 /8 8 24
Class B 255.255.0.0 /16 16 16
Class C 255.255.255.0 /24 24 8
Example:
Class A: 10.0.0.0/8
Class B: 172.16.0.0/16
Class C: 192.168.1.0/24
CIDR Notation
CIDR (Classless Inter-Domain Routing) allows flexibility in subnetting by using a prefix length (like /24 or /26) instead of fixed classes.
For example:
192.168.10.0/26
This means the first 26 bits are network bits, and the remaining 6 bits are for hosts.
Why Subnetting Matters
Improved Network Performance:
Smaller networks reduce broadcast traffic and improve efficiency.
Better IP Management:
Subnets prevent wastage of IP addresses.
Enhanced Security:
Network isolation reduces unauthorized access and data breaches.
Easier Troubleshooting:
Identifying issues becomes faster within smaller network segments.
Common Subnet Masks Reference Table
CIDR Subnet Mask Hosts Subnets (from /24)
/25 255.255.255.128 126 2
/26 255.255.255.192 62 4
/27 255.255.255.224 30 8
/28 255.255.255.240 14 16
/29 255.255.255.248 6 32
/30 255.255.255.252 2 64
Conclusion