## Open Source Software and Linux

Dec 21 2008   11:15PM GMT

# Quick Subnetting and IP calculations Part 1

Profile: Xjlittle

Tags:
Lotus Domino

With all of the ip and subnetting calculators all over the internet it might seem to some that learning subnetting is unnecessary. I think that it is a skill that is underused and should be learned by all network administrators. It’s really not that hard to get the basics down.

In this article and the next I am going to show you how to do two things quickly and easily with subnetting. I’m going to show you how to build a custom subnet from scratch and how to calculate how many hosts on a network. The only part of the binary code of this that I’m going to discuss is this which we should all know:
``` 128 64 32 16 8 4 2 1 ```
The above numbers represent the 8 bits in a subnet mask.

To start building our custom subnet we are going to assume a class C network. With this we know that our default mask covers the first 24 bits which would make it 255.255.255.0. Notice that 255 is the sum of all of the numbers above. Second let’s assume that our class C address in 192.168.10.0 and that we want to build 6 subnets from this to cover six of our departments.

First convert the number of subnets to binary. We can see that adding bits 2 and 4 above make 6. We will turn all of the bits on that are to the right of the 4:
``` 00000111 ```
Next flip the entire octet from end to end:
``` 11100000 ```
Add the bits together that are on the left end of the bits shown in the 1st code box:
``` 128+64+32=224 ```
So now we know that 224 is our new subnet mask and that we can get 6 networks out of this. The 32 in this scenario is known as the Least Significant Bit or LSB. Pretty straightforward isn’t it?

Now we need to get our network, host and broadcast addresses. To do this take the Least Significant Bit from the three bits that we used above. This would be 32. So starting with 0 we start setting up our networks like so:
``` Network Address Range Broadcast 0 192.16.10.1 thru 30 192.168.10.31 32 192.16.10.33 thru 62 192.168.10.63 64 192.16.10.65 thru 94 192.168.10.95 96 192.16.10.97 thru 126 192.168.10.127 128 160 192 224 ```
and so on. As you can see each network starts with 0 and then the LSB is the increment to the next network so we have 0 32 64 and so on. The broadcast address is 1 less than the next network number. This leaves the host addresses as the network number plus 1 through the broadcast address less 1 giving us 30 hosts per network

Next post we’ll see how to determine how many hosts on a network.

-j

## Comment on this Post 