Subnet Generator
Generate subnet ranges
Subnetting divides a large network into smaller logical segments. VLSM allows subnets of different sizes within the same network, optimizing IP address usage.
What is Subnetting?
Subnetting is the practice of dividing a single IP network into two or more smaller, logical sub-networks (subnets). Each subnet functions as an independent network segment with its own network address, broadcast address, and range of usable host addresses.
Subnetting serves three primary goals:
- Efficient address utilization: Instead of allocating one large block and wasting most of it, you carve out right-sized blocks that match the actual number of hosts in each segment.
- Network segmentation: Subnets create broadcast domains. Devices in one subnet do not receive broadcast traffic from another, reducing congestion and improving performance.
- Security boundaries: Firewalls and access control lists can enforce policies between subnets, isolating sensitive systems (databases, management interfaces) from general-purpose networks.
In practical terms, subnetting means borrowing bits from the host portion of an IP address and reassigning them to the network portion. Each borrowed bit doubles the number of possible subnets while halving the number of hosts per subnet.
Fixed-Length vs VLSM
Fixed-Length Subnet Masking (FLSM)
In fixed-length subnetting, every subnet in the network uses the same prefix length. If you divide a /24 into four subnets, each one is a /26 with exactly 62 usable hosts.
This approach is simple and predictable, but it wastes addresses when subnets have very different sizes. A point-to-point link between two routers only needs 2 addresses, but under FLSM it would receive the same 62-address block as a busy office floor.
Variable-Length Subnet Masking (VLSM)
VLSM allows you to assign different prefix lengths to different subnets within the same network. This means you can carve out a /26 for a large department, a /28 for a small team, and a /30 for a router link — all from the same parent block.
VLSM is the standard approach in modern network design because it dramatically reduces waste. The trade-off is increased planning complexity: you must carefully track which address ranges have been allocated to avoid overlaps.
Subnetting Math
The core arithmetic behind subnetting follows a consistent pattern. When you increase the prefix length by 1 (e.g., from /24 to /25), you divide the block in half. Increase by 2 (e.g., /24 to /26) and you get four subnets, and so on.
Subnetting Cheat Sheet
| Parent | Subnet Prefix | Number of Subnets | Usable Hosts per Subnet | Subnet Mask |
|---|---|---|---|---|
/24 | /24 | 1 | 254 | 255.255.255.0 |
/24 | /25 | 2 | 126 | 255.255.255.128 |
/24 | /26 | 4 | 62 | 255.255.255.192 |
/24 | /27 | 8 | 30 | 255.255.255.224 |
/24 | /28 | 16 | 14 | 255.255.255.240 |
/24 | /29 | 32 | 6 | 255.255.255.248 |
/24 | /30 | 64 | 2 | 255.255.255.252 |
The formula is straightforward:
- Number of subnets = 2^(new_prefix - original_prefix)
- Hosts per subnet = 2^(32 - new_prefix) - 2
The “minus 2” accounts for the network address (all host bits = 0) and the broadcast address (all host bits = 1), which cannot be assigned to devices.
Step-by-Step Example
Divide 10.0.0.0/24 into 4 equal subnets:
- Determine the new prefix: 4 subnets = 2^2, so borrow 2 bits from the host portion. New prefix = 24 + 2 =
/26. - Calculate hosts per subnet: 2^(32-26) - 2 = 64 - 2 = 62 usable hosts.
- List the subnets:
- 10.0.0.0/26 (range: 10.0.0.1 - 10.0.0.62)
- 10.0.0.64/26 (range: 10.0.0.65 - 10.0.0.126)
- 10.0.0.128/26 (range: 10.0.0.129 - 10.0.0.190)
- 10.0.0.192/26 (range: 10.0.0.193 - 10.0.0.254)
Each subnet’s starting address is the previous subnet’s starting address plus the block size (64 in this case, since 2^(32-26) = 64).
Common Use Cases
- Enterprise network design: Segmenting a corporate network into subnets for departments (engineering, HR, finance), infrastructure (servers, printers), and guest access
- Cloud VPC design: AWS, Azure, and GCP all require subnet planning within a VPC, typically using VLSM to allocate different-sized subnets for public, private, and database tiers
- Data center fabric: Leaf-spine architectures use /31 or /30 subnets for point-to-point links between switches and larger subnets for server-facing networks
- IP address management (IPAM): Tools like NetBox, Infoblox, and phpIPAM use subnet hierarchies to track allocations and prevent overlapping assignments
- Network migration: When consolidating offices or migrating to a new address scheme, subnetting ensures the new design accommodates all segments without overlap
- Exam preparation: Subnetting is a core topic in networking certifications (CCNA, CompTIA Network+, JNCIA) and a frequent interview question for network engineering roles
Try These Examples
Dividing a /24 (256 addresses) into 4 equal subnets produces four /26 blocks, each with 62 usable hosts: 10.0.0.0/26, 10.0.0.64/26, 10.0.0.128/26, and 10.0.0.192/26.
10.0.0.0/24 A /30 only contains 4 addresses (2 usable). Splitting it into 4 subnets would require /32 blocks with zero usable host addresses, making this impractical for host assignment.
10.0.0.0/30