Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
How does Subnetting Work, and How do you do it?


What is subnet mask?? What is a default Gateway?? How can we get the host ip-addresses from subnet-mask and default gateway i.e. ip-addresses of those machines which are connected to a router i.e default gateway..

I need to know the basics behind these concept..

Kindly provide some basic explanation for the same.

share|improve this question

marked as duplicate by splattne Aug 11 '09 at 7:22

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.

up vote 1 down vote accepted

A subnet is used to break a large network into smaller networks (subnets), which makes moving packets of information around more efficient.

The default gateway is the doorway in, and out, of the subnet.

A subnet (bit) mask is a way of telling a computer what size (sub)network it is a member of, and whether the target computer it wants to communicate with is on the same subnet. If it isn't, it forwards the packet to the default gateway. The gateway then forwards the packet of information on to the right place.

You actually use a form of mental subnet mask every time you make a phone call. When you look at a phone number you need to dial, you mentally calculate how many digits you need to dial, based on your current location, area code, etc.

 Your own number:              1403 123 4567 ext 517

 Number to call:               1403 123 4567 ext 288
 You dial:                     288
 Pseudo telephone subnet mask:

 Number to call:               1403 991 2214
 You dial:                     991 2214
 Pseudo telephone subnet mask:

 Number to call:               1671 113 9910
 You dial:                     1671 991 2214
 Pseudo telephone subnet mask:

And finally, you can't get the host IP address just from the subnet mask, and the default gateway. All you can figure out is what range of IP addresses the host machine will be in. For example, if the subnet mask is and the default gateway is then the host machine will be anywhere from to

share|improve this answer
If RB wants further subnet read:… – l0c0b0x Aug 11 '09 at 5:43
Probably this one too: – l0c0b0x Aug 11 '09 at 5:44

See this thread for a subnetting application.

EDIT: Corrected the missing link. Thks Izzy.

share|improve this answer
There is no link... – Izzy Aug 11 '09 at 7:09

An IP address is a 32 bit number, split into four, 8-bit numbers. This gives the familiar notation, as each portion of that number is its own eight bit number. A Net Mask is another number that indicates a number of bits from the beginning of the number. The bits indicated by this mask describe the 'network number' of that particular network. The unmasked bits describe the local number of that particular network. with a net mask of

255 is the the same as eight 1 bits. So in this case, the network number is 192.168.100 and the local address is 50.

The net mask has to be contiguous bits from the start of the number. For example:

11111111.11111111.11000000.00000000 ( is a valid netmask

11111111.11111111.11111001.00000000 ( is an invalid netmask

11111111.11111111.11111111.00000000 ( is a valid netmask

IP stacks use this information to determine whether or not to try and talk to a remote IP directly or by way of a proxy known as the gateway. If the remote IP is the same network number as itself, it'll attempt to send directly to it. If the remote IP is a different network number, it will attempt to route the data by way of the configured gateway.

Gateways have to be configured, there is no pure IP way to determine what IP is acting as the gateway. Gateway is another term for 'router'.

share|improve this answer
I seriously suspect this answer is far too technically involved for the OP – Izzy Aug 11 '09 at 5:28

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