PPRuNe Forums - View Single Post - Networking Laptop to Base Unit
View Single Post
Old 15th Jun 2004, 10:37
  #11 (permalink)  
Saab Dastard
Spoon PPRuNerist & Mad Inistrator
 
Join Date: Sep 2003
Location: Twickenham, home of rugby
Posts: 7,394
Received 250 Likes on 167 Posts
255.255.255.0 is a good mask for general use. Use different masks where you want to preserve the option to restrict privileges.
AAAARRRGGGHHHH!

I can't stand by and see IP addressing so misunderstood!

The subnet mask is used by the IP stack in a computer or router to determine whether or not a given IP address is on the same IP network as its own. Period.

Privileges have absolutely nothing whatsoever to do with it.

Subnet masks, like everything else in computing are binary numbers - ones and zeros. There are 4 octets (8 binary digits) seperated by decimal points in a netmask, just like in an IP address. We normally write them as base 10 numbers for convenience, but it is only possible to really understand netmasks by looking at them in binary form.

Therefore 255.255.255.0 is really 11111111.11111111.11111111.00000000

An IP node uses the netmask to determine if two IP addresses are on the same IP network by comparing the binary digits of the netmask with the binary digits of the IP address. Basically, anything under the ones in the netmask is part of the network address, while anything under the zeros is part of the individual node address.

Hence for the subnet mask of 255.255.255.0, the first 3 octets define the network address while the last octet defines the node address. 192.168.0.2 with a subnet mask of 255.255.255.0 is NOT on the same network as 192.168.1.2 The value of the first two octets is the same, but the third octet is different.

EVO is quite correct - 255.255.254.0 (among many others) would make these both be on the same network, as the subnet mask would now be
11111111.11111111.11111110.00000000

The IP addresses 192.168.0.2 and 192.168.1.2 in binary form are

11000000.10101000.00000000.00000010 and 11000000.10101000.00000001.00000010

Comparing the digits under the ones in the subnet mask you can see that they are the same - 11000000.10101000.0000000 - and therefore are on the same network.

255.255.255.0 is NOT a "general purpose" subnet mask. It is the standard class C subnet mask, where only the 4th octet is used for the node address, the first 3 defining the IP network.

There are lots of resources for understanding IP addressing on the 'net if you want to find out more.

SD
Saab Dastard is offline