Did some more testing (found how to adjust libvirts dnsmasq.conf and
restart it to pick up conf changes):

To test, get the dnsmasq pid using the vagrant-libvirt.conf config and check 
the environment set for the process with:
sudo cat /proc/2586/environ
VIR_BRIDGE_NAME=virbr0

After killing the relevant dnsmasq you can manually restart using
sudo VIR_BRIDGE_NAME=virbr0 /usr/sbin/dnsmasq 
--conf-file=/var/lib/libvirt/dnsmasq/vagrant-libvirt.conf --leasefile-ro 
--dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper

Just make sure to check the environment for the dnsmasq process before

Adding entries with the following format to the libvirt dnsmasq.conf:
host-record=<short>,<fqdn>,<ip>
interface-name=<short>,br0

And have entries with the following format in /etc/hosts
127.0.0.1 localhost
127.0.1.1 <fqdn> <short>

and nslookup and dig returns the configured <ip> for both short and fqdn
instead of 127.0.1.1 as it used to.

It appears that host-record overrides entries read from hosts-files
because record options are considered to be read before host-files, and
only the first entry results in the PTR creation, so a name appearing in
the host-record inhibits PTR-record creation based on the entries in
/etc/hosts.

I also tried using:
host-record=<fqdn>,<ip>
host-record=<short>,<ip>

Basically without the interface-name being specified and dig/nslookup
would start returning two records. So it means that 'interface-
name=<short>,br0' appears to be required to prevent the short version
from returning both records.


It would seem that the alternative would be to create a local copy of 
/etc/hosts pruned of all loop back address entries and provide that as the 
hosts file to read instead.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1326536

Title:
  libvirt's dnsmasq setup will read /etc/hosts on the host, resulting in
  odd resolution behaviour on the VM

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1326536/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to