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

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

D
Termina
I think what he is asking is: Is there a way to look at an IP address, and figure out it's subnet mask?

http://www.j51.com/~sshay/tcpip/ip/ip.htm
crazydark
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 255.255.255.0, what we are looking at is really the "mask" which seperates the NETWORK addresses from the HOST addresses.. so say my IP is 192.168.0.1.. and i have a "24 bit" subnet mask (255.255.255.0) then i am the first host (1), on the 192.168.0.0 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 255.255.255.0 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 192.168.1.0 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 255.255.192.0 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:

255.255.192.0 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 255.255.255.0 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 255.255.192.0 ,,

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:

192.168.63.12 is 11000000.10101000.00111111.00001100
and your subnet mask is 255.255.192.0 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 255.0.0.0 and first byte value from 1-127 so any address starting with say 128.24.12.12 will be class A

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

and Class C which have subnet mask of 255.255.255.0 and range from 192 - 223 so the ones you'll recognise are 192.168.0.2 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

smile.gif
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-2017 Invision Power Services, Inc.