I am running CentOS 7 and trying to create a libvirt LXC CentOS 7 container. I am able to create the CentOS 7 container and then boot into it fine. I then need to run:
Code: Select all
nmcli connection delete eth0
nmcli connection add type ethernet ifname eth0 con-name eth0
The network interface works fine after that. When I shut down the container and start it back up, there are two eth0 connections, and only one of them is linked to the eth0 device. Unfortunately, the connection profile that is linked to the eth0 device is a new connection profile, not the one I created in the previous session inside the container. If I run
, both eth0 connection profiles will be deleted. Then I can run
Code: Select all
nmcli connection add type ethernet ifname eth0 con-name eth0
and networking functions again in the container. I also noticed the MAC address of the eth0 device inside the container changes every time the container is booted up. Additionally, I noticed that running
reveals a different IFINDEX each time the container boots.
Here is what I am using for the interface block in the libvirt XML configuration for the domain:
Code: Select all
<interface type='bridge'>
<mac address='52:54:00:df:d0:ae'/>
<source bridge='br0'/>
</interface>
Here is how I created the libvirt LXC domain with CentOS 7:
Code: Select all
yum -y --installroot=/var/lib/libvirt/filesystems/mycentos7 --releasever=7 group install "Virtualization Host"
echo "pts/0" >> /var/lib/libvirt/filesystems/mycentos7/etc/securetty
chroot /var/lib/libvirt/filesystems/mycentos7 /bin/passwd root
virt-install --connect lxc:// --name mycentos7 --ram 1024 --network="bridge=br0" --filesystem /var/lib/libvirt/filesystems/mycentos7,/
Does anyone know how I can get the Ethernet interface inside the container to have a stable MAC address and bind to the same connection profile in order to avoid the problem of a new connection profile being generated at each boot?