Bugzilla – Bug 883
debian-{add,del}_ip.sh to use ip util (debian >=5 only?)
Last modified: 2011-05-04 10:22:14 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
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 :).
This belongs to vzctl
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...
So is it a bug or not? :)
(there is no output in dmesg)
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
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.
Created attachment 902 [details] fix to use /sbin/ip (from iproute2) to add IP addresses, instead of aliases
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.
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.
Apparently the Debian 4.0 template doesn't have iproute2 by default.
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.
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?
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?
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.