
December 7th, 2012, 06:54 PM
|
 |
Lost in code
|
|
|
|
|
"192.168.10.0" by itself isn't a block, it's an address. But let's pretend that's your starting address.
Let's say that you first need to create a network for 40 hosts. How many bits do you need for 40 hosts? 6; because 2^5 is only enough for 32 hosts. You have 32 bits in the address though, so this means you have 26 bits left over. So the netmask is going to be 26 bits. This makes your netmask 255.255.255.192 because 0b11111111 is 255 in base 10 and 0b11000000 is 192 in base 10. And since this is your first subnet, your subnet address is 192.168.10.0. Since your network has 64 hosts in it, the last address in the subnet is 192.168.10.63.
Let's say your second network is only 25 hosts. Now you only need 5 bits for the hosts. So this time your netmask is going to be 27 bits. So 255.255.255.224, because 0b11100000 is 224 in base 10. If you want to position it immediately after your last network, then your subnet address is simply the next available address, 192.168.10.64.
|