Subject: Re: netmask/broadcast questions
To: SamMaEl <rimsky@teleport.com>
From: Bill Studenmund <wrstuden@loki.stanford.edu>
List: port-mac68k
Date: 12/30/1997 18:22:03
> 	In my struggle to get ipnat working CORRECTLY on my subnet, I
> changed my local IP setup from: 
> 
> IPs 10.0.0.*                  # with 1-4 being used
> netmask 255.255.255.0         # which Bob Nestor pointed out as wrong
> broadcast 255.255.255.10      # also wrong?

That netmask is fine. For an IP address starting with 10. (a Class A address),
you need at least 8 bits in the netmask. But you can have more. That would
mean you've subnetted your non-routed net. I'm planning on breaking my net
up like that. Right now, I have a netmask of 255.255.0.0, and all is well.

Aside: my idea is: 10.0 for the ethernet, 10.1 for ppp links, 10.2 for
IP over other protocols (not ready yet).

The broadcast address is way wrong, though. See below.

> 	My new setup is:
> 
> 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...

Not right either.

> 	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 ;-)

Why are you setting the broadcast address manually? Let ifconfig do it.
If you get the netmask right, you're fine.

Here's how to make the default broadcast address:

Figure out the network part of your IP address (the part with '1's in
the netmask). That's the network part of the broadcast address. It's
10.0.0 and 192.168.1 for your two examples, and 10.0 for my example
(note difference in # of digits for the two 10.XXX cases!).

Fill the node part of the address ('0's in the netmask) with '1's.
You'll get 255 and 255 for both of your cases, and I get 255.255
for my net.

Or the two parts together. That's the default broadcast address.
It's 10.0.0.255 and 192.168.1.255 for your two cases, and
10.0.255.255 for my net at home.

The reason ifconfig lets you configure this address is that the 4.2BSD
IP stack used '0's in the node part of the broadcast address. This
convention is obsolete, but may still exist on some nets out there.

Also, exactly what the broadcast address is doesn't matter. What
matters is that everything agree. Some systems (MacTCP comes to mind)
don't let you set the broadcast address. They choose the default. So to
talk with them, you need to also choose the default.

So why are you not choosing the default. ??? :-)

Take care,

Bill