Re: hostname-mode : short vs fqdn name



Hello, thanks for your answer

On 4/8/20 10:25 AM, Beniamino Galvani wrote:

>> - step2 (I guess) puts HOSTNAME=maestro-1000 in /etc/sysconfig/network
>
> AFAIK, NetworkManager doesn't do that.

Although I saw that it was the postscript which wrote into this file, I thought NetworkManager was considering it because it is mentionned in man 5 nm-settings-ifcfg-rh

> Yes, it uses the SetHostname D-Bus call of systemd-hostnamed, which
> changes the transient (kernel) hostname.

Talking about D-Bus, I see this in the begining of all 3 (default, none, dhcp) traces :

Apr 08 14:53:29 maestro-1000.maestro.pasteur.fr NetworkManager[25235]: <trace> [1586350409.2521] policy: get-hostname: "maestro-1000.maestro.pasteur.fr" (from dbus) Apr 08 14:53:29 maestro-1000.maestro.pasteur.fr NetworkManager[25235]: <trace> [1586350409.2521] policy: hostname-original: set to "maestro-1000.maestro.pasteur.fr"

how is this hostname fully qualified who sets it ? The original hostname always seems to be this one.

>> a) default : what's described above (fqdn)
>> b) none : hostname == short name
>> c) dhcp : same as a) (fqdn)
>>
>> I can elaborate on that like this :
>>
>> a) as man said NM sets hostname "with the one provided via DHCP", which is >> first the short one (step1) then as a static profile is activated, it falls
>> back to "hostname from the reverse lookup of the IP address" (which DNS
>> resolves in the fqdn)
>
> Right.

>> b) : NM just don't play with the transient name and sets a static hostname
>> coming from /etc/sysconfig/network
>
> NM sets the transient host name. It doesn't know about
> /etc/sysconfig/network. The hostname is determined in this way:

But man says "none: NetworkManager will not manage the transient hostname and will never set it."
Makes me wonder what exactly is the transient hostname.

Besides, trace for 'none' confirms hostname is "unmanaged"

So where does the short hostname I see in this case b) come from if not dhcp (none) neither the sysconfig/network file ?

>
> https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/1.20.0/src/nm-policy.c#L744

ok. But what does exactly "set outside of NetworkManager" mean ?


> No, it only takes the short hostname from DHCP.

ok, makes sens as this is what's sent


> I don't know why it is setting the FQDN in your case. Could you please
> put level=trace in the [logging] section of
> /etc/NetworkManager/NetworkManager.conf, disabled journald
> ratelimiting, reproduce the issue and attach the journal log of a boot
> with hostname-mode=dhcp?

Please find the 3 traces here:

http://dl.pasteur.fr/fop/P3H6bSGV/NM-hostname-mode.tar.gz

So basically, I still don't understand the 2 following cases

- none (end up with short name) : if dhcp, NM seems to still manage the hostname despite none

- dhcp (end up with fqdn).


Thanks for your help.

--
Thomas HUMMEL



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