General IT Knowledge Base
 Search  


collapse all | expand all
TCP/IP Subnet Table
Solution No. 5


TCP/IP Subnet Table

Prefix Subnet Mask Number of Hosts Networks (Class B) * Networks (Class C) * Inverse Mask + Notes
/16 255.255.0.0 65534 1   0.0.255.255 Class B
/17 255.255.128.0 32766 0+1   0.0.127.255 In Class A networks, CIDR, or subnet-zero enabled networks only
/18 255.255.192.0 16382 2+1   0.0.63.255  
/19 255.255.224.0 8190 6+1   0.0.31.255  
/20 255.255.240.0 4090 14+1   0.0.15.255  
/21 255.255.248.0 2046 30+1   0.0.7.255  
/22 255.255.252.0 1022 62+1   0.0.3.255  
/23 255.255.254.0 510 126+1   0.0.1.255  
/24 255.255.255.0 254 254+1 1 0.0.0.255 Class C
/25 255.255.255.128 126 510+1 0+1 0.0.0.127 in class B or larger networks, CIDR, or subnet-zero enabled networks only
/26 255.255.255.192 62 1022+1 2+1 0.0.0.63  
/27 255.255.255.224 30 2046+1 6+1 0.0.0.31  
/28 255.255.255.240 14 4090+1 14+1 0.0.0.15  
/29 255.255.255.248 6 8190+1 30+1 0.0.0.7  
/30 255.255.255.252 2 16382+1 62+1 0.0.0.3  
/31 255.255.255.254 0       Invalid mask since it leaves no host bits
/32 255.255.255.255 1     0.0.0.0 Special 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.