lxc-start-ephemeral keeps same MAC address, and so same IP address, as base instance

Bug #949956 reported by Gary Poster on 2012-03-08
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxc (Ubuntu)
Undecided
Unassigned

Bug Description

As smoser pointed out, lxc-start-ephemeral needs to do the same kinds of things that lxc-clone does, such as this:

# change hwaddrs
mv ${c} ${c}.old
(
while read line; do
 if [ "${line:0:18}" = "lxc.network.hwaddr" ]; then
  echo "lxc.network.hwaddr= 00:16:3e:$(openssl rand -hex 3| sed 's/\(..\)/\1:/g; s/.$//')"
 else
  echo $line
 fi
done
) < ${c}.old > ${c}
rm -f ${c}.old

# set the hostname
cat <<EOF > $rootfs/etc/hostname
$hostname
EOF
# set minimal hosts
cat <<EOF > $rootfs/etc/hosts
127.0.0.1 localhost $hostname
EOF

We have a version that does this, and will propose it.

Related branches

Benji York (benji) wrote :

I've submitted an MP (https://code.launchpad.net/~benji/ubuntu/precise/lxc/bug-949956/+merge/96601) to fix this.

The hostname and /etc/hosts munging is already done in lxc-start-ephemeral (and arguably in a superior way), so I left that part alone.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package lxc - 0.7.5-3ubuntu34

---------------
lxc (0.7.5-3ubuntu34) precise; urgency=low

  [Benji York]
  * lxc-start-ephemeral: create unique MAC for each new
    ephemeral container (LP: #949956)
 -- Scott Moser <email address hidden> Thu, 08 Mar 2012 16:23:49 -0500

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

Other bug subscribers