Desired behaviour of "ifconfig -alias"
koitsu at FreeBSD.org
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 22.214.171.124 netmask 0xffffffe0 broadcast 126.96.36.199
> > > inet 188.8.131.52 netmask 0xfffffff8 broadcast 184.108.40.206
> > > inet 220.127.116.11 netmask 0xfffffff8 broadcast 18.104.22.168
> > > inet 22.214.171.124 netmask 0xfffffff8 broadcast 126.96.36.199
> > > inet 188.8.131.52 netmask 0xfffffff8 broadcast 184.108.40.206
> > > inet 220.127.116.11 netmask 0xfffffff8 broadcast 18.104.22.168
> > >
> > > > 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 22.214.171.124 netmask 255.255.255.240"
ifconfig_re0_alias0="inet 126.96.36.199 netmask 255.255.255.248"
ifconfig_re0_alias1="inet 188.8.131.52 netmask 255.255.255.255"
ifconfig_re0_alias2="inet 184.108.40.206 netmask 255.255.255.255"
ifconfig_re0_alias3="inet 220.127.116.11 netmask 255.255.255.255"
ifconfig_re0_alias4="inet 18.104.22.168 netmask 255.255.255.255"
My guess is that it's working because your routing table
already has an entry for 22.214.171.124/29 which was created
by the first entry. The remaining aliases on that network
(126.96.36.199/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
> 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 |
More information about the freebsd-stable