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.
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.