First, using the hostname command to view the host name of the current host, in the terminal input hostname, you will find the full host name (hostname. Domain name), where the hostname and after entering the terminal: Login name @ hostname, as shown in the following:
Second, there are three ways to change the hostname of a host:
I. Direct use of command hostname < hostname >
This method changes the hostname: 1, temporary changes, the machine restarts after the failure of 2, can not ping
Second, change the configuration information in the/etc/sysconfig/network as shown in:
Change the value of hostname to change the hostname successfully. This method changes the hostname: 1, restart, you can take effect 2, can not ping
Third, change the configuration information in the/etc/hosts as shown in:
At the bottom of the file, add a line of configuration information: the host name that IP wants to set, and then save.
This method changes the hostname: 1, after restart, it will be effective 2, you can ping through
Centos6.4 comparison of three ways to change hostname