[comp.bugs.4bsd] On the importance of a correctly specified netmask

jw@sics.UUCP (05/28/87)

Index: /etc/ifconfig BSD4.3 and some BSD4.2

When I converted from BSD4.2 to BSD4.3 I made the following mistake.
I did not know a lot about subnets, and we did not feel a need for them,
so I decided to skip all that for the time being. I hoped (foolish me)
that /etc/rc.local from BSD4.2 would work without much change. It almost
did except for the ifconfig lines.

I had read the manuals so I knew that the format of the ifconfig command
had changed. The problem was that ifconfig had a lot of new options which
I did not know how to set appropriately. My rule: if you do not understand
an option, do not specify that option. Programs should provide good
default values.

This brings us to the netmask option. The netmask option specifies
how much of the address to reserve for subdividing networks into
sub-networks. The netmask is used by the network interface to recognise
broadcast packets. It turns out that the vax ifconfig does not set
a default netmask. Ifconfig assumes that this is done in the driver.

The DEUNA driver does not set a reasonable default netmask. If you fail
to specify a mask then the interface will become promiscuous and receive
a lot af packets not intended for the machine. The OS will process these
packets and answer several of them!

The vax became severely loaded from time to time. More seriously, our Sun
clients had trouble starting up NFS.

It was fairly difficult to find the cause of the problem. The Sun clients
did not have the netmask specified either, but the Sun ifconfig appears
to set a reasonable default value.

To sum up: set the netmask explicitly when you use ifconfig.


-- 
Johan Widen
Swedish Institute of Computer Science
PO Box 1263, S-163 13 SPANGA, SWEDEN
UUCP: {seismo,mcvax,munnari,cernvax,diku,inria,prlb2,penet,ukc,unido}!enea!sics!jw

mouse@mcgill-vision.UUCP (06/09/87)

In article <1300@sics.UUCP>, jw@sics.UUCP (Johan Widen) writes:
[about 4.3 netmask in ifconfig]
> The netmask is used by the network interface to recognise broadcast
> packets.

And for other things.  But you may be confused here.  The interface
itself (eg, DEUNA, Interlan, etc board) has no knowledge of IP
addresses such as are set with ifconfig.  All that happens at higher
levels.  It is those higher levels which use the netmask.

> It turns out that the vax ifconfig does not set a default netmask.
> Ifconfig assumes that this is done in the driver.

Ifconfig merely assumes that it is done in the kernel somewhere, and
sure enough it is.

> The DEUNA driver does not set a reasonable default netmask.

Neither does any other interface board driver.  The kernel network code
sets the netmask to the correct value for a non-subnetted interface.
For a class A network address, it uses a netmask of 255.0.0.0, for
class B it uses 255.255.0.0, and for class C it uses 255.255.255.0.

> If you fail to specify a mask then the interface will become
> promiscuous and receive a lot af packets not intended for the
> machine.

If your interface has truly gone promiscuous because you didn't give a
netmask on the ifconfig line you have a very strange version of 4.3.
More likely you are trying to run a class B or C style network on a
number that's really class A or B (eg, trying to use 10.65.x.x
addresses: 10 is a class A network, so without subnetting addresses
would be 10.x.x.x).

> The OS will process these packets and answer several of them!

Of course.  According to what you've told it, they are addressed to it.

> The vax became severely loaded from time to time. More seriously, our
> Sun clients had trouble starting up NFS.

Sun UNIX versions before 3.3 have no understanding of subnets, no more
than 4.2BSD does.  This causes headaches.  I would recommend you
upgrade as soon as possible (actually, I'd recommend you get rid of
your Suns, but I don't like them in general).

> It was fairly difficult to find the cause of the problem. The Sun
> clients did not have the netmask specified either, but the Sun
> ifconfig appears to set a reasonable default value.

More likely the Suns don't *have* a netmask.

Another possible problem is broadcast addresses.  The Standard (I
forget the RFC number) specifies that a host number of all 1s is the
broadcast address, eg, 10.65.255.255 on the 10.65.x.x network I
mentioned above.  4.2BSD, and derivatives such as Sun versions before
3.3, were broken: they used a host number of all 0s, eg, 10.65.0.0
(except that they didn't understand subnets either, so they'd use
10.0.0.0).  4.3BSD, by default, does broadcast addresses correctly: it
uses all 1s.

What numbers are you trying to use?

> To sum up: set the netmask explicitly when you use ifconfig.

Set the netmask and the broadcast address, to be safe.

					der Mouse

				(mouse@mcgill-vision.uucp)