Make lxc-debian use persistent hwaddr

Bug #1080681 reported by Enrique
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
lxc (Ubuntu)
Fix Released
Wishlist
Unassigned

Bug Description

 Hi have several Ubuntu and Debian machines running in a host and for all the Ubuntu machines the IPv4 address they receive is always the same, and it is actually the one stated in the config file under lxc.network.ipv4.
 However, for the Debian machines, although the configuration file specifies a given lxc.network.ipv4, they get a different IPv4 address every time they reboot, ignoring the lxc.network.ipv4 property.

 To reproduce, just create a Debian container using lxc-debian template:
 # SUITE=stable lxc-create -t debian -n my_debian

 Then, reboot the container several times, and each of them the IPv4 address will be different. Note that restarting networking in the guest (/etc/init.d/networking restart) does indeed return the same address.

 I am using lxc 0.7.5-3ubuntu65 under Ubuntu 12.04 as a host and both Debian stable and testing guests show the problem.

Related branches

Changed in lxc (Ubuntu):
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Enrique (enrique-garcia) wrote :

 I think that I found a workaround that solves part of the problem, editing the config file and adding the following line:
lxc.network.hwaddr = aa:aa:aa:aa:aa:aa

 In that way the ipv4 address is kept through reboots. However it is still not the same one stated under lxc.network.ipv4.

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

@Enrique,

near as i can tell this turns out to be not an lxc issue (unless we want the template to be more invasive than it already is).

In Ubuntu it looks like ifup simply is smart enough to not follow through with dhcp if the nic is already up with an address. In debian, not.

If you want the debian containers to not run dhcp, then you need to edit /etc/network/interfaces to tell ifupdown not to run dhcp on the devices. As I say the lxc debian template could look for a lxc.network.ipv4 entry in the provided lxc.conf and, if present, edit the container's /etc/network/interfaces to make that happen. But it's interesting that the ubuntu template doesn't do that.

Changed in lxc (Ubuntu):
status: Confirmed → Triaged
importance: Medium → Wishlist
summary: - debian guests get different IPv4 at every reboot
+ Make lxc-debian use persistent hwaddr
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package lxc - 0.9.0-0ubuntu15

---------------
lxc (0.9.0-0ubuntu15) saucy; urgency=low

  * lxc-net: support an optional dnsmasq configuration file.
  * 0010-debian-template-set-hwaddr: set persistent macaddr when creating a
    debian container (LP: #1080681)
  * lxc.apport: add /etc/lxc/{dnsmasq,default,lxc}.conf and
    /etc/default/lxc{,-net}.conf
 -- Serge Hallyn <email address hidden> Tue, 11 Jun 2013 07:47:32 -0500

Changed in lxc (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.