TCP/IP Subnet Table

index

PrefixSubnet MaskNumber of HostsNetworks (Class B) * Networks (Class C) * Inverse Mask +Notes
/16255.255.0.0655341 0.0.255.255Class B
/17255.255.128.0327660+1 0.0.127.255In Class A networks, CIDR, or subnet-zero enabled networks only
/18255.255.192.0163822+1 0.0.63.255 
/19255.255.224.081906+1 0.0.31.255 
/20255.255.240.0409014+1 0.0.15.255 
/21255.255.248.0204630+1 0.0.7.255 
/22255.255.252.0102262+1 0.0.3.255 
/23255.255.254.0510126+1 0.0.1.255 
/24255.255.255.0254254+110.0.0.255Class C
/25255.255.255.128126510+10+10.0.0.127in class B or larger networks, CIDR, or subnet-zero enabled networks only
/26255.255.255.192621022+12+10.0.0.63 
/27255.255.255.224302046+16+10.0.0.31 
/28255.255.255.240144090+114+10.0.0.15 
/29255.255.255.24868190+130+10.0.0.7 
/30255.255.255.252216382+162+10.0.0.3 
/31255.255.255.2540   Invalid mask since it leaves no host bits
/32255.255.255.2551  0.0.0.0Special 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.