Help - Search - Members - Calendar
Full Version: Subneting Tricks
Linuxhelp > Support > Technical Support
Hi I need a trick to figuring out subnets.
I normally just pick one, but apprently that is the rong way to go about it...

Both and can be used on private networks using weither the 10.0.x.x or the 192.168.x.x ip ranges

I think what he is asking is: Is there a way to look at an IP address, and figure out it's subnet mask?
This is quite a complicated subject, but i happen to know about it so i will try to explain.. ive been using linux for about 2 years now seriously and i love it, so anything i can do to help i feel great about smile.gif

OK.. When we look at a subnet mask like, what we are looking at is really the "mask" which seperates the NETWORK addresses from the HOST addresses.. so say my IP is and i have a "24 bit" subnet mask ( then i am the first host (1), on the network.

If we take apart the subnet mask and look at the binary equivalent, we will see it looking like this:

11111111.11111111.11111111.00000000 because is all on, on the first 3 octets and all off on the last.. so here it is easy to see the network side and the host side because they are clearly seperated not only by 1's and 0's but also by the octed they are contained within. If you are on a different network say which is separated by a router you wont be able to communicate with it unless you use static routes or a dynamic routing protocol like RIP.

When you "subnet" you look to take a portion of either the network addresses or the host addresses and turn them into host or network addresses respectivly... in pracitce what this means is this:

if i have a subnet mask of we have to look at the binary to work out where the network addresses end and the host addresses start.. lets look at that now: is equal to 11111111.11111111.11000000.00000000
notice where the 1's end is where the network addresses stop and host addresses start.

Basically we have pinched an extra 6 bits for our host addresses from the subnet mask.. which is equated to 6 to the power of 2 extra host addresses smile.gif yippie so we can have more hosts on our new subnet of ,,

Thats basically it, you have to watch out tho becase you wont be able to have a host called 192.168.63.*** because the second from last octet on the subnet mask would then be 255 and it wouldnt work see here: is 11000000.10101000.00111111.00001100
and your subnet mask is 11111111.11111111.11000000.00000000

see how the 1's join up in the second from last octet and will confuse it and think its doing something else.. which i cant remember right now.. too much beer probably but i think it will be trying to broadcast

OH in response to the real question which i just realised, yes you can work out the subnet mask for some addresses.. these are typically private and go like this..

Class A addresses have subnet mask of and first byte value from 1-127 so any address starting with say will be class A

Class B addresses have subnet mask of and first byte(octet) value 128-191

and Class C which have subnet mask of and range from 192 - 223 so the ones you'll recognise are or summut and that would be class C

As far as the internet goes, your ISP will sort out all the subnetting for you.. it can get QUITE complicated... look for more in depth guides from M$ or try some TCP/IP books

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2018 Invision Power Services, Inc.