Johannes Kastl
2014-Apr-06 05:33 UTC
[libvirt-users] Changing dnsmasq DNS settings for virtual machines
-----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? 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? 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-----
Johannes Kastl
2014-Apr-07 19:44 UTC
Re: [libvirt-users] Changing dnsmasq DNS settings for virtual machines
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 06.04.14 07:33 Johannes Kastl wrote:> Which brings me to the next question: How to set the addn-hosts> for the libvirtd-dnsmasq in the xml file?*ping* Maybe I asked the wrong question, and this is an RTFM. But I looked some more and found: nil. Nada. Nothing. If someone had a M that I could F R then I would be glad... ;-) Regards, Johannes - -- `Dobby is a free house-elf and he can obey anyone he likesĀ“ (Harry Potter and the Half-blood Prince, S. 394) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Using GnuPG with SeaMonkey - http://www.enigmail.net/ iEYEARECAAYFAlNDAAMACgkQzi3gQ/xETbKYZQCeLX5pe+EWT3GZtPSWNZIMm6WV qDkAnj3pO/yo5u/hBPRBRZzw/lgY4HiL =qdaj -----END PGP SIGNATURE-----
Laine Stump
2014-Apr-10 11:08 UTC
Re: [libvirt-users] Changing dnsmasq DNS settings for virtual machines
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@redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-users >
Johannes Kastl
2014-Apr-10 17:12 UTC
Re: [libvirt-users] Changing dnsmasq DNS settings for virtual machines
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 10.04.2014 13:08 Laine Stump wrote:> On 04/06/2014 08:33 AM, Johannes Kastl wrote:>> 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?Maybe...>> 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>Nice, seems to work.>> This is documented here: > >> http://www.libvirt.org/formatnetwork.html#elementsAddressI actually was on that page, but I must have missed that bit...> 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.No, thats not it. I do not want to set single hosts, I want to tell dnsmasq to read an additional hosts-file. In the normal dnsmasq.conf this is done via addn-hosts=, and that appears in the conf-file for the network called e.g. WHATEVER: addn-hosts=/var/lib/libvirt/dnsmasq/WHATEVER.addnhosts Regards, Johannes - -- 'Are you Death?' ... IT'S THE SCYTHE, ISN'T IT? PEOPLE ALWAYS NOTICE THE SCYTHE. (Terry Pratchett, The Fifth Elephant) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) Comment: Using GnuPG with SeaMonkey - http://www.enigmail.net/ iEYEARECAAYFAlNG0OwACgkQzi3gQ/xETbLqJQCghnq19VVAhUJyhfvzfr+D5JyJ aDwAnAgUDw+eSXC5rL1O9UL7MWPSemn3 =lSGE -----END PGP SIGNATURE-----
Seemingly Similar Threads
- Changing dnsmasq DNS settings for virtual machines
- Re: Changing dnsmasq DNS settings for virtual machines
- Re: Changing dnsmasq DNS settings for virtual machines
- Re: Changing dnsmasq DNS settings for virtual machines
- Re: My VMs don't get IP with libvirt and dnsmasq