Desired behaviour of "ifconfig -alias"
fcash at ocis.net
Tue Feb 13 18:55:54 UTC 2007
On Tuesday 13 February 2007 10:37 am, Oliver Fromme wrote:
> Freddie Cash wrote:
> > For a set of IPs in the same subnet on the same interface, wouldn't
> > the primary IP be the one with the proper netmask, and all IPs with
> > netmasks of /32 be secondary?
> That's historic. :-) Old versions of FreeBSD indeed
> required the netmask of the "aliases" to be /32 in that
> case. But it's no longer the case.
Hmmm, if this is the case, then the man page for ifconfig(8) is
out-of-date wrt this as well:
alias Establish an additional network address for this interface. This
is sometimes useful when changing network numbers, and one wishes
to accept packets addressed to the old interface. If the address
is on the same subnet as the first network address for this
interface, a non-conflicting netmask must be given. Usually
0xffffffff is most appropriate.
> # ifconfig re0
> re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
> inet 220.127.116.11 netmask 0xffffffe0 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
> inet 22.214.171.124 netmask 0xfffffff8 broadcast 126.96.36.199
> inet 188.8.131.52 netmask 0xfffffff8 broadcast 184.108.40.206
> > 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. I'm talking about a
situation where one IP on the interface has a /24 netmask, and all the
other IPs on the interface have /32 netmasks. Would removing the IP with
a /24 netmask cause connection issues for the other IPs on that
I don't have access to a test box at the moment (that's at home) to check.
> As for outgoing connections: It is true that the kernel
> picks a random matching IP address to be the source IP,
> which happens to be the first one, but that's just as
> coincidence as "-alias" picking the first one if none
> is given. ;-)
Is it a coincidence, though? If you add the following IPs to an
Then remove x.x.x.2, and re-add it as x.x.x.2/24 so it appears at the
bottom of the list of IPs, what IP is used for outgoing connections?
My gut tells me it'll be x.x.x.2, but I'll have to check that when I get
fcash at ocis.net
More information about the freebsd-stable