I've set up a guest machine on kvm on ubuntu 18.04 (guest is also ubuntu 18.04). I was able to connect to it via ssh and I can see an ip address is assigned to it when I type virsh domifaddr vm1 I see the following output:
Name MAC address Protocol Address ------------------------------------------------------------------------------- vnet0 52:54:00:64:10:51 ipv4 192.168.122.246/24 However, when I clone it with
virt-clone --connect qemu:///system --original vm1 --name vm2 --auto-clone and the start the machine, virsh domifaddr vm2 shows the following output:
Name MAC address Protocol Address ------------------------------------------------------------------------------- So no ip address and I don't even know how to connect to it, although the guest itself shows as "running":
# virsh list --all Id Name State ---------------------------------------------------- 1 vm1 running 2 vm2 running I've checked xml config files for both guests - only difference is mac addresses and names of machines and disks attached. I've even added this mac address and assigned static ip to it in virsh net-edit default:
1 <network> 2 <name>default</name> 3 <uuid>9a270817-c5bc-4571-877a-43b97a5a3e48</uuid> 4 <forward mode='nat'/> 5 <bridge name='virbr0' stp='on' delay='0'/> 6 <mac address='52:54:00:8a:fe:4f'/> 7 <ip address='192.168.122.1' netmask='255.255.255.0'> 8 <dhcp> 9 <range start='192.168.122.2' end='192.168.122.254'/> 10 <host mac='52:54:00:64:10:51' name='vm1' ip='192.168.122.246'/> 11 <host mac='52:54:00:f0:38:6e' name='vm2' ip='192.168.122.247'/> 12 </dhcp> 13 </ip> 14 </network> then restarted everything. Didn't help. What else do I need to do to get an ip address assigned to the cloned guest?
And for the reference, the interface-network section of xml configs for each guest:
vm1 45 <interface type='network'> 46 <mac address='52:54:00:64:10:51'/> 47 <source network='default'/> 48 <model type='virtio'/> 49 <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> 50 </interface> vm2 45 <interface type='network'> 46 <mac address='52:54:00:f0:38:6e'/> 47 <source network='default'/> 48 <model type='virtio'/> 49 <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> 50 </interface> I was also able to connect to vm2 with virsh console vm2 and ifconfig inside it gives me:
~$ ifconfig lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 2184 bytes 191249 (191.2 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 2184 bytes 191249 (191.2 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 Update: I also re-generated machine id in /etc/machine-id /var/lib/dbus/machine-id, changed ssh keys and ran virt-sysprep -d vm2. Then rebooted everything. That didn't help either.
Update 2: running ip a on the host gives this:
5: vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master virbr0 state UNKNOWN group default qlen 1000 link/ether fe:54:00:64:10:51 brd ff:ff:ff:ff:ff:ff inet6 fe80::fc54:ff:fe64:1051/64 scope link valid_lft forever preferred_lft forever 6: vnet1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master virbr0 state UNKNOWN group default qlen 1000 link/ether fe:54:00:f0:38:6e brd ff:ff:ff:ff:ff:ff inet6 fe80::fc54:ff:fef0:386e/64 scope link valid_lft forever preferred_lft forever which corresponds to both VMs mac addresses.
virsh dumpxmljust shows what I'd see anyway fromvirsh edit vm2. Nothing there.