18.5. Enhancing Remote Management of Virtual Machines with NSS
yum install libvirt-nss
Optionalrepository for Red Hat Enterprise Linux is enabled. For instructions, see the System Administrator's Guide.
hostsline of the
/etc/nsswitch.conffile, for example as follows:
passwd: compat shadow: compat group: compat hosts: files libvirt dns ...
hostsline determines the order in which these modules are consulted to find the specified remote guest. As a result, libvirt's NSS module is added to modules that translate host domain names to IP addresses. This for example enables connecting to a remote guest in NAT mode without setting a static IP address and only using the guest's
ssh root@guest-hostnameroot@guest-hostname's password: Last login: Thu Aug 10 09:12:31 2017 from 192.168.122.1 [root@guest1-rhel7 ~]#
virsh list. To display or configure the hostname on the guest, use the hostnamectl commands.