Borrowing bits
Subnetting splits one big network into smaller ones by moving the mask to the right. Every bit you "borrow" from the host part doubles the number of subnets and halves the hosts in each.
| From 192.168.5.0/24 | Subnets | Usable hosts each |
|---|---|---|
| /25 (borrow 1) | 2 | 126 |
| /26 (borrow 2) | 4 | 62 |
| /27 (borrow 3) | 8 | 30 |
| /28 (borrow 4) | 16 | 14 |
Remember: Subnets = 2borrowed bits. Hosts per subnet = 2host bits − 2.
Example: 6 departments, up to 25 PCs each
We need at least 6 subnets → borrow 3 bits (23 = 8). That leaves 5 host bits: 30 hosts, enough for 25. So use /27. The subnets are 192.168.5.0, .32, .64, .96, .128, .160, .192, .224.
VLSM: different sizes for different needs
Real networks don't need equal subnets. With variable-length subnet masks (VLSM) you give each subnet only what it needs. Always allocate the biggest first, so the smaller ones fit into the gaps without overlapping.
| Need | Size chosen | Subnet from 10.1.1.0/24 |
|---|---|---|
| Sales: 100 hosts | /25 (126) | 10.1.1.0/25 |
| Support: 50 hosts | /26 (62) | 10.1.1.128/26 |
| Lab: 20 hosts | /27 (30) | 10.1.1.192/27 |
| Router link A | /30 (2) | 10.1.1.224/30 |
| Router link B | /30 (2) | 10.1.1.228/30 |
Point-to-point links: /30 and /31
A link between two routers only needs two addresses, so a /30 is the classic choice. A /31 is even tighter: it has no network or broadcast address, both addresses are usable, and routers accept it on point-to-point links.