Libvirt has one defined network, which uses dnsmasq as DHCP/DNS server. But this dnsmasq is a separate instance (config in /var/lib/libvirt/dnsmasq/default.conf), which creates additional dnsmasq processes. I've been using for some time now my own global/system instance of dnsmasq , and I wanted to use it with the libvirt virtual machines. But it looks like it's not an easy task to achieve.

For now I disabled both DNS and DHCP for the default network via removing the following (virsh net-edit default):

  <range start='' end=''/>

and adding this:

<dns enable="no"/>

This of course made libvrt stop creating the additional dnsmasq processes, but what should be added to the system /etc/dnsmasq.conf config file, so the virtual machines got IP addresses via DHCP and be able to access the web using DNS names?

1 Answer 1


I've managed to solve it.

Basically, the problem was in the default network -- it shouldn't be used, or it should be changed. I just created another network (in /etc/libvirt/qemu/networks/host-bridge.xml) with the following content:

  <forward mode="bridge"/>
  <bridge name="virbr0"/>

Then in the virtual machines I change the network they use to this newly created one.

Also the virbr0 bridge was created using the /etc/network/interfaces file:

auto virbr0
iface virbr0 inet static
    bridge_bridgeprio 20
    bridge_ports none
    bridge_stp on
    bridge_waitport 5
    dns-search libvirt

It looks like it works well, but I have to play a little bit with it to see whether it really works the way I wanted it to.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .