[fedora-virt] How to make libvirt read /etc/hosts?

Richard W.M. Jones rjones at redhat.com
Thu Oct 27 07:36:57 UTC 2011


On Tue, Oct 25, 2011 at 07:26:11PM +0200, Christoph Wickert wrote:
> Hi,
> 
> 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?

As far as I can tell, dnsmasq should be reading /etc/hosts.  Here is
how libvirt starts dnsmasq:

/usr/sbin/dnsmasq --strict-order --bind-interfaces \
--pid-file=/var/run/libvirt/network/default.pid --conf-file= \
--except-interface lo --listen-address 192.168.122.1 --dhcp-range \
192.168.122.2,192.168.122.254 \
--dhcp-leasefile=/var/lib/libvirt/dnsmasq/default.leases \
--dhcp-lease-max=253 --dhcp-no-override

Anyhow, the dnsmasq instance is private to libvirt.  If you want to
use features from dnsmasq, ask for them to be added to the libvirt XML
(on libvir-list).

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw


More information about the virt mailing list