Avoid overwriting of hostname by transient hostname at reboot
The transient hostname is initialised at startup to the static host name but it can be changed by DHCP or mDNS.
DHCP
If you’re using DHCP, you should check that the wrong hostname hasn’t been set in the configuration for your network device. Run ip addr show
to check
which network device you’re using. Then edit the appropriate configuration
script. E.g. if your network interface is eth0
, you should edit its configuration file, /etc/sysconfig/network-scripts/ifcfg-eth0
.
From Red Hat documentation on Configuring a Network Interface Using ifcfg Files, there’s an option to
configure an interface to send a different host name to the DHCP server.
DHCP_HOSTNAME=hostname
Check to make sure that your system doesn’t have the hostname mail
configured in this script.
If that’s not the issue you’ll need to check that the local DHCP server isn’t configured to set the hostname as mail
. If you have a network administrator, who has configured your host as mail
in the DNS / DHCP for a Local Area Network, you should talk to them. The best practice is to configure hosts with non-role based names and then to configure DNS CNAMES as aliases for the relevant servers.
If DHCP is the source of your problems and the above suggestions don’t help, the other option would be to configure your network interface to use static IP addresses.