Re: Changing dnsmasq DNS settings for virtual machines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/06/2014 08:33 AM, Johannes Kastl wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> 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 127.0.0.1 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?

libvirtd's dnsmasq instances always forward requests that they can't
resolve themselves to the dns server listed in /etc/resolv.conf, so it
should already be doing what you want.

There was a bug in libvirt for quite awhile that caused
locally-unresolved requests for hostnames in the domain given by the
network's <domain name='xyzzy'/> element to be dropped rather than
forwarded. Is that possibly the cause of your problems?

Alternately, since 1.1.3 you can tell dnsmasq to forward to a specific
address rather than the one listed in /etc/resolv.conf with the
<forwarder> subelement of the <dns> element in the network definition, e.g.:

     <dns>
       <forwarder addr='1.2.3.4'/>
     </dns>

This is documented here:

   http://www.libvirt.org/formatnetwork.html#elementsAddress

There was a bug in libvirt for quite awhile that caused
locally-unresolved requests for hostnames in the domain given by the
network's <domain name='xyzzy'/> element to be dropped rather than
forwarded. Is that possibly the cause of your problems?

>
> 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:
>
> http://wiki.libvirt.org/page/VirtualNetworking#DNS_.26_DHCP
>> <ip address="192.168.122.1" netmask="255.255.255.0"> <dhcp> <range
>> start="192.168.122.100" end="192.168.122.254" /> <host
>> mac="00:16:3e:e2:ed" name="foo.example.com" ip="192.168.122.10" /> 
>> </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?

You do that with the <host> subelement of the <dns> element. An example
is at the same link as above.

>
> Regards,
> Johannes
> - -- 
> A good sermon should be like a woman's skirt: short enough to arouse
> interest but long enough to cover the essentials.
> (Ronald Knox)
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.22 (GNU/Linux)
> Comment: Using GnuPG with SeaMonkey - http://www.enigmail.net/
>
> iEYEARECAAYFAlNA5zMACgkQzi3gQ/xETbJBVACeLV9j/TDxgnImAsyEtotUBJ2J
> OD0An2WDBWUoqCUvmoquk4pwoKplfu/T
> =g6YM
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> libvirt-users mailing list
> libvirt-users@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvirt-users
>

_______________________________________________
libvirt-users mailing list
libvirt-users@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvirt-users




[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux