UNDERSTANDING IPv4 CIDR SUBNETTING & BITWISE MASKS
TACTICAL NETWORKING SPECIFICATION // RFC 4632 & RFC 1918 ARCHITECTURE
What is CIDR Notation?
Classless Inter-Domain Routing (CIDR) replaced the rigid classful network system (Class A, B, and C) in 1993. In CIDR notation, an IPv4 address is paired with a forward slash followed by the prefix length (e.g., /24), indicating how many of the 32 bits represent the network prefix, leaving the remaining bits to identify specific host machines.
Every bit shifted from the host portion to the network portion doubles the number of available subnets while halving the number of hosts per subnet.
Subnet Mask vs. Wildcard Mask
A Subnet Mask features consecutive contiguous ones (1s) from left to right representing the network portion, followed by contiguous zeros (0s) for the host portion. For example, a /24 prefix produces 255.255.255.0.
A Wildcard Mask (used in Cisco IOS Access Control Lists and OSPF network statements) is the bitwise inverse of the subnet mask (255.255.255.255 - Subnet Mask). For a /24 network, the wildcard mask is 0.0.0.255.
RFC 1918 Private Address Blocks
The Internet Assigned Numbers Authority (IANA) reserved three blocks of IPv4 space for private enterprise and local area networks that are never routed on the public internet:
Edge Case Handling: /31 & /32 Subnets
/30 subnet (wasting 2 out of 4 addresses on network ID and broadcast). RFC 3021 permits /31 subnets for point-to-point interfaces where both addresses are directly assignable to hosts with no broadcast address needed.
/32 subnet represents a single specific endpoint (host route or loopback interface). It has zero host bits, no broadcast address, and exactly one usable address.