Hello,
I am trying to boot a VM in libvirt that has 2 interfaces. The first
interface is connected to the default network and the second connects to a
bridge interface on the host. When the VM boots the first interface doesn't
receive an IP address from DHCP. It works when the VM only has one
interface though.
If I login to the VM using virsh console I noticed that in NetworkManager
the connection name and device are mixed
[root@localhost ~]# nmcli con show
NAME UUID TYPE DEVICE
eth0 cc31f368-0a43-4c85-bd15-6aaa3ca23b3d ethernet eth1
If I run 'dhclient eth0' the interface gets an IP address from the default
network as expected.
[root@localhost ~]# dhclient eth0
[root@localhost ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group
default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state
UP group default qlen 1000
link/ether 52:54:00:00:01:00 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.10/24 brd 192.168.122.255 scope global dynamic eth0
valid_lft 3599sec preferred_lft 3599sec
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state
UP group default qlen 1000
link/ether 52:54:00:48:e3:b8 brd ff:ff:ff:ff:ff:ff
inet6 fe80::5054:ff:fe48:e3b8/64 scope link noprefixroute
valid_lft forever preferred_lft forever
The VM is created using the following command
virt-install --import --name ${VM_HOST_NAME} \
--memory 2048 --vcpus 2 --cpu host \
--disk
path=/var/lib/libvirt/images/${VM_HOST_NAME}.qcow2,format=qcow2,bus=virtio \
--network network=default \
--network bridge=bridge0,model=virtio \
--os-type=linux \
--os-variant=rhel7.6 \
--graphics none
Any ideas what could cause this problem? The guest OS is CentOS 7.7 and the
host is CentOS 8, but I have the same problem with a CentOS 7 hypervisor.