Bug 559211

Summary: Please provide a way to specify a hosts file for dnsmasq
Product: [Community] Virtualization Tools Reporter: Andreas Rottmann <a.rottmann>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED UPSTREAM QA Contact:
Severity: medium Docs Contact:
Priority: low    
Version: unspecifiedCC: berrange, crobinso, mprivozn, xen-maint
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-01-07 13:47:06 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 711276    

Description Andreas Rottmann 2010-01-27 13:17:43 UTC
Currently, it seems not to be possible to specify a hosts file for the dnsmasq process launched by the network bridge driver. However, this poses a configuration problem, as then dnsmasq will use /etc/hosts, and this file commonly contains a line like this (delenn being the hostname of the host system):

127.0.1.1       delenn delenn.lan

This in turn will lead to guest VMs resolving `delenn' to the wrong (a loopback) IP address, when it instead should resolve to an IP address that can be reached by the guest VMs. Providing a way to specify the hosts file to be used by dnsmasq would allow resolving that issue.

Comment 1 Michal Privoznik 2015-01-07 13:47:06 UTC
I think this bug is fixed already. I mean, there's a way to specify DNS records in the network XML:

<network>
  <name>default</name>
  <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9c</uuid>
  <forward dev='eth0' mode='nat'/>
  <bridge name='virbr0' stp='on' delay='0'/>
  <domain name="example.com"/>
  <dns forwardPlainNames='no'>
    <host ip='192.168.122.1'>
      <hostname>host</hostname>
      <hostname>gateway</hostname>
    </host>
  </dns>
  <ip address='192.168.122.1' netmask='255.255.255.0'>
  </ip>
</network>

The other option is to forward DNS requests:

<network>
  <name>default</name>
  <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9c</uuid>
  <forward dev='eth0' mode='nat'/>
  <bridge name='virbr0' stp='on' delay='0'/>
  <dns>
    <forwarder addr='8.8.8.8'/>
    <forwarder addr='8.8.4.4'/>
  </dns>
  <ip address='192.168.122.1' netmask='255.255.255.0'>
  </ip>
</network>

If you disagree, please feel free to reopen.