[Bug 351378] Re: dhclient fails for virtual interfaces (IP aliases)

Tom Metro tmetro+ubuntu at gmail.com
Fri Apr 3 07:20:37 BST 2009


Bryan McLellan  wrote:
> These two errors are because dhclient-script does not support alias interfaces. 

That may be partly right. I see /sbin/dhclient-script contains the
comment:

# The alias handling in here probably still sucks. -mdz

and there's clearly evidence that it is attempting to support virtual
interfaces:

        if [ -n "$alias_ip_address" ]; then

But real problem seems to be that the script contains lines like:

        ifconfig $interface inet 0 up

and the current version of ifconfig spits out those errors when a
virtual interface is set to a zero IP address. The evidence suggests
that this worked at one time. In fact, multiple DHCP packages seem to
expect this operation to work. I recently tried udhcpc and got familiar
results:

# udhcpc --hostname=indianpoint --interface=eth0:0 --pidfile=/var/run/udhcpc.eth0:0.pid
udhcpc (v0.9.9-pre) started
SIOCSIFFLAGS: Cannot assign requested address
Sending discover...
Sending select for 192.168.0.235...
Lease of 192.168.0.235 obtained, lease time -1
Resetting default routes
adding dns 192.168.0.35

In this case the error is triggered when udhcpc tries to "deconfigure"
the interface before it configures it, but it happily ignores the error.

I'm wondering if one workaround might be to modify the scripts to do:
    ifconfig $interface down
if $interface is virtual. (It seems dhclient-script already contains code to detect virtual interfaces.) I presume there is a reason why "deconfiguring" an interface is normally performed instead of downing it. (I'm guessing it might make a difference if you were running other networking protocols in addition to IP.) The distinction may be irrelevant for a virtual interface, or just for the vast majority of use cases.

Running:
ip addr del $IP dev eth0:0

seems to work too, but has the effect of bringing down the virtual
interface and you need extra code to obtain the current IP address
(passing in a zero does nothing).

Before a permanent fix can be determined, it needs to be understood
whether this represents a bug in ifconfig, or an intentional change in
its behavior. I'm thinking of opening up a ticket against ifconfig that
this bug can be dependent on.


> If you don't use this script, those errors go away.

But is that a practical option? Doesn't the script provide a pile of
needed glue?

Patching the script seems more viable.


> I can't find any mention in the source of supporting virtual/alias interfaces...

The code in dhclient-script is enough to convince me that it was the
intention to support virtual interfaces. I'm pretty sure I've read
reports that they used to work prior to Ubuntu 8.04.


> I did test and confirm that dhcpcd=1:3.2.3-1.1 does work on alias interfaces on intrepid.

Is it a drop-in replacement that works with the rest of the existing
infrastructure in Ubuntu, like /etc/network/interfaces?

My next step was going to be using the 'up' argument in an interface
stanza for a physical interface to call udhcpc to configure a virtual
interface. It looks like this will work, but using something that works
with the normal documented way of declaring virtual interfaces in
/etc/network/interfaces is preferable.

-- 
dhclient fails for virtual interfaces (IP aliases)
https://bugs.launchpad.net/bugs/351378
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to dhcp3 in ubuntu.



More information about the Ubuntu-server-bugs mailing list