What Is a Subnet?
A subnet (short for subnetwork) is a logical subdivision of an IP network. Subnetting divides a large network into smaller, more manageable segments. Each subnet functions as its own mini-network with its own range of IP addresses.
Think of it like dividing a large office building into departments. Instead of one giant network where every device can see every other device, subnetting creates separate sections that keep traffic organized and improve security.
For example, a company might divide its network into subnets for different departments: 192.168.1.0/24 for Engineering, 192.168.2.0/24 for Marketing, and 192.168.3.0/24 for Finance. Devices within each subnet can communicate freely, while traffic between subnets goes through a router.
Subnet Masks Explained
A subnet mask determines which portion of an IP address identifies the network and which portion identifies the individual host (device). It's a 32-bit number that "masks" the network portion of the address.
Common subnet masks:
| Subnet Mask | CIDR | Usable Hosts | Description |
|---|---|---|---|
| 255.255.255.0 | /24 | 254 | Most common for small networks |
| 255.255.255.128 | /25 | 126 | Half of a /24 |
| 255.255.0.0 | /16 | 65,534 | Large networks |
| 255.0.0.0 | /8 | 16,777,214 | Very large networks |
How it works: The subnet mask is ANDed (bitwise) with the IP address. Bits set to 1 in the mask represent the network portion; bits set to 0 represent the host portion.
For example, with IP 192.168.1.100 and mask 255.255.255.0 (/24):
- Network address: 192.168.1.0 (first 24 bits)
- Host portion: .100 (last 8 bits)
- Broadcast address: 192.168.1.255
- Usable range: 192.168.1.1 to 192.168.1.254
CIDR Notation
CIDR (Classless Inter-Domain Routing) notation is a compact way to express a subnet mask. Instead of writing 255.255.255.0, you write /24 — the number after the slash indicates how many bits are used for the network portion.
Reading CIDR notation:
- /24 = 256 total IPs, 254 usable (most common for home and small office networks)
- /25 = 128 total IPs, 126 usable
- /26 = 64 total IPs, 62 usable
- /27 = 32 total IPs, 30 usable
- /28 = 16 total IPs, 14 usable
- /30 = 4 total IPs, 2 usable (used for point-to-point links between routers)
- /32 = 1 IP (single host)
Quick formula: Total IPs in a subnet = 2^(32 - prefix length). Usable IPs = Total - 2 (one for network address, one for broadcast).
CIDR replaced the old classful addressing system (Class A, B, C) which wasted huge amounts of address space. With CIDR, you can allocate exactly the number of addresses needed.
Why Subnetting Matters
Reduced broadcast traffic: Broadcasts (like ARP requests) are contained within a subnet. Without subnetting, every device on the network receives every broadcast, wasting bandwidth.
Improved security: Subnets create boundaries. You can apply firewall rules between subnets — for example, preventing the guest Wi-Fi subnet from accessing the internal server subnet.
Better organization: Assigning different subnets to departments, floors, or device types makes the network easier to manage and troubleshoot.
Efficient IP usage: Instead of wasting a full /24 (254 IPs) on a department with only 10 devices, you can assign a /28 (14 usable IPs) and use the remaining addresses elsewhere.
Performance: Smaller subnets mean less broadcast traffic and less congestion, improving overall network performance.
Practical Subnetting Example
Suppose you have the network 10.0.0.0/24 (254 usable IPs) and need to divide it into 4 subnets:
You need 2 extra bits to create 4 subnets (2^2 = 4), changing /24 to /26.
Resulting subnets:
| Subnet | Network Address | Usable Range | Broadcast |
|---|---|---|---|
| 1 | 10.0.0.0/26 | 10.0.0.1 – 10.0.0.62 | 10.0.0.63 |
| 2 | 10.0.0.64/26 | 10.0.0.65 – 10.0.0.126 | 10.0.0.127 |
| 3 | 10.0.0.128/26 | 10.0.0.129 – 10.0.0.190 | 10.0.0.191 |
| 4 | 10.0.0.192/26 | 10.0.0.193 – 10.0.0.254 | 10.0.0.255 |
Each subnet has 62 usable host addresses. Devices in different subnets need a router to communicate with each other. This is how most business networks are structured.
