Computer Networks · Module 5 — Network Layer
Subnetting, worked step by step
Splitting one network into smaller ones buys three things.
Sign in to track your score
The hostel has one network, 192.168.1.0/24, and four floors. The warden wants each floor kept separate. You have 254 addresses and a calculator.
Why & what
Why we subnet. Splitting one network into smaller ones buys three things.
- Less broadcast noise. Broadcasts (like ARP) reach every device on a network. On 254 devices, that is constant chatter. On 62, far less.
- Control. You can allow floor 3 to reach the printer and stop floor 4 from doing so, because they are now different networks.
- Less waste. A link between two routers needs exactly 2 addresses. Giving it 254 wastes 252.
What subnetting is. Subnetting means borrowing bits from the host part and using them to create more networks.
Every bit you borrow doubles the number of subnets and halves the size of each one.
| Bits borrowed | Subnets | New prefix (from /24) |
|---|---|---|
| 1 | 2 | /25 |
| 2 | 4 | /26 |
| 3 | 8 | /27 |
| 4 | 16 | /28 |
Block size is the shortcut that makes this fast: 256 − (last octet of the mask). It tells you how far apart the subnets sit.
How it works
The full method. Four floors from 192.168.1.0/24.
- How many subnets? 4. Find the power of 2 that reaches it: 2² = 4. So borrow 2 bits.
- New prefix. 24 + 2 = /26. Mask is 255.255.255.192.
- Block size. 256 − 192 = 64. Subnets start every 64 addresses: 0, 64, 128, 192.
- Write each subnet. Network address, then usable range, then broadcast (one below the next network).
- Check. 4 subnets × 62 usable = 248 usable, plus 8 lost to reserved addresses. That accounts for all 256.
| # Network | Usable | range Broadcast |
|---|---|---|
| 1 192.168.1.0/26 | .1 – .62 | 192.168.1.63 |
| 2 192.168.1.64/26 | .65 – .126 | 192.168.1.127 |
| 3 192.168.1.128/26 | .129 – .190 | 192.168.1.191 |
| 4 192.168.1.192/26 | .193 – .254 | 192.168.1.255 |
Aisha, on 192.168.1.42, lands in subnet 1.
The reverse problem, which interviews prefer. Which subnet does 1S2.1c8.1.130/2c belong to?
- Block size is 64, as before.
- Count up in 64s until you pass the host number: 0, 64, 128, 192.
- 130 sits between 128 and 191.
- So the network is 192.168.1.128, the broadcast is 192.168.1.191, and the usable range is .129 to .190.
- 192.168.1.130 is the first usable address in that subnet.
You never need binary for this. Counting in block-size steps is faster and harder to get wrong under pressure.
When subnets need different sizes. Four equal floors is the easy case. Real networks are lumpier: floor 3 has 100 devices, the server room has 6, and a router-to-router link needs exactly 2.
Giving all of them /26 wastes most of the addresses. VLSM (Variable Length Subnet Masking) means using a different prefix for each subnet: a /25 for floor 3, a /29 for the server room, a /30 for the link. The rule is to allocate the largest subnet first and work downwards, so the blocks fit together without overlapping.

Common confusion
Students think you can pick any subnet size you like, such as splitting 254 addresses into 5 equal groups of 50. Actually, subnets only come in powers of two.
Borrowing bits doubles the count each time. There is no way to get exactly 5 subnets: you borrow 3 bits, get 8 subnets of 30, and leave 3 unused. Always round up to the next power of two. Needing 5 subnets means planning for 8. Needing 100 hosts means a /25 with 126, not a /26 with 62.
Interview angle
Asked as: "Divide 192.168.1.0/24 into 4 subnets": often on paper, with the interviewer watching you work. Say the steps out loud as you go.
Model answer:
I need 4 subnets, so I borrow 2 bits because 2 squared is 4. That takes the prefix from /24 to /26, mask 255.255.255.192. Block size is 256 minus 192, which is 64. So subnets start at 0, 64, 128 and 192. The first is 192.168.1.0/26, usable .1 to .62, broadcast .63. Then .64/26, usable .65 to .126, broadcast .127. Then .128/26 and .192/26 the same way. Each has 62 usable hosts: 64 addresses minus the network and broadcast address.
- 1.
To create 8 subnets, how many bits must you borrow?
- 2.
For a /26, what is the block size?
- 3.
Which address is the broadcast address of 192.168.1.64/26?
- 4.
A floor needs 100 hosts. Which prefix fits with the least waste?