In CentOS, there are three definitions of host names: static, transient (transient), and flexible (pretty).
- The "Static" hostname, also known as the kernel hostname, is the host name that the system automatically initializes from/etc/hostname at startup.
- A "transient" hostname is a host name that is temporarily assigned when the system is running, for example, through DHCP or MDNs server assignment. The static hostname and transient host name comply with the same character restriction rules as the Internet domain name.
- The "flexible" hostname allows the use of a host name that is free form (including special/whitespace characters) to be displayed to end users (such as LINUXIDC).
First, view the host name
[Email protected] ~]# Hostnamectl
If you are viewing only static, transient, or flexible host names, you can use the--static,--transient, or--pretty options respectively.
Second, modify the host name
Linux CentOS7.0 (02) Modify host name and IP address