How to find how many hosts are on subnet mask: 255.255.255.252?

Your question "how many hosts" is actually simple to answer.
You have 11111111.11111111.11111111.11111100(B) as the subnet mask, which leaves two bits for the host address, 2^2 is 4, so 4 possible addresses. Since you can't use all zeros (network id) and you can't use all 1s (broadcast message) you have (bits^2) - 2 => (2^2) - 2 => 2 usable addresses. This may or may not be cut down by your router, which would be one usable address for your computer. My guess is you're stuck with this because of this is how your ISP does things.

Part of your question is that you're confusing your subnet mask with what you read the default is for your class of address. Yes, 10.x.x.x is a class A network, and when interacting with other networks(*) it has a subnet mask of 255.0.0.0. But internally you're able to subnet as you see fit. You really don't want to have 16777214 (2^24 - 2) hosts on the same network segment. You really want to subdivide traffic on those 16 million hosts.

(*) 10.x.x.x/8, 172.16.0.0/12, 192.168.x.x/16 are non-routed IP addresses, meaning you should never see them on the great Internet, just on your local LAN. You need some kind of gateway, such as NAT, to actually have your traffic on the 'real' Internet. You can still route these internally though, say if you wanted your own second network.


The subnet mask refers to the part of a network that a router has knowledge to complete a singal connection hop. For example, most private routers run under the 192.168.0.0 domain with a subnet of 255.255.255.0. This means that any IP address that is of 192.168.0.XXX will ALWAYS be on this private network, no matter what the XXX is. This is a good way for routers to offload routing to a final device, such as one at a large corporation or university campus.

In your case, with a subnet mask of 255.255.255.252, your router will have routing information for only a few IP address, specifically 2. Based on your subnet, your first three octets are all occupied (they are 255), leaving this in a Class-C network block. With a 252 as your last octet, it means that you will have two addresses left over for actual hosts. In general, to know the number of hosts you will have available, you can count the number of 0's in binary in your subnet mask (n), and raise 2 to that power, i.e. 2^n. Then you need to subtract 2 from that value to offset for the special subnets of all 1's and all 0's.

Thus, in your case, you have a final octet of 252, which in binary is 11111100. 2 zeroes means your host equation is (2^2)-2 which is 4-2, which is 2 available hosts on the subnet.

I hope that helps a little. Subnetting can be frustrating. Too much math sometimes!