# How to calculate the bits of private ip address

Sep 10th, 2010

Hi all,

This is my first post here.

I wonder how should I answer question like this:

You have the network 172.20.0.0 /24, how much bits are in the subnet (how much subnets can be there)?

So  I wondere in a question like this, I need to see what is the original netmask.

this is calss B address so: 255.255.0.0 will be the default.

but this is private IP address so 255.240.0.0 should be/

So how can I decide?

For example if the default is 255.255.0.0 so:

*Red = network ID, Blue = subnet ID.

there are 8 bits of the subnet ID meaning => 256 subnets ID can be found (no need to subtrac 2 here).

Or

For example if the default is 255.240.0.0 so:

*Red = network ID, Blue = subnet ID.

so here the are 12 bits of subent ID which means => 4096 (no need to subtrac 2 here).

So according to what I should calculate private IP address, according to the netmask of the Class or according to the default?

Overall Rating: 0 (0 ratings)

## Replies

jamesmala Fri, 10/08/2010 - 02:12

you are almost correct with the subnetting for the 240 subnet address. just think about the subnetting per section and not all of them at one time. when you got a 255 it will be 11111111

254 it will be 11111110

252 it will be 11111100 If you notice what is happening, the position with the "0" in it, that amount is removed. it will be like that and the areas will the "0" will just go up. if you add the two zeros count together you will get 3, then add it to 252 will add up to 255, the subnet mask.

240 it will be 11110000 add all the zeros up you will get 15 then add it to 240 = 255. subnetting is not hard once you see that.

there are other ways to do it, but once you see that by adding up the zero positions you will get a number then subtract it from 255 and that is your mask. it takes pratice for this to come naturally