[Bug 1389849] [NEW] sudo service lxc-net restart does not reload dnsmasq when there is a container running
Adam Ryczkowski
adam.ryczkowski at statystyka.net
Wed Nov 5 19:54:27 UTC 2014
Public bug reported:
I know, that I can assign static IP manually, using
/etc/network/interfaces.
I also know, that I can read the MAC address of the LXC container (e.g.
by looking for lxc.network.hwaddr entry in /var/lib/lxc/<container-
name>/config and assign the IP based using entries dhcp-host=<mac-
addr>,10.0.3.3 in /etc/dnsmasq.d/<some file>.
In the file /etc/default/lxc-net I read
# Uncomment the next line if you'd like to use a conf-file for the lxcbr0
# dnsmasq. For instance, you can use 'dhcp-host=mail1,10.0.3.100' to have
# container 'mail1' always get ip address 10.0.3.100.
#LXC_DHCP_CONFILE=/etc/lxc/dnsmasq.conf
That would suit my needs; unfortunately doing so has no effect - at
least not until the next computer reboot.
I would expect that `sudo service lxc-net restart` forces the dnsmasq to
reload - unfortunately it never works.
To reproduce:
On Ubuntu Trusty 14.04 64bit,
1. install package lxc,
2. create a container (e.g. sudo lxc-create -n mycontainer -t ubuntu -- -r trusty)
3. start it (sudo lxc-start -d -n mycontainer)
4. create another container (e.g. sudo lxc-create -n my2ndcontainer -t ubuntu -- -r trusty)
5. edit /etc/default/lxc-net to uncomment the LXC_DHCP_CONFILE
6. edit /etc/lxc/dnsmasq.conf to contain a line like `dhcp-host=my2ndcontainer,10.0.3.142`
7. sudo service lxc-net restart
8. start the 2nd container (sudo lxc-start -d -n my2ndcontainer)
The steps 2 and 3 are optional.
The 2nd container never gets the ip 10.0.3.142, but it keeps the
assigned dynamic IP
Walkaround 1:
Turn off the computer and test again tomorrow.
Walkaround 2 (more serious, but works only if steps 2 and 3 are
skipped):
name=my2ndcontainer
sudo lxc-stop -n $name >/dev/null
sudo service lxc-net stop >/dev/null
if [ -d /sys/class/net/$internalif ]; then
sudo brctl delbr $internalif >/dev/null #Why? See below.
fi
sudo rm /var/lib/misc/dnsmasq.$internalif.leases
sudo service lxc-net start >/dev/null
sudo lxc-start -d -n $name >/dev/null
sleep 5
Unfortunately, there is a bug (feature?) in the /etc/init/lxc-net.conf
in Ubuntu 14.04 that prevents reloading the dnsmasq unless the bridge
device is down for the host.
** Affects: lxc (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to lxc in Ubuntu.
https://bugs.launchpad.net/bugs/1389849
Title:
sudo service lxc-net restart does not reload dnsmasq when there is a
container running
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1389849/+subscriptions
More information about the Ubuntu-server-bugs
mailing list