[libvirt-users] Changing dnsmasq DNS settings for virtual machines

Laine Stump laine at laine.org
Mon Apr 14 09:23:19 UTC 2014

On 04/13/2014 10:23 PM, Johannes Kastl wrote:
> Hash: SHA1
> Hi Laine,
> thanks for the answer.
> On 13.04.14 16:13 Laine Stump wrote:
>> There is no provision for that. If you want additional hosts to be
>> known by the libvcirt instance of dnsmasq, you must enter them into
>> the xml.
> I can set the addn-hosts in the .conf file in
> /var/lib/libvirt/dnsmasq/<nameofthenetwork>.conf.

Yes, you can change that file, but:

1) the location and contents of that file are not a part of the official
libvirt API, and are subject to change at any time,

2) The file is only read by dnsmasq immediately after it has been
created, when dnsmasq first starts.

3) dnsmasq runs as user nobody, so it isn't even possible to force it to
reread that file by sending a SIGHUP.

So, changing the contents of the conf file does you no good (or at least
it *shouldn't* do you any good)

> I was just not sure if this gets overwritten, each time I change a
> setting in the network's xml (virsh net-edit ...).

It is rewritten from scratch based on the network's config each time you
re-start the network.

More information about the libvirt-users mailing list