Understanding IPv4 Subnetting
IPv4 Address Structure (32 bits)
IPv4 subnetting is the process of dividing a network into smaller subnetworks (subnets). It uses Classless Inter-Domain Routing (CIDR) notation, defined in RFC 4632, which appends a prefix length to the IP address (e.g., 192.168.1.0/24). The prefix length indicates how many bits are reserved for the network portion.
CIDR Prefix Length Cheatsheet
| CIDR | Subnet Mask | Hosts | Use Case |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,214 | Class A (large ISP) |
| /16 | 255.255.0.0 | 65,534 | Class B (campus) |
| /24 | 255.255.255.0 | 254 | Class C (small office) |
| /25 | 255.255.255.128 | 126 | Half /24 |
| /26 | 255.255.255.192 | 62 | Quarter /24 |
| /28 | 255.255.255.240 | 14 | Small VLAN |
| /30 | 255.255.255.252 | 2 | Point-to-point link |
| /32 | 255.255.255.255 | 1 (host) | Single host route |
RFC 1918 Private Address Ranges
RFC 1918 defines three blocks of private IPv4 address space that are not routed on the public internet:
10.0.0.0/8โ 16.7 million addresses (large enterprises)172.16.0.0/12โ 1 million addresses (medium networks)192.168.0.0/16โ 65,536 addresses (home/small office)
How Subnet Calculation Works
Given an IP address and prefix length, the subnet calculator performs bitwise AND operations to derive the network address. The broadcast address is computed by ORing the network address with the inverted netmask (wildcard mask). The number of usable hosts is 2^(32-prefix) - 2, subtracting the network and broadcast addresses.