hostname-mode : short vs fqdn name


I'm trying to figure out how exactly my stateless HPC nodes (CentOS 8.1/NetworkManager-1.20.0) get their hostnames.

As a matter of fact, they can either get a "short" (non fqdn - something like 'maestro-1000') hostname or a fqdn hostname ( This is related to the process network is configured according to the following procedure :

1. node PXE boots the stateless osimage and ends up having a dhcp NM profile
2. a postscript is run on the node which uses NM to create an additional profile with higher autoconnect priority which main goal is to statically set the ip address retrieved in step 1.

- if only step 1. is performed  hostname == short name
- if step 1 + 2. are performed, hostname == fqdn

Note :

- DNS is configured on each node, both for forward and reverse zone

- I checked with tcpdump that DHCP option 12 "Host-Name" always stores the short name (and of course the domain '' in option 15)

- step2 (I guess) puts HOSTNAME=maestro-1000 in /etc/sysconfig/network

- node never have a /etc/hostname file

- no hostname-mode is specified in NetworkManager.conf

- finally, when step 1+2 are performed, I can see:

Apr 07 20:13:19 maestro-1000 systemd-hostnamed[14516]: Changed host name to 'maestro-1000' Apr 07 20:13:33 systemd-hostnamed[14516]: Changed host name to ''

which I reckon matches step1 then step2

Here are my questions :

- I am assuming NetworkManager uses systemd-hostnamed when it is in charge to set the hostname : is this correct ?

- I am assuming what I see is related to hostname-mode setting as I didn't see any hostname or hostnamectl et sethostname call in the postscript. Playing with its possible valued in NM config, I experienced the following after step 1+2 :

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)

b) : NM just don't play with the transient name and sets a static hostname coming from /etc/sysconfig/network

c) confuses me as the manual says NM

"will update the transient hostname only with information coming from DHCP" but with no fallback So I was expecting after step 2 to have localhost.localdomain or only the short name but not the fqdn

Or maybe it builds a fqdn from host-name + domain coming from DHCP ?

Can you help me figuring out my misunderstanding ?

Thanks for your help


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