[SUMMARY]: Re: inconsistent subnet mask : network error

From: Martin Meadows (PZXKYS@atdva3.atd.gmeds.com)
Date: Thu Sep 24 1998 - 08:53:42 CDT


Here's a summary of responses to the question I posted yesterday:

Thanks to the following people who took the time to respond to my question:
Scott, Chris, Ian, Frank, Mark, Marco, Bill, Amaresh, Shriman, Richard,
Dennis, Earl, Steve, Jason, Ken, Andy, Ray and Marcelo! I hope I didn't
miss anyone. The responses were overwhelmingly helpful!

Martin Meadows

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The question/problem:

> Martin Meadows wrote:
>
> Recently, one of our network guys sent the following mail:
>
> " ... could you please investigate any of the following network errors that
> pertain to your equipment ... "
>
> He included the following message:
>
> " ... wta1-11.atd.gmeds.com Inconsistent subnet mask 255.255.0.0 on interface
> 143.242.45.7, should be 255.255.255.0"
>
> Can one of you experts tell me how I can check & change the subnet mask on
> this Sun system? I know how to set it if I'm building the system from
> scratch ... but this system is one I was given and it has been up & running
> for quite a while (we're talking years). I don't understand why the subnet
> mask would suddenly be incorrect!
>
> Thanks,
> Martin Meadows
> EDS @ Indianapolis

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Now, some of the better answers to the question/problem:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

man ifconfig, use ifconfig -a to see all interfaces, then run

ifconfig ethernet_device netmask 255.255.255.0 (or whatever).

For example:

$ ifconfig -a
lo0: flags=849<UP,LOOPBACK,RUNNING,MULTICAST> mtu 8232
        inet 127.0.0.1 netmask ff000000
hme0: flags=863<UP,BROADCAST,NOTRAILERS,RUNNING,MULTICAST> mtu 1500
        inet 207.79.236.4 netmask ffffff00 broadcast 207.79.236.255

To change the netmask from ffffff00 to ffff0000 you would run

ifconfig hme0 netmask 255.255.0.0

Hope this helps.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To check the actual subnet mask use the ifconfig -a command. Look at the
interface with the bad IP address. However you will see this in hex format.
ff=255 00=0 Therefore you should be seeing ffffff00 but you will probably
see ffff0000. To fix this use the /etc/netmasks file. If you can't reboot,
you can also change it by using the ifconfig command; however, I would
recommend rebooting because the /etc/netmasks file is a little tricky and if
you don't have it done correctly, it will not take the netmask and instead
it will take the default netmask for that address class.

If all else fails do a sys-unconfig. This will reboot the machine and ask
you all of the system configuration questions that were asked when you did
an install (Unless you have a machine on your network with bootp
configured.).

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The subnet mask is to some extent can be controlled/set by
the /etc/netmasks file.

I say to some extent, because by default the system wants
to use 255.255.255.0 as the netmask.

If you modify the last line of the /etc/netmasks so that the 2nd
entry on the only executable line to 255.255.0.0, and reboot the
system it will still come up with a netmask of 255.255.255.0
(unless the following change is made or has been made).

To get the system to recognize and use the /etc/netmasks
file the /etc/nsswitch.conf file needs to have its entry for
"netmasks:" set to "files."

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Martin, change it with 'ifconfig le0 netmask 255.255.255.0', add the same
line into your /etc/rc.local before the 'ifconfig -a'. This command and
file assumes a non-Ultrasparc ( le0 device might be hme0 on Ultrasparc), and
asumes SunOS (the startup file would be in /etc/init.d for Solaris).
Before changing it, do a 'ifconfig -a' to check it first.

Or change it on the fly using ifconfig. You ought to at least "ifconfig le0
down" while you're doing this.

The subnet could be suddenly incorrect if the network guys have played about
with the network configuration. For instance, in your case, anything outside
143.242.x.x would have gone to your default gateway before being routed. If
your network has grown considerably and that default gateway is now looking
after the max nodes for the subnet (2^16-2=65534 nodes) it might be getting
hammered. So by changing you to a class C subnet, 255.255.255.0 your default
gateway only has to cater for a few nodes (2^8-2=254).

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can check the subnet mask by doing ifconfig -a and looking at the
interface(s) not labeled lo0, which is the loopback interface. You're probably
looking for le0 or hme0. Anyway, one of the things that will be listed is
netmask, which will be in hex, i.e. ffff0000 instead of 255.255.0.0 .

As for why this is no longer correct, my guess is that the network has been
subnetted, and your machine has not been updated to reflect this. 143.242.45.7
indicates a class B network, for which the netmask of 255.255.0.0 would
normally be fine; however, when you subnet one of these, you need a netmask of
255.255.255.0 to reflect the new setup.

Look in /etc for a file called netmasks. Put the following line in it:

143.242.45.0 255.255.255.0

Also make sure the netmasks file does NOT have an entry starting with
143.242.0.0 , which would assign the wrong netmask (ignoring subnetting).

Then reboot, and you should have the proper netmask. Check with ifconfig -a
again. The new netmask should be ffffff00.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To change the netmask on the fly run the command 'ifconfig le0 netmask
255.255.255.0'. This assumes the system in question uses the Lance
Ethernet interface (le0). See the man page for ifconfig for details.

To change it permanently, edit the file /etc/netmasks to reflect the
correct netmask for the network. This assumes you are not running
NIS. Again, see the ifconfig man page.

P.S. A lot of assumptions aren't there ?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ifconfig -a
( /usr/sbin/ifconfig -a )
will show all interfaces, their status, ipaddress and netmask.

the netmask 255.255.0.0 is the default for the network 143.242.0.0
and so there is no inconsistancy there.

to change it
on the fly
        ifconfig hme0 netmask 255.255.255.0

or for permanaent ( across reboots ) add in /etc/netmasks
        143.242.0.0 255.255.255.0

is this what is required though? what complaines about this,
and what is the real netmask in this case?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can check the netmask in use with ifconfig -a (all interfaces) or
ifconfig hme0 (or le0 or whatever) for a single interface. Then you can
set it with ifconfig -a netmask 255.255.255.0, but this will probably
only last until the next reboot. During reboot the netmask is set in
/etc/rc2.d/S72inetsvc (Solaris) or /etc/rc.local (SunOS 4.1.x). The line
will probably read ifconfig -a netmask + where the + means to set it
from the /etc/netmasks file (or NIS/NIS+ table). Just possibly your
S72inetsvc or rc.local file sets it specifically, but it's more probable
that it was set to the default value for a class B IP address, because
there is no data in the /etc/netmasks file. You should have a line there:

143.242.0.0 255.255.255.0

so that this becomes permanent.

  Why this should have changed? Possible the netmasks file was damaged or
unread for some reason at the last reboot. Also possible is that the
netmask has always been 255.255.0.0, but only recently some other piece of
equipment has started noticing this.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Is it possible that your network administrator changed the mask on the router
interface that this machine is attched to? At any rate, have a look at the
/etc/netmasks file (if this is a Solaris machine). If SunOS you will have to
edit the rc.local (or rc.boot) startup script. Also, if this machine is running
NIS you may need to change it on this NIS server as well.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:12:49 CDT