2.6.2. Subnetting Process
💡 First Principle: Subnetting is about borrowing bits from the host portion to create additional networks. More borrowed bits = more subnets but fewer hosts per subnet. The core formula: 2^(borrowed bits) = subnets; 2^(remaining host bits) − 2 = usable hosts.
The step-by-step method (memorize this):
Example: Subnet 192.168.1.0/24 into 4 equal subnets
- How many bits to borrow? 2^2 = 4 subnets, so borrow 2 bits
- New prefix: /24 + 2 = /26
- New subnet mask: 255.255.255.192 (192 = 128+64, the two borrowed bits)
- Block size: 256 − 192 = 64 (increment between subnets)
- Subnets:
- 192.168.1.0/26 (hosts: .1−.62, broadcast: .63)
- 192.168.1.64/26 (hosts: .65−.126, broadcast: .127)
- 192.168.1.128/26 (hosts: .129−.190, broadcast: .191)
- 192.168.1.192/26 (hosts: .193−.254, broadcast: .255)
Quick reference for common prefix lengths:
| Prefix | Mask | Hosts | Block Size |
|---|---|---|---|
| /24 | 255.255.255.0 | 254 | — |
| /25 | 255.255.255.128 | 126 | 128 |
| /26 | 255.255.255.192 | 62 | 64 |
| /27 | 255.255.255.224 | 30 | 32 |
| /28 | 255.255.255.240 | 14 | 16 |
| /29 | 255.255.255.248 | 6 | 8 |
| /30 | 255.255.255.252 | 2 | 4 |
Wildcard masks are the inverse of subnet masks—used in OSPF network commands and ACLs. To calculate: 255.255.255.255 minus the subnet mask. Example: /26 mask 255.255.255.192 → wildcard 0.0.0.63.
VLSM (Variable Length Subnet Masking) lets you use different prefix lengths within the same network. Without VLSM, a point-to-point link (needing 2 hosts) would waste an entire /24 (254 addresses). With VLSM, you assign /30 for WAN links (2 hosts) and /24 for user LANs—efficient allocation matching actual need. Allocate from the largest requirement to the smallest, so each block starts on its own boundary and no two blocks overlap.
Subnetting in the third octet (/17–/23): the same method applies one octet to the left. The mask values are the fourth-octet ones moved eight bits left (/21 = 255.255.248.0, just as /29 = 255.255.255.248), the block size is 256 minus the mask value in the third octet, the subnet starts at the multiple of the block size at or below the address's third octet, and the fourth octet runs from .0 to .255. Example: 10.1.77.9/22 → mask 255.255.252.0, block size 4, network 10.1.76.0, broadcast 10.1.79.255, hosts 10.1.76.1–10.1.79.254.
Route summarization (supernetting) is the reverse: combine contiguous networks into one shorter prefix that keeps only their common leading bits. Four contiguous /24s starting on a multiple of 4—10.8.4.0 to 10.8.7.0—summarize to 10.8.4.0/22; eight would give a /21.
Configuration Example
Router(config)# interface GigabitEthernet0/0
Router(config-if)# ip address 192.168.1.1 255.255.255.0
Router(config-if)# no shutdown
Verification:
Router# show ip interface brief
Interface IP-Address OK? Method Status Protocol
GigabitEthernet0/0 192.168.1.1 YES manual up up
⚠️ Exam Trap: The first address in a subnet is the network address and the last is the broadcast address—neither is usable for hosts. Usable hosts = 2^n − 2. Exception: /31 networks (RFC 3021) support exactly 2 hosts with no network or broadcast address—used exclusively on point-to-point links to save address space.