# Mnemonic to find how many Hosts in a Subnet

Hi

I’m teaching our trainees how to find how many Hosts in a Subnet by mental arithmetic as they need it for School.

This is the way I learned how to.

Example Question:
If I need 50 Hosts in the 192.168.1.0 Range.

1. Step: 50 + 1 = 51
2. Step: 2 Power of 6 will fit = 64
(64 - 2 = 62 Hosts can be used)

Now if I need to find how many Subnets:
3. Step: 8 (total) - 6 (2 power of 6) = 4 Subnets

Is this the easiest way? Alternatively, do you have any other better mnemonic’s?

Many thanks in advance
LVL 19
###### Who is Participating?

PrincipalCommented:
I'm sorry I wasn't clearer.  OK, thank you.

So you have:

256 addresses - 252 addresses = 4 addresses (and not subnets).

So, since the original statement was in error, I'm left not understanding what to evaluate or comment on.

You ask us to explain so I'll try in hope that something will stick to the wall here: :-)

A subnet mask of:
11111111  11111111  11111111  111111111  is 255.255.255.255
subtract 3 to get:
11111111  11111111  11111111  111111100  is 255.255.255.252
Now subtract the next 2 least significant "1" bits (which is 12)
11111111  11111111  11111111  111110000  is 255.255.255.240

The locations where the subnet mask is "1" represent the network address.
The locations were the subnet mask is "0" represent the host addresses plus network address value of "0" plus the broadcast address of all "1"s.

Examples:

192.168.0.0 / 255.255.255.252 is:
11000000 10101000 00000000 00000000
11111111 11111111 11111111 11111100
So, with the subnet mask, the host address is 00 - the network address

192.168.0.1 / 255.255.255.252 is:
11000000 10101000 00000000 00000001
11111111 11111111 11111111 11111100
So, with the subnet mask, the host address is 01

192.168.0.2 / 255.255.255.252 is:
11000000 10101000 00000000 00000010
11111111 11111111 11111111 11111100
So, with the subnet mask, the host address is 10 or 2 decimal

192.168.0.3 / 255.255.255.252 is:
11000000 10101000 00000000 00000011
11111111 11111111 11111111 11111100
So, with the subnet mask, the host address is 11 or 3 decimal .. the broadcast address.

Above, I picked a subnet with 4 addresses, 4-2= 2 usable.

Now, increase the subnet mask by two more zeros:

192.168.0.0 / 255.255.255.252 is:
11000000 10101000 00000000 00000000
11111111 11111111 11111111 11110000
So, with the subnet mask, the host address is 00 - the network address

192.168.0.1 / 255.255.255.240 is:
11000000 10101000 00000000 00000001
11111111 11111111 11111111 11110000
So, with the subnet mask, the host address is 01 binary or decimal.

192.168.0.2 / 255.255.255.252 is:
11000000 10101000 00000000 00000010
11111111 11111111 11111111 11110000
So, with the subnet mask, the host address is 10 or 2 decimal

192.168.0.3 / 255.255.255.252 is:
11000000 10101000 00000000 00000011
11111111 11111111 11111111 11110000
So, with the subnet mask, the host address is 11 or 3 decimal
...........
192.168.0.4 / 255.255.255.252 is:
11000000 10101000 00000000 00000100
11111111 11111111 11111111 11110000
So, with the subnet mask, the host address is 100 or 4 decimal
..........
192.168.0.8 / 255.255.255.252 is:
11000000 10101000 00000000 00001000
11111111 11111111 11111111 11110000
So, with the subnet mask, the host address is 1000 or 8 decimal

..........
192.168.0.8 / 255.255.255.252 is:
11000000 10101000 00000000 00001111
11111111 11111111 11111111 11110000
So, with the subnet mask, the host address is 1111 or 815 decimal - the broadcast address.

So, the number of zeros on the right end of the subnet mask tells you how many bits can represent addresses.
AND, if you take a particular pattern like the above AND call that a subnet then there is one (1) subnet.
BUT, if you start with a pattern like the above AND break it into smaller subnets then there are a variety of combinations to choose from.
Further, if you set some ground rules, then you might use that context to talk about subnets.

Here is an example:
Above we have an address space of 4 bits.
We know that 2 bits is the smallest meaningful subnet size yielding 4 addresses and 2 usable addresses.
Since we have 4 bits in the subnet mask, we can split that up into the smallest possible subnets of:
192.168.1.0 / 255.255.255.252
and
192.168.1.4 / 255.255.255.252
and
192.168.1.8 / 255.255.255.252
and
192.168.1.12 / 255.255.255.252

So, in this case, 4 bits yields 4 (of the smallest useful) subnets.
If there are 5 bits then there will be 32 addresses and 32/4=8 (of the smallest useful) subnets.
and so forth....

But I'm not sure that figuring out how many of the smallest possible subnets is very useful.

You can always say this:
2^N (where N is the number of zero bits in the subnet mask) is the total number of addresses available in that subnet.
2^(N-1) is the number of addresses in the 2 largest possible subnets within,
2^(N-2) is the number of of addresses in the 4 largest possible subnets within.
2^(N-n) (where N-2=n is the number of addresses in the smallest possible subnets within.

So, with all that, are we getting closer to what you're looking for?
0

PrincipalCommented:
I would say:
If I need 50 Hosts in the 192.168.1.0 Range.

1. Step: 50 + 2 = 52 (2 because 1 for network address and 1 for broadcast address)
2. Step: 2 Power of 6 will fit = 64
(64 - 2 = 62 Hosts can be used)    Yes, there's the "2"....

Now if I need to find how many Subnets:
3. Step: 8 (total) - 6 (2 power of 6) = 4 Subnets

Well this last part must be assuming a bunch of things:
1) the address range that's available overall has 256 addresses and not some other number.  Why?  OK, /24 is common but it's not absolute.
2) the assumption is that all the other subnets within will be the same size as the first one.  Why?  There can be all kinds of subnets of various sizes within /24.
0

IT ManagerAuthor Commented:
Hi fmarshall

Thanks for the correction "2". :-)

The second way I found to calculate Subnets are:
256 - 252 = 4 Subnets

But how do I know that it is 252???

Many thanks
0

PrincipalCommented:
256 is supposed to represent what?  An octet of 11111111?
252 is supposed to represent what?  An octet of 11111100?

The difference is 4 > 00 to 11 i.e.  4 values.

But these would be addresses and not subnets.
So, I'm a bit confused.
0

IT ManagerAuthor Commented:
256 is supposed to represent what?  An octet of 11111111?
252 is supposed to represent what?  An octet of 11111100?

The difference is 4 > 00 to 11 i.e.  4 values.

But these would be addresses and not subnets.
So, I'm a bit confused.

That is also my problem. I'm also confused... Can anybody explain this?
0

InstructorCommented:
256 is the number of possible addresses (not necessarily valid addresses, mind you) with 8-bits.
0

IT ManagerAuthor Commented:
@All

Thanks Friends waiting now for more Mnemonic's
0

PrincipalCommented:
There could be more if we understood what you're trying to accomplish in specific.
I've not seen what appears to be a complete, example question.

For example:
Q:
If I need 50 Hosts with a network address of 192.168.1.0, what subnet mask should I use for the smallest possible subnet?
[That's really the complete question isn't it?]
A:
50+2=52.
52 is between 32 and 64; the nearest powers of 2. I.e 2^5 and 2^6.
So, 64 is the smallest subnet size.
Now we know it's 2^6 we also know there will be 6 zeros in the subnet mask:
11000000 = 192  so
The subnet mask for that size subnet is  255.255.255.192
Or, if you like: 255.255.255.[256-64]

So, there are a couple of mnemonics there.
0

IT ManagerAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 100 points for fmarshall's comment #a39848939
Assisted answer: 100 points for fmarshall's comment #a39844506
Assisted answer: 100 points for fmarshall's comment #a39844661
Assisted answer: 100 points for donjohnston's comment #a39846167
Assisted answer: 0 points for hopeleonie's comment #a39849429
Assisted answer: 100 points for fmarshall's comment #a39852004

for the following reason:

Thanks to you both again!
0

IT ManagerAuthor Commented:
Thanks to all again!
0

IT ManagerAuthor Commented:
Have a nice day!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.