KVM: nsswitch.conf modification not sufficient to ssh to new guest?

Latest response

The 8.0 Virtualisation guide (section 2.4.4) gives these steps for connecting to a newly-installed guest on ssh:

  1. install libvirt-nss
  2. edit nsswitch.conf to add libvirt_guests to the 'hosts' line
  3. ssh directly to the guest, using the name reported by virsh list --all

This doesn't work - is there any extra magic required?

Presumably something has to be restarted after modifying nsswitch.conf, so I rebooted to be sure. The new hosts line is now hosts: files libvirt_guest dns myhostname. I've also tried modifying /etc/authselect/user-nsswitch.conf instead, and running authselect apply-changes, but it makes no difference.

For this VM, the name reported by virsh is 'Ubuntu-16.04', but ssh can't find this name.

The guest has an IP address of 192.168.122.190, and I can ssh directly to this IP address. The guest hostname is actually 'merlin-ubuntu-16'. dnsmasq is correctly set up for this combination of IP address and hostname. I can do both forward and reverse lookups with nslookup, and virsh net-dhcp-leases default also reports 192.168.122.190 and 'merlin-ubuntu-16'.

So, in short:

  1. ssh can connect directly to 192.168.122.190
  2. ssh cannot connect to either 'Ubuntu-16.04' or 'merlin-ubuntu-16'

Does anyone have any ideas? I'm on 8.0, and used Cockpit for the guest install. Thanks.

Responses