From: Serge Hallyn <[email protected]> Since we are creating a new container it should not share a macaddr with the original container.
Signed-off-by: Serge Hallyn <[email protected]> --- src/lxc/lxc-clone.in | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/lxc/lxc-clone.in b/src/lxc/lxc-clone.in index 386be30..228fd0d 100644 --- a/src/lxc/lxc-clone.in +++ b/src/lxc/lxc-clone.in @@ -263,6 +263,20 @@ if [ -f $rootfs/etc/dhcp/dhclient.conf ]; then sed -i "s/send host-name.*$/send host-name \"$hostname\";/" $rootfs/etc/dhcp/dhclient.conf fi +c=$lxc_path/$lxc_new/config +# 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 -- 1.7.9.5 ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Lxc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/lxc-users
