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

Johannes Kastl mail at ojkastl.de
Sun Apr 6 05:33:39 UTC 2014

Hash: SHA1

Hi everyone,

maybe this is an old fart, but I cant get it to work.

I am running libvirt on a laptop, where a dnsmasq is already running
to delegate dns info for my local (not-public) network. My resolv.conf
(on the host) lists the system-dnsmasq as first server.

I had to set the listen-adress for the system-dnsmasq to and
set bind-interfaces, to stop if from binding to all interfaces and
overriding the libvirtd-dnsmasq, which also has dhcp enabled.

Now, how can I tell the libvirtd-dnsmasq, to use the system-dnsmasq as
first nameserver?

I found lots of pages when searching for "libvirt dns", but all of
them only show the dhcp-part of the network's xml file:

> <ip address="" netmask=""> <dhcp> <range
> start="" end="" /> <host
> mac="00:16:3e:e2:ed" name="foo.example.com" ip="" /> 
> </dhcp> </ip>

One possible workaround:
My system-dnsmasq reads /etc/hosts_whatever, and apparently the
libvirtd-dnsmasq reads var/lib/libvirt/dnsmasq/NETWORK_NAME.addnhosts.
I could copy my hosts_whatever in that place, but I had to configure
the libvirtd-dnsmasq what my local domains are.

Which brings me to the next question:
How to set the addn-hosts= for the libvirtd-dnsmasq in the xml file?

- -- 
A good sermon should be like a woman's skirt: short enough to arouse
interest but long enough to cover the essentials.
(Ronald Knox)
Version: GnuPG v2.0.22 (GNU/Linux)
Comment: Using GnuPG with SeaMonkey - http://www.enigmail.net/


More information about the libvirt-users mailing list