Subnetting is the practice of dividing a network into smaller segments. Understanding subnets and CIDR notation is essential for anyone managing IP addresses.
What is a Subnet?
A subnet (subnetwork) is a logical subdivision of an IP network. Subnetting allows network administrators to divide a large network into smaller, more manageable segments.
Think of it like dividing a large building into floors and departments. Each subnet operates as an independent network segment while remaining part of the larger network.
Real-World Analogy
A /24 network is like an apartment building with 256 units. You can subdivide it into two /25 buildings (128 units each) or four /26 buildings (64 units each).
CIDR Notation
CIDR (Classless Inter-Domain Routing) notation is the standard way to express subnet sizes. It uses a slash followed by a number indicating how many bits are used for the network portion.
192.168.1.0
24
The larger the prefix number, the smaller the subnet. A /24 has 256 addresses, while a /16 has 65,536 addresses.
Subnet Masks
A subnet mask determines which portion of an IP address identifies the network and which identifies the host.
| CIDR | Subnet Mask | Usable Hosts |
|---|---|---|
| /24 | 255.255.255.0 | 254 |
| /23 | 255.255.254.0 | 510 |
| /22 | 255.255.252.0 | 1,022 |
| /21 | 255.255.248.0 | 2,046 |
| /16 | 255.255.0.0 | 65,534 |
Note: 2 addresses per subnet are reserved (network address and broadcast address)
Calculating Subnet Sizes
The number of addresses in a subnet is calculated as 2^(32-prefix). For usable hosts, subtract 2 (network and broadcast addresses).
Formula: 2^(32 - prefix) = Total IPs
Why Subnetting Matters
Understanding subnets is essential for IP address management, especially when leasing or purchasing IP blocks.
- Efficient Allocation: Lease exactly the number of IPs you need without waste
- Network Organization: Segment networks for security and management
- Routing Efficiency: Simplify routing tables with aggregated prefixes
- Cost Optimization: Right-size your IP allocation to match actual needs