Subnet Mask Fundamentals
A subnet mask tells a device which part of an IP address is the network portion and which is the host portion. Written as dotted decimal (255.255.255.0) or CIDR notation (/24). The mask's 1 bits identify the network portion; 0 bits identify the host portion. The CIDR number equals the count of consecutive 1 bits from left.
Common masks to memorize: /8 = 255.0.0.0 (Class A default), /16 = 255.255.0.0 (Class B default), /24 = 255.255.255.0 (Class C default). For subnetting: /25 = 255.255.255.128 (128 addresses, 126 hosts), /26 = 255.255.255.192 (64 addresses, 62 hosts), /27 = 255.255.255.224 (32 addresses, 30 hosts), /28 = 255.255.255.240 (16 addresses, 14 hosts), /29 = 255.255.255.248 (8 addresses, 6 hosts), /30 = 255.255.255.252 (4 addresses, 2 hosts — point-to-point links).
Calculating Subnet Information
Given an IP and CIDR (e.g., 192.168.10.65/26), determine: Block size = 256 − subnet mask last octet. For /26, mask = 255.255.255.192, block size = 256−192 = 64. Network addresses are multiples of the block size: 0, 64, 128, 192. The host 65 falls in the 64 block. Network address: 192.168.10.64. Broadcast: 192.168.10.127 (next block − 1). Usable hosts: 192.168.10.65 to 192.168.10.126 (126 hosts).
Number of subnets from a base network: 2^(borrowed bits). Number of usable hosts per subnet: 2^(host bits) − 2 (subtract network and broadcast addresses). The −2 is always required for standard unicast subnets.
VLSM (Variable Length Subnet Masking) allows different subnets within the same major network to use different mask lengths — larger subnets for large segments, /30 for point-to-point WAN links, /32 for loopback interfaces. VLSM maximizes address efficiency.
Private IP Address Ranges
RFC 1918 defines three private address ranges not routed on the public internet: 10.0.0.0/8 (Class A — 16.7M addresses), 172.16.0.0/12 (Class B — 172.16.0.0 to 172.31.255.255, ~1M addresses), 192.168.0.0/16 (Class C — 65,536 addresses). Devices using private IPs access the internet via NAT.
Special addresses: 127.0.0.1 = loopback (localhost). 169.254.0.0/16 = APIPA (Automatic Private IP Addressing) — assigned when DHCP fails. 0.0.0.0 = this network/any address. 255.255.255.255 = limited broadcast. Class D: 224.0.0.0–239.255.255.255 = multicast. Class E: 240.0.0.0–255.255.255.254 = reserved/experimental.