On 10/25/2011 01:26 PM, Christoph Wickert wrote:
> I'd like to give my VMs reliable addresses over DHCP and so far I was
> only able to do this by defining them in the libvirt's network config
> with 'virsh net-edit'. But as libvirt runs dnsmasq and dnsmasq usually
> reads /etc/hosts, it should be sufficient to just edit the hosts file.
>
> Unfortunately this doesn't work. Why does dnsmasq ignore /etc/hosts when
> started from libvirt?

I just tested this locally (e.g. by doing "host mytestname" in a guest's 
shell) and dnsmasq doesn't ignore the entries in /etc/hosts.

One possibility why it may seem to be failing for you (but is actually 
working): dnsmasq reads the contents of /etc/hosts at startup; any 
changes made to /etc/hosts after that time will not be seen by dnsmasq 
until/unless you either restart dnsmasq, or send it a SIGHUP. To send a 
SIGHUP to all your dnsmasq processes, just do this:

    killall -HUP dnsmasq

Or possibly you're misunderstanding what dnsmasq does with /etc/hosts. 
It will *not* (for example) search for a client's hostname during a DHCP 
request, and assign it the address it finds in /etc/hosts. That is what 
the <host> elements inside the <dhcp> element are for.

What dnsmasq *does* do with /etc/hosts: when receiving a DNS request for 
a hostname, it will look for a resolution for that name in /etc/hosts. 
libvirt doesn't disable this functionality by default, and doesn't even 
provide a way for the functionality to be disabled, so either you're 
hitting one of the two situations above, or you've encountered a bug in 
the version of libvirt/dnsmasq you're using.
_______________________________________________
virt mailing list
[email protected]
https://admin.fedoraproject.org/mailman/listinfo/virt

Reply via email to