Set hostname of guest during installation time

Michal Prívozník mprivozn at redhat.com
Fri Mar 27 18:36:53 UTC 2020


On 27. 3. 2020 19:23, john doe wrote:
> Okay, I have installed the pluging, do you mind explaning how this
> should work?:
> 
> $ grep host /etc/ns*
> hosts:          files libvirt_guest dns
> 
> 
> If I'm correct, following your example, I should be able to do:
> 
>  $ host try06
> 
> What am I missing.

'host' does DNS directly, regardless of nsswitch.conf. That's not how
majority of SW work. Try:

  getent hosts try06

or:

  ssh try06

The majority will use gethostbyname() which will consult the
nsswitch.conf and use modules defined there. In your case, the
/etc/hosts will be consulted first, then libvirt_guest and DNS is used
only if everything else failed. You can verify that 'host' does DNS
directly by trying a hostname from /etc/hosts. It will give an error
even though getent won't.

Michal




More information about the libvirt-users mailing list