0

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.

RBA
  • 283
  • 3
  • 6
  • 16

3 Answers3

1

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

Izzy
  • 8,224
  • 2
  • 31
  • 35
  • 1
    If RB wants further subnet read: http://serverfault.com/questions/49765/how-does-subnetting-work-and-how-do-you-do-it – l0c0b0x Aug 11 '09 at 05:43
  • Probably this one too: http://serverfault.com/questions/11915/routers-vs-switches – l0c0b0x Aug 11 '09 at 05:44
1

See this thread for a subnetting application.

EDIT: Corrected the missing link. Thks Izzy.

Maxwell
  • 5,076
  • 1
  • 26
  • 31
0

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'.

sysadmin1138
  • 133,124
  • 18
  • 176
  • 300