Subnetting Pro: From Basics to Advanced IPv4 Networking Skills
The Ultimate Guide to Subnetting and IPv4 Address Classes: Learn from Basics to Advanced
If you’ve ever wondered how computers in big networks talk to each other without chaos, or how your home Wi-Fi knows which device to send data to, the answer lies in IP addressing and subnetting. This blog will walk you through everything you need to know about subnetting, IP address classes, and how networks are structured.
What is an IP Address?
An IP (Internet Protocol) address is a unique number assigned to every device connected to a network, like your phone, laptop, or even a smart fridge! Think of it as your home address but for computers — it tells data where to go.
IPv4 Address Format
-
IPv4 addresses are 32 bits long and written as four decimal numbers separated by dots, like this:
192.168.1.10
-
Each number is called an octet and ranges from 0 to 255.
What is Subnetting?
Subnetting is the process of dividing a large network into smaller, manageable subnetworks (subnets).
Imagine a big school with 500 students all in one hall. It would be chaotic! So, the school divides students into classrooms based on grades or sections. Similarly, subnetting divides big networks into smaller groups so devices communicate efficiently without traffic jams.
Why Do We Need Subnetting?
-
Efficient use of IP addresses: Avoid wasting IPs by assigning only as many as needed.
-
Reduce network traffic: Subnets limit broadcast traffic to smaller areas.
-
Improved security: Each subnet can have its own security rules.
-
Better network management: Easier to isolate problems.
Understanding Subnet Masks
A subnet mask tells you how much of the IP address belongs to the network and how much belongs to the device (host).
-
Written like an IP address:
255.255.255.0
-
It’s a 32-bit number, where 1s mark the network part and 0s mark the host part.
Example:
IP Address | 192.168.1.10 | Binary: 11000000.10101000.00000001.00001010 |
---|---|---|
Subnet Mask | 255.255.255.0 | Binary: 11111111.11111111.11111111.00000000 |
The subnet mask 255.255.255.0
means the first 24 bits are network bits and last 8 bits are host bits. So the network is 192.168.1.0
and hosts can be from 192.168.1.1
to 192.168.1.254
.
CIDR Notation — The Shortcut
Instead of writing 255.255.255.0
, we use CIDR (Classless Inter-Domain Routing) notation like /24
, which means the first 24 bits are for the network.
Examples:
CIDR | Subnet Mask | Number of Hosts per Subnet |
---|---|---|
/24 | 255.255.255.0 | 256 total, 254 usable |
/28 | 255.255.255.240 | 16 total, 14 usable |
IPv4 Address Classes — The Basics
IPv4 addresses are grouped into five classes (A to E) based on the first few bits. This system was designed to allocate IP ranges efficiently.
Class A
-
Range: 1.0.0.0 to 126.255.255.255
-
First bit: Always 0
-
Network bits: First 8 bits (1st octet)
-
Host bits: Last 24 bits
-
Number of networks: 126
-
Hosts per network: ~16 million
-
Used by: Very large networks like big companies or ISPs
-
Default subnet mask: 255.0.0.0 or /8
Class B
-
Range: 128.0.0.0 to 191.255.255.255
-
First bits: 10
-
Network bits: First 16 bits (first two octets)
-
Host bits: Last 16 bits
-
Number of networks: 16,382
-
Hosts per network: ~65,000
-
Used by: Medium to large networks like universities
-
Default subnet mask: 255.255.0.0 or /16
Class C
-
Range: 192.0.0.0 to 223.255.255.255
-
First bits: 110
-
Network bits: First 24 bits (first three octets)
-
Host bits: Last 8 bits
-
Number of networks: Over 2 million
-
Hosts per network: 254
-
Used by: Small businesses, home networks
-
Default subnet mask: 255.255.255.0 or /24
Class D (Multicast)
-
Range: 224.0.0.0 to 239.255.255.255
-
Used for: Multicasting, sending data to multiple devices at once, e.g., video streaming
Class E (Experimental)
-
Range: 240.0.0.0 to 255.255.255.255
-
Reserved for: Experimental use, research
Private IP Addresses — Networks You Can Use at Home or Office
These IP ranges are reserved for private use and cannot be routed on the public internet:
Class | Private Range | Default Mask |
---|---|---|
Class A | 10.0.0.0 to 10.255.255.255 | 255.0.0.0 (/8) |
Class B | 172.16.0.0 to 172.31.255.255 | 255.240.0.0 (/12) |
Class C | 192.168.0.0 to 192.168.255.255 | 255.255.0.0 (/16) |
Real-World Example: Subnetting 192.168.10.0/24 into 4 Subnets
You have a network 192.168.10.0/24
which gives 256 IP addresses.
You want 4 subnets for different departments (HR, IT, Sales, Marketing).
How to do it:
-
Step 1: Determine bits to borrow for subnetting
Need 4 subnets → 2 bits (since 2²=4) -
Step 2: New subnet mask:
Original /24 + 2 bits = /26 → 255.255.255.192 -
Step 3: Calculate hosts per subnet:
32 total bits - 26 network bits = 6 host bits
Hosts per subnet = 2⁶ - 2 = 62 usable hosts
Subnet ranges:
Subnet | Network Address | Usable IP Range | Broadcast Address |
---|---|---|---|
1 | 192.168.10.0/26 | 192.168.10.1 - 62 | 192.168.10.63 |
2 | 192.168.10.64/26 | 192.168.10.65 - 126 | 192.168.10.127 |
3 | 192.168.10.128/26 | 192.168.10.129 - 190 | 192.168.10.191 |
4 | 192.168.10.192/26 | 192.168.10.193 - 254 | 192.168.10.255 |
Example to Understand Bit Changes in Subnet Mask
-
IP:
124.24.24.56/24
-
Here, last 8 bits are for hosts (256 addresses) ranging from
124.24.24.0
to124.24.24.255
-
-
IP:
128.24.24.188/28
-
Now last 4 bits (32 total bits - 28 network bits) are changeable for hosts.
-
Only 16 IP addresses in this subnet, but 14 usable (excluding network & broadcast)
-
Key Terms to Remember
Term | Meaning |
---|---|
Network Address | The first address of a subnet (not usable for devices) |
Broadcast Address | The last address of a subnet, used to send messages to all devices |
Host Addresses | Usable IP addresses assigned to devices |
Summary Cheat Sheet for Subnetting
CIDR | Subnet Mask | Total IPs | Usable Hosts |
---|---|---|---|
/24 | 255.255.255.0 | 256 | 254 |
/25 | 255.255.255.128 | 128 | 126 |
/26 | 255.255.255.192 | 64 | 62 |
/27 | 255.255.255.224 | 32 | 30 |
/28 | 255.255.255.240 | 16 | 14 |
Final Tips to Master Subnetting
-
Practice with real IP addresses and subnet masks.
-
Use subnet calculators to verify your answers.
-
Draw subnet diagrams to visualize network ranges.
-
Memorize important CIDR values and their hosts.
-
Understand IP classes but remember modern networks mostly use CIDR.
With this blog, you have everything to start mastering subnetting — from basic concepts, IP classes, subnet mask calculation, to real-world practical examples. Keep practicing and soon subnetting will become second nature!