Re: Set hostname of guest during installation time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 27. 3. 2020 20:49, john doe wrote:
> On 3/27/2020 8:29 PM, john doe wrote:
>> 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.
>>
> 
> With some more testing:
> 
> $ grep hosts: /etc/ns*
> hosts: file libvirt libvirt_guest dns
> 
> $ virsh net-dhcp-leases default
>  Expiry Time           MAC address         Protocol   IP address
>    Hostname   Client ID or DUID
> ------------------------------------------------------------------------------------------------------------------------------------------------
>  2020-03-27 21:40:49   52:54:00:d4:e6:f0   ipv4       192.168.122.137/24
>   debian     ff:00:d4:e6:f0:00:01:00:01:26:11:0b:0c:52:54:00:d4:e6:f0
> 
> $ getent hosts try06
> $ getent hosts debian
> 192.168.122.137 debian

So 'libvirt' plugin is working and 'libvirt_guest' is not.

> 
> If my understanding is correct, using 'try06' or 'debian' should do the
> same thing?
> 

Yes, that is the idea. However, these plugins were not introduced at the
same time. I think that especially Debian has delayed libvirt_guest
plugin. You can check if both plugins exist:

ls /usr/lib64/libnss_libvirt*

/usr/lib64/libnss_libvirt_guest.so.2
/usr/lib64/libnss_libvirt.so.2

I was told that in Debian, 5.2.0 is the first package to have both NSS
plugins.

Michal





[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux