Subnetting
Networking Fundamentals
Chapter 5 · Subnetting
net1-4 closed on an unanswered question: given an address like 192.168.1.42, where does the "network" part end and the "host" part begin? This chapter answers it in full, with real math and real worked examples.
The Subnet Mask — Splitting an Address Into Network and Host
A subnet mask is a 32-bit value, written the same way an IP address is, that marks which bits of an address are "network" bits (1s) versus "host" bits (0s). 255.255.255.0 in binary is 11111111.11111111.11111111.00000000 — the first 24 bits are network, the last 8 are host.
Applied to 192.168.1.42 with mask 255.255.255.0: the network portion is 192.168.1.0, and the remaining bits identify device 42 specifically on that network.
CIDR Notation — A Shorthand for the Mask
CIDR (Classless Inter-Domain Routing) notation writes the mask as a slash followed by the number of network bits: 192.168.1.0/24 means the first 24 bits are network bits — exactly equivalent to a mask of 255.255.255.0.
The "classless" part of the name is a real historical improvement worth naming honestly: CIDR replaced an older, rigid Class A/B/C system that only allowed fixed boundaries (/8, /16, /24 and nothing in between) with flexible, arbitrary prefix lengths — letting networks be sized to what's actually needed instead of forced into one of three fixed sizes.
Calculating Usable Host Ranges
For a /n prefix: host bits = 32 − n, total addresses = 2^(32−n), usable hosts = 2^(32−n) − 2 — subtracting the network address and the broadcast address, neither of which can be assigned to a device.
Why Subnetting Matters in Practice
Beyond the arithmetic, real reasons to subnet: organizing a network into logical, isolated segments (separate subnets for servers, employee workstations, and guest Wi-Fi), containing broadcast traffic (broadcasts only travel within a subnet, never across the whole network), and creating real access-control boundaries (a firewall or router can apply different rules per subnet). This is exactly the concept cloud1-5's own VPC/subnet material assumed as background — this chapter is the foundational math that material was quietly built on.
A Worked Example — Splitting a /24 Into Four Subnets
Given 192.168.1.0/24, split it evenly into 4 subnets for 4 departments. Borrowing 2 more bits from the host portion (24 → 26) produces exactly 4 subnets of /26 each, 64 addresses per subnet (62 usable):
| CIDR | Mask | Total addresses | Usable hosts |
|---|---|---|---|
| /24 | 255.255.255.0 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 62 |
| /27 | 255.255.255.224 | 32 | 30 |
| /28 | 255.255.255.240 | 16 | 14 |
| /30 | 255.255.255.252 | 4 | 2 |
/31 is commonly used for point-to-point links with no network/broadcast subtraction at all (RFC 3021, both addresses usable), and /32 identifies a single specific host — a "network" of exactly one address.
192.168.1.0 or 192.168.1.255 directly to a device on a /24 network. Both are reserved — the network address identifies the subnet itself, and the broadcast address is used to reach every device on the subnet at once. Assigning either to a single device breaks things in ways that can be genuinely confusing to diagnose later.
Hands-On Exercises
For the network 10.0.5.0/27, calculate: total addresses, usable host range, the network address, and the broadcast address.
📄 View solutionA team needs to split 172.16.0.0/24 into 8 equal-sized subnets. Using this chapter's own bit-borrowing method, determine the new CIDR prefix and list all 8 resulting subnet addresses.
📄 View solutionAn administrator manually assigns the IP address 192.168.10.255 to a new server on a 192.168.10.0/24 network, and the server immediately has connectivity problems. Using this chapter's own warn-box, explain what went wrong.
📄 View solutionChapter 5 Quick Reference
- Subnet mask: marks network bits (1) vs. host bits (0), 32 bits total, same notation as an IP address
- CIDR:
/nshorthand for a mask with n network bits — e.g. /24 = 255.255.255.0 - Total addresses = 2^(32−n); usable hosts = 2^(32−n) − 2
- The network address (all host bits 0) and broadcast address (all host bits 1) are never assignable
- Splitting a network into equal subnets = borrowing bits from the host portion
- /31 (point-to-point) and /32 (single host) are genuine edge cases to the usual −2 rule
- Subnetting creates real broadcast-containment and access-control boundaries — cloud1-5's own VPC/subnet material assumed this math