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, and How do you do it?

Hi,

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
add comment

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.

3 Answers

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: 255.255.255.0

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

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

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 255.255.255.0 and the default gateway is 192.168.1.1 then the host machine will be anywhere from 192.168.1.2 to 192.168.1.254

share|improve this answer
1  
If RB wants further subnet read: serverfault.com/questions/49765/… –  l0c0b0x Aug 11 '09 at 5:43
    
Probably this one too: serverfault.com/questions/11915/routers-vs-switches –  l0c0b0x Aug 11 '09 at 5:44
add comment

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
add comment

An IP address is a 32 bit number, split into four, 8-bit numbers. This gives the familiar 192.168.100.50 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.

192.168.100.50 with a net mask of 255.255.255.0

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 (255.255.192.0) is a valid netmask

11111111.11111111.11111001.00000000 (255.255.249.0) is an invalid netmask

11111111.11111111.11111111.00000000 (255.255.255.0) 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
2  
I seriously suspect this answer is far too technically involved for the OP –  Izzy Aug 11 '09 at 5:28
add comment

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