On a CentOS Linux 7 server you can use any one of the following tool to manage hostnames:
- hostnamectl command : Control the system hostname. This is recommended method.
- nmtui command : Control the system hostname using text user interface (TUI).
- nmcli command : Control the system hostname using CLI part of NetworkManager.
Types of hostnames
The hostname can be configured as follows
- Static host name assigned by sysadmin. For example, “server1”, “wwwbox2”, or “server42.cyberciti.biz”.
- Transient/dynamic host name assigned by DHCP or mDNS server at run time.
- Pretty host name assigned by sysadmin/end-users and it is a free-form UTF8 host name for presentation to the user. For example, “Vivek’s netbook”.
Static – The static host name is traditional host which can be chosen by the user and is stored in /etc/hostname file.
Transient – The transient host name is maintained by kernel and can be changed by DHCP and mDNS.
Pretty – It is a free form UTF -8 host name for the presentation to the user.