Hello there,
I wanted to share a problem I'm having with libvirt, for the case someone here could know how to solve it.
I'm using an Ubuntu 18.04 LTS, I have libvirtd already installed and I think I got all the dependencies installed. So, I'm using virsh net-create to create this network:
<network>
<name>pepito</name>
<forward mode='nat'/>
<bridge name='virbr2' stp='on' delay='0'/>
<ip address='192.168.150.1' netmask='255.255.255.0'>
<dhcp>
<range start='192.168.150.2' end='192.168.150.254'/>
</dhcp>
</ip>
</network>
And then I create a domain with this xml:
<domain type='qemu' xmlns:qemu='
http://libvirt.org/schemas/domain/qemu/1.0'>
<name>ARM</name>
<memory unit='KiB'>262144</memory>
<currentMemory unit='KiB'>262144</currentMemory>
<os>
<type arch='armv7l' machine='virt-2.9'>hvm</type>
<kernel>~/zImage</kernel>
<cmdline>console=ttyAMA0 root=/dev/vda</cmdline>
<boot dev='hd'/>
</os>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-aarch64</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='
~/rootfs.qcow2'/>
<target dev='hda' bus='virtio'/>
</disk>
<controller type='virtio-serial' index='0'>
<address type='virtio-mmio'/>
</controller>
<interface type='network'>
<mac address='52:54:00:09:a4:37'/>
<model type='virtio'/>
<source network='pepito'/>
<address type='virtio-mmio'/>
</interface>
</devices>
<qemu:commandline>
<qemu:arg value='-device'/>
<qemu:arg value='virtio-net-pci'/>
<qemu:arg value='-netdev'/>
<qemu:arg value='user,id=net1'/>
</qemu:commandline>
</domain>
They both work as I created them in a different computer and everything works. But I'm trying it on my other Ubuntu machine, and once virsh creates the network and the domain, my VM never get an IP from that DHCP range. This is libvirtd log:
abr 17 00:48:11 usuario-System-Product-Name dnsmasq-dhcp[13741]: DHCP, IP range 192.168.150.2 -- 192.168.150.254, lease time 1h
abr 17 00:48:11 usuario-System-Product-Name dnsmasq-dhcp[13741]: DHCP, sockets bound exclusively to interface virbr2
abr 17 00:48:11 usuario-System-Product-Name dnsmasq[13741]: reading /etc/resolv.conf
abr 17 00:48:11 usuario-System-Product-Name dnsmasq[13741]: using nameserver 127.0.0.53#53
abr 17 00:48:11 usuario-System-Product-Name dnsmasq[13741]: read /etc/hosts - 7 addresses
abr 17 00:48:11 usuario-System-Product-Name dnsmasq[13741]: read /var/lib/libvirt/dnsmasq/pepito.addnhosts - 0 addresses
abr 17 00:48:11 usuario-System-Product-Name dnsmasq-dhcp[13741]: read /var/lib/libvirt/dnsmasq/pepito.hostsfile
Does anybody know why it could be that the VM never gets an IP from the range I defined? As I said, exactly the same configuration worked in a different machine, I don't know why it does not work here.
Thank you so much!!