TCP/IP Subnet Table


PrefixSubnet MaskNumber of HostsNetworks (Class B) * Networks (Class C) * Inverse Mask +Notes
/16255.255.0.0655341 B
/17255.255.128.0327660+1 Class A networks, CIDR, or subnet-zero enabled networks only
/24255.255.255.0254254+ C
/25255.255.255.128126510+10+ class B or larger networks, CIDR, or subnet-zero enabled networks only
/31255.255.255.2540   Invalid mask since it leaves no host bits
/32255.255.255.2551 single host mask

* Generally, host bits, subnet bits, and network bits cannot consist of all ones or all zeroes without conveying special meaning to the address (network address, broadcast address, etc). This means that in classful addressing, the first and last subnets within a network are unusable, since all subnet bits would be zeroes or ones. However, on most newer routing and other networking equipment, you can specify that it use subnet zero (the command on a cisco is ip subnet-zero). In this case you get one extra subnet per classful network, with the slight drawback that the network address of the network becomes the network address of the first subnet instead. The +1 after each number indicates the extra subnet which can be reclaimed in this way.

+ The inverse mask is primarily used in Cisco access control lists (ACLs). The rationale behind an inverse mask is that logical ANDing an inverse mask and an IP address gives the host portion of the address instead of the network/subnet portion (as a standard subnet mask would), which is of more interest to certain TCP/IP functions. To calculate an inverse mask given a subnet mask, simply subtract each octet value from 255.