Definitive solution to libvirt guest naming
The answer is libvirt NSS. This is Fedora 26:
yum install libvirt-nss
And enable the NSS module with two “libvirt” keywords:
# egrep ^host /etc/nsswitch.conf hosts: files libvirt libvirt_guest dns myhostname
DNS resolution just works for all my libvirt guests now. NSS will figure it
out according to dnsmasq DHCP records (hostname entry). If that’s not
advertised by a guest, then it will construct this from VM name and libvirt
domain set during virtual network creation (empty by default).
For more visit documentation.
Hurray! No more fiddling with /etc/hosts, no more dnsmasq split setups or
hacks via virsh. This is elegant solution.
Via Kamil Páral’s blog.
Source From: fedoraplanet.org.
Original article title: Lukas “lzap” Zapletal: Definitive solution to libvirt guest naming.
This full article can be read at: Lukas “lzap” Zapletal: Definitive solution to libvirt guest naming.