Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Possible Duplicate:
How does Subnetting Work?

Subnet mask is usually something like 255.255.255.0. And until now, its the field I usually ignore.

I am trying to read the wikipedia entry, but its pretty loaded with jargon.

Can anyone explain in simple terms what a subnet mask is for and how it works?

share|improve this question

marked as duplicate by jscott, Chris S, pauska, DanBig, coredump Apr 14 '11 at 14:10

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers 2

up vote 3 down vote accepted

Simply put, it tells the OS which part of the IP address refers to the network, and which part refers to a host on that network. If the host needs to send data to an IP address where the network portion of the address differs, then it routes that data through whatever the default gateway/router address happens to be.

So if your subnet mask is 255.255.255.0, then the first three bytes of your IP address are the network, and the fourth byte refers to hosts within that network. If any of those first three bytes are different, the host will send the data through its default gateway (or fail if one isn't configured).

share|improve this answer
    
Pretty good summary. However, it doesn't always send to the default gateway: if there is a specific route saying "this network is reached via this machine", then it sends the packet to that machine's ip instead (usually, a router). ex: this is often the case if for example you have a client network accessible via a specific machine : on the hosts which needs access, the client's network range will have to be routed via this specific machine. (it's more complicated than that, but this simple case is possible) –  Olivier Dulac Dec 28 '12 at 13:49

IP && MASK = Network ID
IP && !MASK = Host ID (on that network)

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.