Damn. I wrote almost all of this out, then I must have hit refresh or backspace while outside of the text box or something, because then Opera caused me to lose all my text. Bleh.

Anyway, this is about Subnet masks, as I understood them when clicking 'reply', anyway.
Now I've made it it's own thread.

I will assume people know about BINARY NOTATION, because I don't want to have to write that part all out again.

A subnet mask often looks curiosly akin to an IP address, but they are different things. A subnet mask lets your computer figure out which addresses are local, or near you, in your office, for instance, and which ones are outside.
Code:
Common masks are:
255.255.0.0
and 
255.255.255.0

Which, in binary, are:
11111111.11111111.00000000.00000000
and
11111111.11111111.11111111.00000000
respectively.
The computer compares the mask to the destination IP addresses, such as:

207.220.12.23 = 11001111.11011100.00001100.00010111
or
199.217.30.90 = 11000111.11011001.00011110.01011010


and your own IP, such as:
199.217.30.84 = 11000111.11011001.00011110.01010100


Code:
IP 1    11001111.11011100.00001100.00010111   (207.220.12.23)
IP 2    11000111.11011001.00011110.01011010   (199.217.30.90)
YOUR IP 11000111.11011001.00011110.01010100   (199.217.30.84)
Mask    11111111.11111111.11111111.00000000   (255.255.255.0)
So it takes your IP, and takes away all the digits in your IP which correspond to digits that are 0's in the mask, and then does the same thing with the destination IP, leaving:
Code:
Yours:
11000111.11011001.00011110.-------
Destination 1:
11001111.11011100.00001100.-------
Destination 2:
11000111.11011001.00011110.-------
It then compares yours and the desination. If they match, then it knows you are sending to a computer that is on your LAN, and if they don't, it knows that the destination could be halfway across the world. In the above example, IP #1 Is not local, and IP #2 is local.

The tricky part comes when you have a subnet mask that is NOT just 255s and zeros, such as
Code:
MASK = 255.255.252.0 = 11111111.11111111.11111100.00000000
Can you see the difference?

Lets whip up a new set of IP addresses.
Code:
IP 1    11000111.11011001.10101110.00000011   (199.217.174.3)
IP 2    11000111.11011001.00011011.01001010   (199.217.27.74)
IP 3    11000111.11011001.00011111.01001010   (199.217.31.74)
YOUR IP 11000111.11011001.00011110.01010100   (199.217.30.84)
MASK    11111111.11111111.11111100.00000000   (255.255.252.0)
So, running all of these through the mask, we get:

Code:
IP 1    11000111.11011001.101011--.--------   (199.217.174.3)
IP 2    11000111.11011001.000110--.--------   (199.217.27.74)
IP 3    11000111.11011001.000111--.--------   (199.217.31.74)
YOUR IP 11000111.11011001.000111--.--------   (199.217.30.84)
As you can clearly see, only IP #3 is the same as your own IP, IP's #1 and #2 are *SLIGHTLY* different, but different enough to be non-local. As I hint, I'd say the most important thing to know about subnet masks is that 255.255.252.0 is ONLY short-hand for:
11111111.11111111.11111100.00000000 !

Just because the number has 252, doesn't mean you get ((255 - 0) * (255 - 252))=765 addresses that are local, you get 11111111.11111111.11111100.00000000 ten binary digits, or 1024 local addresses!


Some people may also have heard of or use CIDR, which shows addresses and their masks like this: (Using previous example)

199.217.30.84 / 22
which means that the FIRST 22 DIGITS of the mask are 1s, and the last 10 are zeros. So it is like saying:
Address 199.217.30.84, subnet mask 11111111.11111111.11111100.00000000
(The first 22 digits are ones.)

Anyway, I hope that helps, and correct me if I made a mistake, I don't deal with this stuff for a living or anything. Shout outs to UltraEdit, for letting me actually write this thing out again without worrying about losing it on the web

EDIT: Changed [pre] and [/pre] to [(/)code] tags.
EDIT: Changed the way I phrased that last edit message so that it didn't look weird onscreen because of the way it was parsed by the board.