Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Feb 2003 20:23:19 +0200
From:      Willie Viljoen <will@unfoldings.net>
To:        Mark <admin@asarian-host.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Netmasks for aliases (was Re: Bizarre Networking Problem)
Message-ID:  <200302212023.19708.will@unfoldings.net>
In-Reply-To: <200302211717.H1LHHH4X003458@asarian-host.net>
References:  <27.39e39215.2b869c70@aol.com> <20030221105259.Y87091@pcjfn.msc.com> <200302211717.H1LHHH4X003458@asarian-host.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Friday 21 February 2003 19:17, Mark wrote:
> >
> > /sbin/ifconfig xl0 192.246.38.10 netmask 255.255.255.0
> > /sbin/ifconfig xl0 alias 208.23.240.10 netmask 255.255.255.0
>
> Hmm, I thought aliases always needed to have netmask of 255.255.255.255.
> Has something changed?
>
> - Mark

Mark,

Aliases on the same subnet should always be 255.255.255.255, this does not 
apply where they are on different subnets, however. Here is a good example, 
from the ifconfig output of a mail server I set up at an ISP in a nearby 
town. They used to use a private range, but have since added a public class 
C which has been broken up into smaller ranges for routing. 

The mail server, for legacy reasons, still has to serve people on the old 
IPs because those are still being used by machines in their office, and 
reconfiguring every office machine with new server IP addresses (they 
didn't have internal DNS then) would be wasting time. We didn't want to 
waste public IPs on beancounters, so we just left their machines as is. 

The host is also serving on the new IP, and acting as a POP server for 
several virtual domains, which have aliases. The 10.0.1.0/24 range (their 
office), and the 196.38.113.0/27 range (used for their server farm + 
virtual domains) are still the same physical network though. The output 
from ifconfig follows:

%ifconfig
dc0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        inet 196.38.113.2 netmask 0xffffffe0 broadcast 196.38.113.31
        inet6 fe80::a00:8ff:fe00:800%dc0 prefixlen 64 scopeid 0x1
        inet 196.38.113.3 netmask 0xffffffff broadcast 196.38.113.3
        inet 196.38.113.5 netmask 0xffffffff broadcast 196.38.113.5
        inet 196.38.113.6 netmask 0xffffffff broadcast 196.38.113.6
        inet 196.38.113.7 netmask 0xffffffff broadcast 196.38.113.7
        inet 196.38.113.8 netmask 0xffffffff broadcast 196.38.113.8
        inet 196.38.113.9 netmask 0xffffffff broadcast 196.38.113.9
        inet 196.38.113.10 netmask 0xffffffff broadcast 196.38.113.10
        inet 196.38.113.11 netmask 0xffffffff broadcast 196.38.113.11
        inet 10.0.1.4 netmask 0xffffff00 broadcast 10.0.1.255
        inet 10.0.1.5 netmask 0xffffffff broadcast 10.0.1.5
        ether 08:00:08:00:08:00
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
        inet 127.0.0.1 netmask 0xff000000

Note how 196.38.113.2 (the machine's real address) has a netmask of 
0xffffffe0, or 255.255.255.224, and the other addresses in this range (all 
of them aliases) have 0xffffffff, 255.255.255.255. Then look at 10.0.1.4, 
which is an alias too. It has a netmask of 0xffffff00, or 255.255.255.0. 
Now look at 10.0.1.5, an alias used for serving intranet web content to 
legacy machines. Again, a netmask of 0xffffffff. 

The reason for this is that 10.0.1.4, even though being an alias, is the 
first address the machine handles on that subnet. Just as 196.38.113.2 is 
the first address the machine has on the public subnet.

Rule of thumb: First address on a subnet, alias or not, has the proper 
subnet netmask. Every other address on the subnet following that, has 
0xffffffff, or 255.255.255.255.

Will

>
>
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message

-- 
Willie Viljoen
Freelance IT Consultant

214 Paul Kruger Avenue, Universitas
Bloemfontein
9321
South Africa

+27 51 522 15 60
+27 51 522 44 36 (after hours)
+27 82 404 03 27 (mobile)

will@unfoldings.net

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200302212023.19708.will>