Sharing notes from my ongoing learning journey — what I build, break and understand along the way.
What Is a Subnet? Detailed Explanation with Real-World Examples
What Is a Subnet? Full Explanation of Subnetting, CIDR, and Real-World Use Cases
While going through my learning journey in networking, I came across the term subnet quite frequently. At first, it was a bit abstract to me, but the more I studied, the more it started to make sense. This post is my attempt to write down what I’ve understood so far — partly for my own reference, and partly to share with others who are also learning.
1. What Is a Subnet?
Simple definition:
A subnet (short for “subnetwork”) is a logically segmented part of a larger IP network.
In other words, you take an IP block and divide it into smaller pieces to create manageable, isolated, and optimized network segments. These smaller segments are what we call subnets.
2. Why Use Subnets?
What’s the point of breaking a network into subnets? Here are some reasons:
Reason | Explanation |
---|---|
Manageability | Breaking large networks into segments makes them easier to handle. |
Security | You can apply access restrictions between different subnets. (e.g. finance can access only its own resources) |
Performance | Broadcast traffic stays within the subnet → less load on the whole network. |
Address Planning | Helps use IP addresses more efficiently. |
Logical Separation | You can group users by department or physical location. |
3. How Are Subnets Created? (CIDR and Netmask)
Every IP address consists of two parts:
- The network part
- The host (device) part
Subnetting is how we split those parts. A subnet mask (or CIDR notation) defines that split.
Example:
- IP:
192.168.1.10
- Subnet Mask:
255.255.255.0
→ this is also written as/24
This means:
- First 24 bits = network portion
- Last 8 bits = used for devices (hosts)
So:
- Network address:
192.168.1.0
- Broadcast address:
192.168.1.255
- Usable IPs:
192.168.1.1
–192.168.1.254
(254 in total)
4. What Is CIDR and How Is It Related?
CIDR (Classless Inter-Domain Routing) is a method of writing subnet masks using a slash and number format (e.g. /24
).
CIDR | IP Count | Description |
---|---|---|
/24 | 256 | Standard small network |
/25 | 128 | Half of a /24 |
/26 | 64 | Smaller network |
/16 | 65,536 | Large organizations |
Rule: The higher the CIDR number, the smaller the subnet → fewer available IPs.
5. Subnet Calculation
Example:
Say I have the 192.168.0.0/24
block → that’s 256 IP addresses.
I want to split it into 4 equal subnets.
Solution:
256 / 4 = 64 IPs per subnet
→ Each subnet will be a /26:
Subnet | CIDR | IP Range |
---|---|---|
A | 192.168.0.0/26 | 192.168.0.0 – 192.168.0.63 |
B | 192.168.0.64/26 | 192.168.0.64 – 192.168.0.127 |
C | 192.168.0.128/26 | 192.168.0.128 – 192.168.0.191 |
D | 192.168.0.192/26 | 192.168.0.192 – 192.168.0.255 |
Each of these can now be assigned to a different department!
6. Types of Subnets
Public Subnet
- Accessible from the internet (e.g. web server)
- Usually paired with an internet gateway
Private Subnet
- Internal resources (e.g. database server)
- Requires a NAT device to reach the internet
- Not directly reachable from outside
7. Real-World Scenario
Let’s say a company has three departments:
- IT (50 people)
- HR (20 people)
- Management (10 people)
The company owns the 192.168.0.0/24
block.
I can split it like this:
192.168.0.0/26
→ IT (62 hosts)192.168.0.64/27
→ HR (30 hosts)192.168.0.96/28
→ Management (14 hosts)- Remaining space → guests, printers, backup systems
This way each group is isolated, secure, and easier to manage.
8. Things to Know About Subnets
Tip | Detail |
---|---|
First IP → Network address | Not usable by hosts |
Last IP → Broadcast address | Not usable by hosts |
IP ranges must not overlap | Two subnets cannot share the same IP |
CIDR is fixed once defined | Cannot be changed afterward — plan ahead! |
Each subnet is its own broadcast domain | Switch broadcasts stay within the subnet only |
Subnetting might look complicated at first glance, but it’s a powerful and essential tool in network design. Understanding how to logically divide a network makes everything — from security to performance — easier and more efficient. I’ll keep digging deeper as I learn, but for now, this is what I’ve gathered.