Desired behaviour of "ifconfig -alias"

Jeremy Chadwick koitsu at
Tue Feb 13 21:32:41 UTC 2007

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 netmask 0xffffffe0 broadcast
>  > >         inet netmask 0xfffffff8 broadcast
>  > >         inet netmask 0xfffffff8 broadcast
>  > >         inet netmask 0xfffffff8 broadcast
>  > >         inet netmask 0xfffffff8 broadcast
>  > >         inet netmask 0xfffffff8 broadcast
>  > > 
>  > > > 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 netmask"
ifconfig_re0_alias0="inet netmask"
ifconfig_re0_alias1="inet netmask"
ifconfig_re0_alias2="inet netmask"
ifconfig_re0_alias3="inet netmask"
ifconfig_re0_alias4="inet netmask"

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

ifconfig(8) states you should use
(all 1s) for IP aliases.

The FreeBSD Handbook documents everything I've said quite

> 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 Networking               |
| UNIX Systems Administrator                   Mountain View, CA, USA |
| Making life hard for others since 1977.               PGP: 4BD6C0CB |

More information about the freebsd-stable mailing list