Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Dec 2001 15:32:06 -0800
From:      Darren Pilgrim <dmp@pantherdragon.org>
To:        Ceri <setantae@submonkey.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Aliases don't get /32 netmask by default?
Message-ID:  <3C1BDD76.71CC21D@pantherdragon.org>
References:  <3C1B816C.74115797@pantherdragon.org> <20011215201502.GA2292@rhadamanth>

next in thread | previous in thread | raw e-mail | index | archive | help
Ceri wrote:
> On Sat, Dec 15, 2001 at 08:59:24AM -0800, Darren Pilgrim wrote:
> > I noticed that rc.network doesn't give alias addresses 32-bit netmasks
> > by default.  This puzzles me, as alias addresses don't seem to work
> > completely unless the netmask is 32 bits.  Is there a reason why a
> > 32-bit netmask isn't automatically/forcibly added to an alias when
> > being added?
> 
> It's only aliases on the same subnet as an address already assigned to the
> interface that need the netmask set to /32.
> 
> For instance, this is fine :
> 
> setantae@shaft setantae$ grep ifconfig /etc/rc.conf
> ifconfig_ed0="inet 212.250.77.214 netmask 255.255.255.224"
> ifconfig_ed0_alias0="inet 172.17.77.214 netmask 255.255.255.0"
> 
> Only if I wanted to add another address on the 212.250.77.192/27 or
> 172.17.77.0/24 networks would the netmask be set to /32.

That's just it, though, ifconfig doesn't assign /32 to alias IPs that
are in an existing subnet.  You have to specify the /32 netmask for
same-subnet aliases.

If you do:
# ifconfig fxp0 inet 10.0.0.1 netmask 0xffffff00
# ifconfig fxp0 alias 10.0.0.2

Then you'll get:

fxp0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        inet 10.0.0.1 netmask 0xffffff00 broadcast 10.0.0.255
        inet 10.0.0.2 netmask 0xff000000 broadcast 10.255.255.255

Which shows that ifconfig is doing classful netmasking on aliases that
don't have explicit netmasks, even when there's already sufficient
information in the existing assignment to determine the appropriate
netmask.

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?3C1BDD76.71CC21D>