cancel
Community Member

## subnetting

How many addresses can i have with a 252 mask, is it 2. do you just times by 2 the number of zeros you have, i.e if I have 2 zeros left, do I just do 2 x 2 -2 for the network and broadcast address ?

6 REPLIES
Purple

## Re: subnetting

Hi Carl,

I presume you mean a 255.255.255.252 mask, right ?

One simply way of working out the number of useable addresses you can have in this case is to subtract the last octet from 256 and then take a further 2 away from it. You have to subtract 2 from this to account for the network and broadcast addresses, respectively.

Some examples:

255.255.255.252: 256-252-2 = 2

255.255.255.248: 256-248-2 = 6

This only works if the first three octets are 255. However, this can be extended to cases where the mask is less than /24 too.

Hope that helps,

Paresh

Blue

## Re: subnetting

Yes and no.....here is how I do it.

Note...you have to subtract 2 ip addresses from the above to get useable IP Addresses

Do you see a pattern?...baicly you double as you go up...so 255.255.255.224 would be 32 ip addresses and so on.

hope this helps.

Mike

Community Member

## Re: subnetting

Hi All,

how about some of your tricks for less than /24 and /16. Curious to see how they are done quickly, as I sometimes find them frustrating. Cheers.

coolboarderguy...

Purple

## Re: subnetting

Hi all,

Here's my way of doing it:

Prefix length >= 24:

16 >= Prefix length > 24:

8 >= Prefix length > 16:

Prefix length < 8:

Hope that helps.

Paresh.

Silver

## Re: subnetting

Are you trying to make a algorithm to program in a programminglanguage, or are you just curious to know how to make the calculations yourself?

I find the best way is to simply remember how many you can have with the different masks:

Ie.. just remember the 255, 254, 252... part and of course the obligatory binary value-sequence of 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, etc. etc. then you are set... :)

If you need to have more than a /24 network, then you just multiply like this:

255.252.0.0 = two zeroes before a 'interesting' mask-value.. = 256 * 256 * the value which is 4 here = 262144 - subnet - broadcast = 262142 hosts...

There is of course the 'other' way:

When you have a value unequal to 255, subtract the value from 255 and you have the Cisco wildcard.. with the wildcard, subtract one address and you have the number of hosts..

255.255.255.252 = 0.0.0.3, 3-1 = 2 hosts

255.255.255.240 = 0.0.0.15, 15-1 = 14 hosts

255.255.255.224 = 0.0.0.31, 31-1 = 30 hosts

But for the longer prefixes, you'll need to first add one to each part of the wildcard values and multiply them together before subtracting the subnet and broadcast again:

255.252.0.0 = 0.3.255.255 = (3+1)*(255+1)*(255+1) = 262144, 262144-subnet-bcast = 262142 hosts

Did it help, or did I confuse you?

Community Member

## Re: subnetting

hi

thanks johnansens, im confused about this " 256 * 256 * the value which is 4 here " , what value goes at the end, is it the first interesting mask ?

103
Views
0