Does anyone know a good formula for figuring out the mask for a maximum number of hosts per network segment? For example, I have a class B network and I need to figure out the mask for 350 users per segment... not sure how to go beyond 254 hosts... I know that the mask would be 255.255.254.0, I just need to figure out a formula for how to get there.
Unfortunately, there's no easy way to post mathematical formulas here.
The possible number of addresses in a network is given by 2 to the power of the number of bits that can vary. Through algebra, you can show that the number of bits needed for a given number of addresses is the base 2 logarithm of the number of bits. This is sometimes abbreviated to 'lg'.
Google: lg(512). That should give you the answer of nine, which is how many bits have to vary.
You then set the last 9 bits of a 32bit sequence to zero:
Split it into 4 groups of 8 bits:
11111111 11111111 11111110 00000000