libvirt's dnsmasq setup will read /etc/hosts on the host, resulting in odd resolution behaviour on the VM
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
libvirt (Ubuntu) |
Triaged
|
Medium
|
Unassigned | ||
lxc (Ubuntu) |
Triaged
|
Medium
|
Stéphane Graber |
Bug Description
When libvirt configures / starts up dnsmasq on the host, it does not pass --no-hosts, resulting in it reading in the /etc/hosts file from the host.
The default ubuntu setup will have the host's hostname in /etc/hosts under 127.0.1.1. Since libvirt's dnsmasq is reading this file, anything querying that dnsmasq instance will resolve the host's hostname out of /etc/hosts.
The result of this is any VM running on the host will resolve the host's hostname as 127.0.1.1. For example, if the host's hostname is BoxA, any VM running on the host will resolve BoxA to 127.0.1.1, which is not BoxA's actual address.
Would recommend passing --no-hosts to dnsmasq when libvirt starts it up. If a user wants hardcoded hosts for their libvirt network, they can add them to /var/lib/
summary: |
libvirt's dnsmasq setup will read /etc/hosts on the host, resulting in - odd behaviour for the domain + odd resolution behaviour on the VM |
Thanks for submitting this bug. Tested and reproduced the same, and agreed this should be fixed. Looks like this should be pretty simple to fix at src/network/ bridge_ driver. c:networkBuildD hcpDaemonComman dLine() . The patch however should also go upstream for feedback there.
Thanks for offering to write the patch, please go ahead and let us know if you end up not having time due i.e. to reprioritizatio ns...