Subject: Re: netmask/broadcast questions
To: wb2oyc <WB2OYC@BELLATLANTIC.NET>
From: Paul Goyette <paul@whooppee.com>
List: port-mac68k
Date: 12/31/1997 17:52:43
On Wed, 31 Dec 1997, wb2oyc wrote:

> >IPs 192.168.1.*               # with 1-4 being used
> >netmask 255.255.255.0         # which for a class C subnet SHOULD be right?
> >broadcast 255.255.255.192     # ?? no clue on this one...
> >
> >	So, for the above setup, 1) is the netmask I set correct, and 2)
> >what the &*(^ would my broadcast be? ;-) I'm going to re-ifconfig here in
> >a sec, so we'll see if it works... heh ;-)
> Ryan,
>      Yeah, thats fine, it just means your network usable addresses
> are 1-62.  Your mask is making your private network 192.168.1.0-63.
> .63 would be the broadcast address, 0 is the network itself.  Any
> address ending in .64 or above is another subnet of the 192.168.1
> network with the mask you've chosen to use.  The mask ending in 192
> divides that 256 host network into four subnets of 64 each.

That's true for the fourth octet.  But the first three octets (or, at
least as many bits as are set in the netmask) need to match the address
itself.

Someone else said it best earlier:

	broadcast-address = (interface address & netmask) | ~netmask

In other words, take the interface address, and OR it with all of the
bits that are NOT set in the netmask.

				26-bit mask	24-bit mask
			    ---------------	-------------
	Interface address = 192.168.1.3		192.168.1.3
	Netmask           = 255.255.255.192	255.255.255.0

  So    Broadcast address = 192.168.1.63	192.168.1.255


-----------------------------------------------------------------------------
| Paul Goyette       | Public Key fingerprint:   | E-mail addresses:        |
| Network Consultant |  0E 40 D2 FC 2A 13 74 A0  |  paul@whooppee.com       |
| and kernel hacker  |  E4 69 D5 BE 65 E4 56 C6  |  paul.goyette@ascend.com |
-----------------------------------------------------------------------------