Effects of Subnetting A Class B Network

Subnet Mask CIDR Net Bits Host Bits # of Nets Hosts/Net Total Hosts
255.255.0.0 /16 0 16 1 65534 65534
255.255.128.0 /17 1 15 0(2*) 32766 0(65534*)
255.255.192.0 /18 2 14 2(4*) 16382 32764(65528*)
255.255.224.0 /19 3 13 6(8*) 8190 49140(65520*)
255.255.240.0 /20 4 12 14(16*) 4094 57316(65504*)
255.255.248.0 /21 5 11 30(32*) 2046 61380(65472*)
255.255.252.0 /22 6 10 62(64*) 1022 63364(65408*)
255.255.254.0 /23 7 9 126(128*) 510 64260(65280*)
255.255.255.0 /24 8 8 254(256*) 254 64516(65024*)
255.255.255.128 /25 9 7 510(512*) 126 64260(64512*)
255.255.255.192 /26 10 6 1022(1024*) 62 63364(63488*)
255.255.255.224 /27 11 5 2046(2048*) 30 61380(61440*)
255.255.255.240 /28 12 4 4094(4096*) 14 57316(57344*)
255.255.255.248 /29 13 3 8190(8192*) 6 49140(49152*)
255.255.255.252 /30 14 2 16382(16384*) 2 32764(32768*)
255.255.255.254 /31 15 1 32766(32768*) 0* 0(32768**)
255.255.255.255 /32 16 0 65534(65536*) 1*** 65534(65536*)

[*] According to classic IP routing rules you are not able to use the subnets with all zeros or ones in the network portion. However most modern machines have no trouble actually using the upper and lower subnets. Steven C. Jensen has a very good discussion of lower/upper subnet use , including notes on how to convince Cisco routers to do it. (I’m not sure this applies for /32 though….)

[**] Note that you should not use a host address with all zeros as that means this host in many IP implementations (and is considered the broadcast address in some antiquated systems [SunOS-2?]), and neither can you use a host address with all ones, as that’s the broadcast address for the subnet. The host address of all zeros, in combination with the network address, are also used to specify the complete subnet address (RFC 1105).

This means that a 31-bit netmask is essentially useless since it leaves only two addresses per net: one for the network number, and the other for the broadcast address. In theory though you could specify a host address as the same as the network address if the IP implementation of the host(s) in question does not map an all-zeros host number to be equivalent to the localhost. I wouldn’t advise this though unless you’re really strapped for subnets. It’s far safer and more general to use /30 nets instead.

[***] An all-one’s netmask (i.e. all 32 bits) specifies a host address.

Example:

Valid subnets on a network 172.16.0.0/18 (i.e. with a subnet mask of 255.255.192.0) are:
Subnet 1: 172.16.64.0 with addresses 172.16.64.1 -> 172.16.100.254
Subnet 2: 197.16.128.0 with addresses 172.16.128.1 -> 172.16.128.254

Leave a Reply