Linux Hostname: Difference between revisions
No edit summary |
|||
Line 17: | Line 17: | ||
The static and transient hostnames are limited to the usually accepted characters of Internet domain names. | The static and transient hostnames are limited to the usually accepted characters of Internet domain names. | ||
The static hostname is stored in <tt>/etc/hostname</tt>, see [https://www.freedesktop.org/software/systemd/man/hostname.htm | The static hostname is stored in <tt>/etc/hostname</tt>, see [https://www.freedesktop.org/software/systemd/man/hostname.htm hostname(5)] for more information. | ||
The pretty hostname, chassis type, and icon name are stored in /etc/machine-info. | The pretty hostname, chassis type, and icon name are stored in /etc/machine-info. |
Revision as of 04:27, 7 August 2016
External
Internal
Overview
There are three different hostnames:
- The high-level "pretty" hostname which might include special characters.
- The static hostname which is used to initialize the kernel hostname at boot.
- The transient hostname which might be assigned temporarily due to network configuration and might revert back to the static hostname if network connectivity is lost and is only temporarily written to the kernel hostname.
The static and transient hostnames are limited to the usually accepted characters of Internet domain names.
The static hostname is stored in /etc/hostname, see hostname(5) for more information.
The pretty hostname, chassis type, and icon name are stored in /etc/machine-info.
The hostname can be set at runtime with at least two commands: Template:Hostname and Template:Hostnamectl. There's also a daemon that reacts to network events and sets the hostname: Template:Systemd-hostnamed.
The Template:Hostname command shows or set the system's host name.
Note that the name set is such a way is ephemeral - will disappear at reboot.
To permanently set name, configure the appropriate file. See below.
Host Name and the Domain Name
When a machine is initially configured, the installation program usually suggest a fully qualified host name that usually has a host name component and a domain name component.