Subnetting looks like a trick you either know or do not. In practice it is three small calculations: how many bits to borrow, how big each block is, and where each block starts. This article works through one complete example, splitting 192.168.1.0/24 into eight subnets, then shows the same method for an uneven requirement and lists the mistakes that cost the most time. Every number can be checked in the IP subnet calculator.
What /24 means
An IPv4 address is 32 bits. The prefix length says how many of the leading bits identify the network; the remaining bits number the hosts inside it. In 192.168.1.0/24, the first 24 bits (192.168.1) are fixed and the last 8 are free, so the block holds 2^8 = 256 addresses: 192.168.1.0 to 192.168.1.255.
Two of those addresses have a job. The first, 192.168.1.0, is the network address; the last, 192.168.1.255, is the broadcast address. That leaves 254 for hosts. The subnet mask is just the prefix written as an address: 24 ones followed by 8 zeros, 255.255.255.0.
Step 1: borrow bits
We need 8 subnets. Each bit taken from the host part doubles the number of subnets: 1 bit gives 2, 2 bits give 4, 3 bits give 8. So we borrow 3 bits and the new prefix is 24 + 3 = /27.
The rule in one line: borrow the smallest number of bits b such that 2^b is at least the number of subnets you need.
Step 2: block size
A /27 leaves 32 − 27 = 5 host bits, so each subnet has 2^5 = 32 addresses and 32 − 2 = 30 usable hosts.
The mask for /27 is 255.255.255.224. A quick way to get the interesting octet without binary: 256 − block size = 256 − 32 = 224. The wildcard mask is the inverse, 0.0.0.31.
Step 3: list the subnets
Subnets start at multiples of the block size in the octet being split: 0, 32, 64, 96, 128, 160, 192, 224. For each one, the broadcast is the next start minus one, and the hosts sit in between:
| # | Subnet | Hosts | Broadcast |
|---|---|---|---|
| 1 | 192.168.1.0/27 | .1 – .30 | .31 |
| 2 | 192.168.1.32/27 | .33 – .62 | .63 |
| 3 | 192.168.1.64/27 | .65 – .94 | .95 |
| 4 | 192.168.1.96/27 | .97 – .126 | .127 |
| 5 | 192.168.1.128/27 | .129 – .158 | .159 |
| 6 | 192.168.1.160/27 | .161 – .190 | .191 |
| 7 | 192.168.1.192/27 | .193 – .222 | .223 |
| 8 | 192.168.1.224/27 | .225 – .254 | .255 |
Check: 8 subnets × 32 addresses = 256, the whole /24, with no gaps and no overlap. Eight networks of 30 hosts each give 240 usable addresses instead of 254; the other 14 are the extra network and broadcast addresses that splitting always costs.
Finding the subnet of a given address
Which subnet does 192.168.1.77 belong to? Divide the last octet by the block size and keep the whole part: 77 ÷ 32 = 2 remainder 13. The subnet starts at 2 × 32 = 64, so the address is in 192.168.1.64/27 (hosts .65 to .94, broadcast .95). In binary the same thing is a bitwise AND with the mask: 77 is 01001101, the mask octet 224 is 11100000, and the AND is 01000000 = 64. The number base converter shows the binary if you want to follow it bit by bit.
Uneven requirements: VLSM
Real networks rarely need equal subnets. Suppose one office LAN needs 100 hosts, a second needs 50, and two router links need 2 each, all from 192.168.1.0/24. Allocate the largest first, each on its own boundary:
- 100 hosts need 7 host bits (2^7 = 128, 126 usable): 192.168.1.0/25, hosts .1–.126.
- 50 hosts need 6 bits (64, 62 usable): 192.168.1.128/26, hosts .129–.190.
- Each link needs 2 hosts: a /30 has 4 addresses and 2 usable, so 192.168.1.192/30 and 192.168.1.196/30. Many routers also accept a /31 for a point-to-point link (RFC 3021), which uses only 2 addresses.
What is left, 192.168.1.200 to .255, stays free for later. Going largest first matters: if the small blocks came first, they would fragment the space and the /25 might no longer fit on a /25 boundary.
Common mistakes
- Counting the network and broadcast as hosts. A /27 has 32 addresses but only 30 hosts. The exception is /31 and /32.
- Starting a subnet off its boundary. 192.168.1.40/27 is not a subnet start; the /27 that contains .40 starts at .32. Many devices silently correct this, others reject it.
- Merging blocks that are not aligned. 192.168.1.32/27 and .64/27 are adjacent but cannot form a /26, because a /26 must start at a multiple of 64. Only .0 + .32 or .64 + .96 merge.
- Overlapping a VPN or cloud range. 10.0.0.0/8 and 192.168.0.0/24 are popular defaults, so two sites often clash. Pick something less common inside 10.0.0.0/8 or 172.16.0.0/12.
- Using 100.64.0.0/10 as if it were private. It is shared address space for carrier-grade NAT (RFC 6598); your internet provider may already use it.
Try it
Type 192.168.1.0/24 in the split tab of the IP subnet calculator, ask for 8 subnets, and compare the table above. Then paste a few blocks into the aggregate tab to see which ones really merge.