Re: Set hostname of guest during installation time

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

 



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

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

--
John Doe






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

  Powered by Linux