Environment:
- Many RHEL8 machines, running a default NetworkManager config.
- Two main networks: on both, DHCP supplies usual info including hostname.
- Most hosts are single-homed on either one network or the other; a few are dual-homed on both.
- Using config. management (CFEngine) across all hosts.
Problem: For single-homed machines things work well, including the hostname being received and set via DHCP. But the dual-homed machines receive a hostname twice: once from each interface. These names are slightly different: "foo.net1.[...]" and "foo.net2.[...]". The machine sets its fully-qualified hostname from these, and it seems to be "last one wins".
On dual-homed machines we would like to be able to configure NetworkManager (or similar) so that the hostname is set from a specified interface (and so that hostnames arriving on other interfaces are ignored).
It is not obvious how to do this. Any pointers, please?
(Config.mgmt. notes. It would be useful if this can be done via a config file with, for example, a "keyword=value" that could be interrogated and set. Or perhaps with commands that could query and (if not set) then set.)