Set hostname of guest during installation time

john doe johndoe65534 at mail.com
Fri Mar 27 19:29:47 UTC 2020


On 3/27/2020 7:36 PM, Michal Prívozník wrote:
> 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
>

Thanks for the explanation but it does not seem to work:

$ getent hosts try06; echo $?
2


Using 'libvirt' or libvirt_guest' one or the other or both does not
change the above, for testing purposes the line 'hosts: ...' has only
libvirt modules.

It is also not working for SSH.

Testing this on Debian Buster (10) ('libnss-libvirt is already the
newest version (5.0.0-4+deb10u1)').

Your help is appriciated.

--
John Doe





More information about the libvirt-users mailing list