New Zealand ADSL Mailing List


Re: (OT) Help: Subnet Mask

From: Bruce Hoult <bruce_at_hoult.org>
Date: Wed, 3 Oct 2001 17:09:31 +1200
Message-Id: <a0510100fb7e04c50dafd@[192.168.0.2]>

At 4:38 PM +1200 10/3/01, James Pluck wrote:
>Thank you for all your help people. As an adjunct to this, does anyone have
>a site or some information that explains how the bitmapping (presumed) of
>the subnet mask works? I have seen a couple of "Cheat sheets" but nothing
>that explains the inner-workings as it were.

Well it's very simple.

When a machine A wants to send a packet to machine B it needs to
decide whether to send it directly or whether to send it to a router
which will forward it to the appropriate place.

Convert the following to 32 bit integers:

- the IP address of machine A
- the IP address of machine B
- the subnet mask, M

if (A & M) == (B & M)
    send it directly
else
    send it to the gateway

All you have to do is make up M appropriately so that this works.
You do this by putting a "1" everywhere that much match for the other
machine to be on the same subnet as you (e.g. the same ethernet), and
a "0" everywhere that is allowed to be different between the two
machines even though they're on the same subnet.

Simple, huh?

-- Bruce

This message is part of the NZ ADSL mailing list.
see http://unixathome.org/adsl/ for archives, FAQ,
and various documents.
To unsubscribe: send mail to majordomo@lists.unixathome.org
with "unsubscribe adsl" in the body of the message
Received on Wed Oct 3 17:09:54 2001


This archive was generated by hypermail 2.2.0 : Thu Nov 30 11:48:16 2006 EST