I have a guest machine running ubuntu 14.04 on an Ubuntu 14.04 host running KVM/QEMU.
Everything works fine except for one thing. Given my guest's hostname is virtual-machine-1
, I would like to be able to find it from the host machine.
In especially, if I use host virtual-machine-1
on the host machine, I would like it to return the guest's IP address.
The documentation on KVM/Networking states:
If on your host machine you add 192.168.122.1 (the default IP of your host in libvirt) as your first nameserver in /etc/resolv.conf [... blabla it should work]
And this indeed works. But the resolv.conf
file is regularly overwritten and the extra added line gets lost.
Which leads me to my question: What is the appropriate way to reflect this change?
Here's what I've tried to no avail:
- adding it to
/etc/resolvconf/resolv.conf.d/base
- adding the dns-nameserver to my
/etc/network/interfaces
file
It seems like the nameserver 192.168.122.1 needs to precede any other (including 127.0.1.1). The documentation states that this is normal and that dnsmasq will handle it correctly. I just don't know how to configure this in a lasting manner.
/etc/resolvconf/resolv.conf.d/head
file as well. Did you try adding to that?DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
so I haven't tried./etc/resolv.conf
generated by resolvconf, because it uses that file as the header. Neither base nor head are ever overwritten, but stuff in head always appears before base (there also maybe atail
). :)