
[Usually, it's not a good idea to merge threads on technical lists] On 06/16/2017 02:38 PM, jean-christophe manciot wrote:
libvirt-nss is not for translating DNS names, rather than libvirt guest names
I meant hostname/guest name. There is no static DNS in /etc/hosts for the VMs and no specific records in DNS server.
Well, how do you expect other hosts to translate FQDNs then?
Can you see the guest in: /var/lib/libvirt/dnsmasq/virbr0.{macs,status}
# cat /var/lib/libvirt/dnsmasq/virbr0.{macs,status} [ { "domain": "KVM-Ubuntu-GNS3-Server-17.04", "macs": [ "52:54:00:03:9f:9f" ] } ] [ { "ip-address": "192.168.122.124", "mac-address": "52:54:00:03:9f:9f", "hostname": "KVM-Ubuntu-GNS3-Server-17", "expiry-time": 1497617966 } ]
Based on this contents, you should be able to ping both "KVM-Ubuntu-GNS3-Server-17" and "KVM-Ubuntu-GNS3-Server-17.04"
You need to restart the network after you've set up the NSS module.
I've rebooted the system.
I am using something along the lines of:
$ cat /etc/dnsmasq.d/libvirt.conf
server=/virt/192.168.213.1
server=/213.168.192.in-addr.arpa/192.168.213.1/
I have no /etc/dnsmasq.d/libvirt.conf, but in */etc/dnsmasq.conf*: *local=/actionmystique.net/ <http://actionmystique.net/>*
I thought this would add that domain name to the answers from whatever is found in DHCP leases. The comment says: # Add local-only domains here, queries in these domains are answered # from /etc/hosts or DHCP only. Since the first libvirt-nss module ("libvirt" plugin) looks into DHCP server leases, the above setting should work, shouldn't it?
Actually, I've just realized that there is a discrepancy between the libvirt VM guest name and the Ubuntu hostname, where the trailing ".04" has been automatically removed. So, the* hostname (not guest name) is accessible*: # ping KVM-Ubuntu-GNS3-Server-17 PING KVM-Ubuntu-GNS3-Server-17 (192.168.122.124) 56(84) bytes of data. 64 bytes from KVM-Ubuntu-GNS3-Server-17 (192.168.122.124): icmp_seq=1 ttl=64 time=0.191 ms 64 bytes from KVM-Ubuntu-GNS3-Server-17 (192.168.122.124): icmp_seq=2 ttl=64 time=0.302 ms
Yup, so the NSS module is working. Also, it's worth noting that NSS module is meant to be single host only. I mean, it isn't a DNS server or something. It's purely local. Although, based on the contents of the files both names should work, with and without trailing .04;
... *but not he FQDN*: # ping KVM-Ubuntu-GNS3-Server-17.actionmystique.net ping: KVM-Ubuntu-GNS3-Server-17.actionmystique.net: Name or service not known
Again, if you want DNS record for this name, you need to put the record into the DNS server. Libvirt does not do that for you. Michal