To scale the internet, a single massive network is broken down into smaller, manageable networks called subnets. IP Addresses and Subnet Masks work together to define exactly where a network begins and ends. Understanding subnetting is a mandatory foundational skill for any IT professional configuring Routing or VLANs.
The Network Portion and Host Portion
Every IP address is split into two parts:
- The Network Portion: Identifies the specific neighborhood or subnet (e.g., the Accounting Department VLAN).
- The Host Portion: Identifies the specific device within that neighborhood (e.g., Bob's Printer).
The Subnet Mask is what tells the computer exactly where the Network Portion ends and the Host Portion begins.
CIDR Notation (Prefix Length)
Instead of writing out a cumbersome mask like 255.255.255.0, engineers use CIDR (Classless Inter-Domain Routing) Notation, also known as the prefix length. It simply counts the number of binary "1" bits in the subnet mask.
A subnet mask of 255.255.255.0 has exactly 24 ones in binary, so it is written as /24.
The Anatomy of a Subnet
Every IPv4 subnet contains three critical components:
- Network Address: The very first address in the block. It represents the subnet itself and cannot be assigned to a PC.
- Usable Host Range: The addresses in the middle. These are assigned to PCs, servers, and the Default Gateway.
- Broadcast Address: The very last address in the block. It is used to send a message to every device in the subnet simultaneously and cannot be assigned to a PC.
(Total Addresses) - 2. (Note: Point-to-point /31 links are a special routing exception where both addresses are usable).
Common IPv4 Subnet Sizes
| Prefix (CIDR) | Subnet Mask | Total Addresses (Block Size) | Typical 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 (Router Links) |
Practical Subnet Boundaries
Example 1: The Standard /24
You are given the network 192.0.2.0/24.
- Network Address: 192.0.2.0
- Usable Hosts: 192.0.2.1 through 192.0.2.254
- Broadcast Address: 192.0.2.255
Example 2: Splitting into smaller blocks (/26)
You need to put the servers in a smaller subnet. You are given 192.0.2.0/26. Looking at the table above, a /26 has a block size of 64 addresses. Therefore, the boundaries jump by 64.
- Network Address: 192.0.2.0
- Usable Hosts: 192.0.2.1 through 192.0.2.62
- Broadcast Address: 192.0.2.63
The very next subnet would begin at 192.0.2.64.
The Routing Requirement
Why does this matter? Because devices inside the same subnet can talk directly to each other via a local switch. Devices in different subnets require a router to communicate.
- Same Subnet:
192.0.2.10/24wants to talk to192.0.2.50/24. The PC sees they are in the same network, finds the destination MAC address, and sends the packet directly over the LAN. - Different Subnet:
192.0.2.10/24wants to talk to198.51.100.10/24. The PC sees the destination is outside its subnet mask boundary. It immediately forwards the packet to its Default Gateway (the router), asking the router to deliver it.