Summary: non octet netmasks

From: Alastair Young (
Date: Fri Feb 22 1991 - 11:54:35 CST

Original enquiry:

> I remember simething flew past a few weeks ago on the topic of using subnet
> masks other than 16 or 24 bit. If anyone out there has the summary I would
> be grateful if they would send me it. We are contemplating this and it always
> helps to know the traps in advance.

I received 3 responses, one said:

From: Todd Pfaff <>

I've tried using a netmask of 4 bits on our subnet, but anything other than
a multiple of 8 seems to be coerced to the 8 bit boundary.

Another said:

From: Tom Conroy <>

Netmasks are not required to exist on byte boundaries.

In order to have 10 bits of host address space, we are currently using
a netmask of 0xfffffc00 ( on our class B network. We are
also subnetting a few class C networks for router testing, but I will
save that story for another time ...

In a class B network "aaa.bbb.0.0", this would give such subnets as
that composed of all addresses between aaa.bbb.16.0 - aaa.bbb.19.255
or aaa.bbb.64.0 - aaa.bbb.67.255 or aaa.bbb.68.0 - aaa.bbb.71.255.
On SunOS 4.0 and higher, the "all ones" broadcast address above must be
set explicitly.

As far as pitfalls, I know of none - this is a really "normal"
thing to do.

Totally conflicting n'est pas? Then I got:

From: Steve Jay <>

We are using a 25 bit netmask here (0xffffff80 or We
have found a few bugs, including one nasty one in routed which prevented
things from working at all. We fixed routed by building a new version
from the BSD Tahoe source code, including a 1 line fix to the source to
make it handle netmasks correctly.

Routed also has a bug that causes it to mishandle network names that
translate into 25 bit network numbers with the low order bit set when
they appear in the /etc/gateways file, but that's a relatively little
used feature. You can get around it by specifying the network by number
rather than name in /etc/gateways.

"netstat -r" displays the number, rather than name, of a network with
the low order bit of the network number set, if the network number is
> 24 bits.

I think all of these problems occur only with netmasks > 24 bits. Most
of them happen because of the way the inet_*() routines work. They basically
don't work for network numbers > 24 bits.

After we fixed routed, our 25 bit netmask seems to be working ok on a
network with Sun's, SGI's, Convex, IBM MVS, IBM VM, IBM 370/AIX,
IBM RS6000, and PC-NFS.

I don't know of any problems if you use a 17 - 23 bit netmask.

It therefore appears that you get problems if you use a netmask greater that
24 bits and that this is a bug. Todd Pfaff's problem is unclear to me, but I
think it may be related to a problem which I have encountered myself relating
to the ifconfig command in the Sun rc.local file. This sometimes says:

ifconfig le0 netmask +

whereas it should say:

ifconfig le0 `hostname` netmask +

The former fails to set the broadcast in line with the new netmask.

As we were looking at a 20 bit netmask we ought to be ok. If anyone has any
more knowledge on this topic it would be very welcome.

Alastair Young
Systems Supervisor

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:11 CDT