Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Feb 2007 13:32:19 -0800
From:      Jeremy Chadwick <koitsu@FreeBSD.org>
To:        freebsd-stable@FreeBSD.ORG, fcash@ocis.net
Subject:   Re: Desired behaviour of "ifconfig -alias"
Message-ID:  <20070213213219.GA72359@icarus.home.lan>
In-Reply-To: <200702132036.l1DKaP0f022622@lurza.secnetix.de>
References:  <200702131055.41407.fcash@ocis.net> <200702132036.l1DKaP0f022622@lurza.secnetix.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Feb 13, 2007 at 09:36:25PM +0100, Oliver Fromme wrote:
>  > > # ifconfig re0
>  > > re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
>  > >         options=1b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING>
>  > >         inet 88.198.44.136 netmask 0xffffffe0 broadcast 88.198.44.159
>  > >         inet 88.198.173.154 netmask 0xfffffff8 broadcast 88.198.173.159
>  > >         inet 88.198.173.155 netmask 0xfffffff8 broadcast 88.198.173.159
>  > >         inet 88.198.173.156 netmask 0xfffffff8 broadcast 88.198.173.159
>  > >         inet 88.198.173.157 netmask 0xfffffff8 broadcast 88.198.173.159
>  > >         inet 88.198.173.158 netmask 0xfffffff8 broadcast 88.198.173.159
>  > > 
>  > > > In that situation, wouldn't deleting the primary IP
>  > > > cause connection issues for the rest of the IPs?
>  > > 
>  > > No.  I can delete _any_ of the above IP addresses, and the
>  > > others would still work perfectly fine.  I already did
>  > > things like that (on a different machine).
>  > 
>  > Yes, but each of the IPs is on their own subnet.
> 
> No, please look closer.  The addresses above are all in the
> same subnet (except for the first one).  It's a /29 subnet
> in this case, but it works exactly the same with /24 or any
> other subnet masks.

Your configuration looks incorrect.  How or why it's working is
proof that the implementation (read: source code) differs from
what some of the docs state.  My guess is that it's working
because you already have 

AFAIK, it should be (note alias entries 2,3,4):

ifconfig_re0="inet 88.198.44.136 netmask 255.255.255.240"
ifconfig_re0_alias0="inet 88.198.173.154 netmask 255.255.255.248"
ifconfig_re0_alias1="inet 88.198.173.155 netmask 255.255.255.255"
ifconfig_re0_alias2="inet 88.198.173.156 netmask 255.255.255.255"
ifconfig_re0_alias3="inet 88.198.173.157 netmask 255.255.255.255"
ifconfig_re0_alias4="inet 88.198.173.158 netmask 255.255.255.255"

My guess is that it's working because your routing table
already has an entry for 88.198.173.154/29 which was created
by the first entry.  The remaining aliases on that network
(88.198.173.154/29) utilise that, but should really have
netmasks with all 1s.

ifconfig(8) states you should use 255.255.255.255/0xffffffff
(all 1s) for IP aliases.

The FreeBSD Handbook documents everything I've said quite
clearly:

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/configtuning-virtual-hosts.html

> As I said, I would have to try that because I haven't used
> the /32 netmask hack for quite some time.  I think it would
> indeed use the first address, i.e. x.x.x.2.

As far as I know it's not a hack.  If it is/was a hack, can
you explain the functional difference between IP aliases
with a 0xffffffff netmask vs. mixed-set-bits, and point to
some past references stating the difference?

-- 
| Jeremy Chadwick                                 jdc at parodius.com |
| Parodius Networking                        http://www.parodius.com/ |
| UNIX Systems Administrator                   Mountain View, CA, USA |
| Making life hard for others since 1977.               PGP: 4BD6C0CB |




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