Bug 883 - debian-{add,del}_ip.sh to use ip util (debian >=5 only?)
: debian-{add,del}_ip.sh to use ip util (debian >=5 only?)
Status: RESOLVED FIXED
Product: OpenVZ
vzctl
: rhel5-2.6.18_028stabXXX
: Other Other
: P2 normal
Assigned To: Igor Sukhih
:
:
:
  Show dependency treegraph
 
Reported: 2008-05-06 11:59 EDT by Jergen Dutch
Modified: 2011-05-04 10:22 EDT (History)
6 users (show)

See Also:


Attachments
fix to use /sbin/ip (from iproute2) to add IP addresses, instead of aliases (405 bytes, patch)
2009-02-10 09:18 EST, Chris Wilson
Details | Diff
More invasive patch to clean up debian-add_ip.sh (1.50 KB, patch)
2009-02-10 11:50 EST, Chris Wilson
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jergen Dutch 2008-05-06 11:59:08 EDT
Adding an ip address to a CT should create a venet0 device.
Unfortunately the official debian ip add script creates a venet0:0 device
instead. This is messy.

A possible fixed script is shown here:
http://forum.openvz.org/index.php?t=msg&goto=4378
Comment 1 Jergen Dutch 2008-05-06 12:14:13 EDT
This might be design, and so not a bug (but I can't see why, and the wiki
doesn't say why either, so it must be a bug :).
Comment 2 Kir Kolyshkin 2008-05-07 02:29:41 EDT
This belongs to vzctl
Comment 3 Henk van de Kamer 2008-05-07 03:25:22 EDT
The mentioned fix is by me :-). I've never reported it as a bug, but instead
asked in the forum if there was a reason for it. If there is, then it is not a
bug. If there is no reason it is. However I never got an answer.

I know that other people are using my OpenVZ related fixes, additions etc. and
nobody ran into trouble with this one. So I think that I can safely say it is
not nescessary and that my proposed fix is working for me and some others...
Comment 4 Jergen Dutch 2008-05-07 04:59:41 EDT
So is it a bug or not? :)
Comment 5 Jergen Dutch 2008-05-13 02:59:56 EDT
(there is no output in dmesg)
Comment 6 andylockran 2008-09-18 08:13:01 EDT
Although not a bug necessarily, there are a few scripts which I use (such as
smbldaptools, which don't recognise an interface with a : in it.

It's easily changed, but created a venet0 by default would save jumping through
extra hoops.

Andy
Comment 7 Chris Wilson 2009-02-10 09:14:33 EST
I believe that this is a bug, although only in interaction with some distro
networking scripts.

For example, we have an Ubuntu vserver configured to mount /home in /etc/fstab.
Ubuntu actually does this from /etc/network/if-up.d/mountnfs, which runs after
the main interface (venet0) comes up. Unfortunately the alias is not up yet, so
the server has no IP address, so the mount hangs for a very long time. Booting
the context takes about two minutes in this case.

I fixed it in a different way, by adding a line like this:

  up ip addr add dev ${VENET_DEV} ${ip}

for each IP address, instead of an alias. This is more efficient in my view,
avoids the aliases entirely and solves the problem for me. Patch attached.
Comment 8 Chris Wilson 2009-02-10 09:18:02 EST
Created attachment 902 [details]
fix to use /sbin/ip (from iproute2) to add IP addresses, instead of aliases
Comment 9 Kir Kolyshkin 2009-02-10 11:34:48 EST
I'd like to go ahead with your approach, but first two questions:

1. Are you sure that this is complete fix? Don't we also need to drop
get_free_aliasid() and $IFNUM/$ifnum?

2. Does Debian 3.1 templates have /sbin/ip? If not we should provide two cases
-- with and without using /sbin/ip, for different distros.
Comment 10 Chris Wilson 2009-02-10 11:50:01 EST
Created attachment 904 [details]
More invasive patch to clean up debian-add_ip.sh

I'm afraid I'm not too familiar with the scripts, I only started using openvz
yesterday. I hacked the script just enough so that it worked for me. I'm sure
there are parts left redundant by this approach that can be taken out.

It appears that "ifconfig add" can be used multiple times with the same parent
device, so the alias is not necessary in the ipv6 case either. I think that
means that the attached patch should work, although I haven't tested it.

As to whether the debian 3.1 template includes iproute2, I'm afraid I don't
know how to tell you that. I've only tested this on an ubuntu dapper drake VM.
If you can tell me how, then I'll find out if it does.
Comment 11 Chris Wilson 2009-02-10 12:37:12 EST
Apparently the Debian 4.0 template doesn't have iproute2 by default.
Comment 12 Benoit Branciard 2009-06-15 07:06:28 EDT
The proposed patch http://bugzilla.openvz.org/attachment.cgi?id=904 does not
work in Sarge (Debian 3.1) containers, since the "manual" method for interface
configuration does not exists in this version.

So either a version-specific script should be created, or another fix should be
proposed.
Comment 13 Chris Wilson 2009-06-26 10:40:42 EDT
The patch does not use the "manual" method of interface configuration as far as
I can see. It continues to use the "static" method as before. So how exactly
does it not work on Sarge?
Comment 14 Kir Kolyshkin 2009-10-16 09:16:33 EDT
Can someone test this last patch for Debian 3.1 and if this is a problem maybe
it makes sense to create a separate script for 3.1?
Comment 15 Kir Kolyshkin 2011-05-04 10:22:14 EDT
OK we did a lot of work on Debian net scripts lately. See bugs #1802, #1792,
#1669. It should work fine now for Debian 3.1, 4, 5, and 6, for both IPv4 and
v6 addresses.

Consider this one as fixed. Feel free to reopen though.