Centos6.4 comparison of three ways to change hostname

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.