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

I have Wireless Internet with a USB modem and got what seems to be a Class A IP allocated (first byte is decimal 10).

ipconfig /all shows a subnet mask of 255.255.255.252. I know that the ones are for the network and the zeros are for the hosts but how many hosts are for 11111111.11111111.11111111.11111100?

Shouldn't the subnet mask be 255.0.0.0 for a class A network?

What is it that I am getting wrong?

I need a simplified answer, as I have difficulty understanding long and technical answers, due to a lack of computer knowledge.

-
Classes are dead. – grawity Aug 2 '10 at 9:57
@grawity +1 i wonder why they wont stop teaching this – matthias krull Aug 2 '10 at 22:30
Classes aren't dead technically. RFC1519 uses Class A,B, and C quite often. When I see people use Class A,B, or C I think /8, /16, /24 respectively. – dbasnett Aug 3 '10 at 12:27
It's been a month since the question was asked, if one of the answers fits please accept it. Thanks. – Zaz Aug 31 '10 at 13:32
Serial Masks :) – John T Sep 9 '11 at 18:51

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.

-
+1 for the note about 10.x.x.x/8 being a non-routed IP address -- it's a block specifically allocated for private networks. See RFC 1918 ietf.org/rfc/rfc1918.txt It's likely that your ISP is handling the NAT for you. The downside is that if you were hoping to connect to your computer from outside, you don't have a publick IP address. – Doug Harris Sep 9 '11 at 19:07

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!

-
Is there some documentation (not wikis) who explains this in detail? A complete reference so to say? – Jon Aug 1 '10 at 15:43
wikipedia has a pretty good explanation of subnets. Also, any Network+ related books will have some good lessons on subnetting. But a lot of this stuff you pick up system administering or in networking classes in University. Search Amazon for Networking books and those will most likely contain chapters on subnetting. But it's all math and written in technical language because properly applying it and understanding it is a technical thing. – Jonathan Aug 2 '10 at 4:30
Some RFC's (some older) RFC 950, 1219, and 1878. – dbasnett Aug 3 '10 at 12:10

You are correct to say the subnet mask of Class A should be `255.0.0.0` but in a classless network involving subnetting `255.255.255.252` is mostly used between the ISP and your home network to provide only 2 usable host. Of which one host is the ISP and the second is your home network public address.

`255.255.255.252` would give you only two usable address as follows:

``````Network Host Broadcast
0       1:2     3
4       5:6     7
8       9:10    11
``````

Therefore if you use `10.1.1.0` network with a `255.255.255.252` subnet mask, your usable IP address would be `10.1.1.1` and `10.1.1.2` while the broadcast address would be `10.1.1.3`.

Note that broadcast address can not be assigned to a host of interface.

-

`(255 - 252) + 1 = 4`. You `+1` because it's networks between 252 and 255, including 252.

The netmask for a Class A network should be `255.0.0.0`, a Class A network is unusually large for a home network as it has `255.255.255.255 - 255.0.0.0 = 16,777,216` addresses.

Also, you got the binary wrong. IPv4 addresses are made up of four 8-bit bytes, as so:

``````255.255.255.252  =  11111111.11111111.11111111.11111100
255.255.255.253  =  11111111.11111111.11111111.11111101
255.255.255.254  =  11111111.11111111.11111111.11111110
255.255.255.255  =  11111111.11111111.11111111.11111111
``````

-

First, forget anything you've heard about classes.

Subnet masks do not have to be 255.0.0.0, 255.255.0.0, or 255.255.255.0. The 1 to 0 boundary can fall on any bit between 31 (left most, or most significant bit) or 0 (right most, or least significant bit).

A more compact and easier form of writing the subnet mask is to write a slash, then the number of 1 bits, this is called CIDR notation and is now what is used. (/32 means a single IP, and your formerly classful masks above would be /8, /16, and /24).

Look below for an example of how binary arithmetic works:

``````  ... 5 2   1
... 1 5   2 6 3 1
... 2 6   8 4 2 6 8 4 2 1  <-- Place Value
... ---   ---------------
... 1 1   1 1 1 1 1 1 0 0  <-- Bit of Netmask
``````

0 bits in a subnet mask are available for hosts, but not the first or last address. So add up all the value of each column that is 0, then subtract 2 to find the number of hosts.

The above subnet mask, 255.255.255.252 could also be written as a /30.

-

`255.255.255.252` is a `/30` network mask (or simply netmask), that is, the first 30 bits are used for the network prefix and the last 2 are use to identify the host.

Such a netmask has 64 subnets and 2 hosts in each subnet for a total of 128 hosts:

``````network address   x.x.x.0
first host        x.x.x.1
last host         x.x.x.2
``````
-

Well, you are part of a subnet, specifically the subnet 255.255.255.252. You can have a class A IP from a network which has subnets.
The IP with .252 at the end is 11111100 in binary, so your transformation from dec to bin is incorrect.
But let's put that aside ... there should be 4 hosts in .252

-
You are correct, I messed up the conversion on the last part; 11111100 is the correct value, and in fact there are 4 hosts for mask 00. Thank you for pointing that out. If I am in a subnet, how many subnets can there be for class A with the above subnet mask? – Jon Aug 1 '10 at 15:32
4,194,304 if I did my math right. – dbasnett Aug 3 '10 at 12:38

Subnet bits will be 4

Maximum subnet 16

First octet range of 192-223

-

the first binary digits = 0 for class a, 10 for class b, 110 for class c, 1110 for class d and 1111 for class e (experimental). you have class b. which default subnet is 255.255.0.0. So to determine you should convert intp network info use the 2'n-2=y formula. (y= the number of subnets you want to create) (n= the number of host bits to be converted to network bits) ex. you want to create 14 subnets. 2'n-2=14. 2'n=14+2. 2'n=16. 2'4=16. 4 is the amount of bits you need to take from the default subnets host area 11111111.11111111.11110000.00000000. you can determine how many host are available by the 2'n-2 formula (n= the number of zeros there are) 2'12-2 (-2 for the network ID and Broadcast ID) = 4094 available host for a subnet of 255.255.240.0.

-

Akere classA is 126.255.255.255? So to do subneting I will say that the second octet should be broken down into 2 parts and, e.g.

``````11111110.11111111.11111111.11111111
``````

would be 126.30.255.255

-