Subnetting Basics
Subnetting is the practice of dividing one large network into smaller, manageable ones. Back in Level 1 we said an address has "a network part and a host part" — subnetting is the art of moving that boundary on purpose.
01Why subnet?
- Efficiency — IP addresses are handed out to match need, not wasted
- Security — segments are isolated from each other (accounting ↔ guest Wi-Fi)
- Performance — broadcast traffic stays inside small areas
- Management — which range belongs to which department is obvious at a glance
02IP address structure
An IPv4 address is 32 bits:
code
192.168.1.100
↓
11000000.10101000.00000001.01100100
Network and host parts
code
[ Network part ][ Host part ]
192 . 168 . 1 . 100
"which network?" "which device on it?"
03The subnet mask
The subnet mask says where the boundary is: 1s mark the network part, 0s mark the host part.
| Subnet mask | CIDR | Network bits | Host bits |
|---|---|---|---|
| 255.0.0.0 | /8 | 8 | 24 |
| 255.255.0.0 | /16 | 16 | 16 |
| 255.255.255.0 | /24 | 24 | 8 |
| 255.255.255.128 | /25 | 25 | 7 |
| 255.255.255.192 | /26 | 26 | 6 |
04CIDR notation
code
192.168.1.0/24
↓
first 24 bits: network
remaining 8 bits: host
The /24 example
code
Mask: 255.255.255.0
Binary: 11111111.11111111.11111111.00000000
←──── 24 bits ────→←─ 8 bits ─→
Network Host
05Counting hosts
Formula: 2ⁿ − 2 = usable hosts (n = number of host bits)
| CIDR | Host bits | Total addresses | Usable |
|---|---|---|---|
| /24 | 8 | 256 | 254 |
| /25 | 7 | 128 | 126 |
| /26 | 6 | 64 | 62 |
| /27 | 5 | 32 | 30 |
| /28 | 4 | 16 | 14 |
| /29 | 3 | 8 | 6 |
| /30 | 2 | 4 | 2 |
06The special addresses
code
192.168.1.0/24
Network address: 192.168.1.0 (unusable)
First host: 192.168.1.1
Last host: 192.168.1.254
Broadcast: 192.168.1.255 (unusable)
07Example: splitting into four with /26
Let's divide 192.168.1.0/24 into four subnets:
| Subnet | Network | Host range | Broadcast |
|---|---|---|---|
| 1 | 192.168.1.0 | .1 – .62 | 192.168.1.63 |
| 2 | 192.168.1.64 | .65 – .126 | 192.168.1.127 |
| 3 | 192.168.1.128 | .129 – .190 | 192.168.1.191 |
| 4 | 192.168.1.192 | .193 – .254 | 192.168.1.255 |
08Summary
- Subnetting = slicing a network into logical parts
- The subnet mask draws the network/host line; CIDR writes it as /24
- Usable hosts = 2ⁿ − 2 (network + broadcast are reserved)
- Next lesson: the practical method for doing these sums by hand