Setting up hostname resolution for libvirt/KVM guests
In order to enable hostname resolution for KVM guests, libvirt uses dnsmasq.
To allow both the host and the guests to resolve the hostnames of the guests:
-
Install
libnss-libvirt
-
Add
libvirt
andlibvirt_guest
to the list of host databases in/etc/nsswitch.conf
. For example, the line should readfiles dns myhostname libvirt libvirt_guest
. See the Libvirt NSS module page for more information. -
Edit
/etc/NetworkManager/NetworkManager.conf
and adddns=dnsmasq
in the [main] section -
Restart the network manager
service NetworkManager restart
Links
Anything to add? Let's talk @kgoutsos.
Share this page on
Twitter,
Facebook,
LinkedIn or use the permalink.