A summary of how Linux modifies host names

Source: Internet
Author: User

In the Linux system, we can use the "hostname" command to view the host name, using "Hostname-i" to view the corresponding IP address of the machine name. To modify this host name, you need to modify the two configuration files.

First, modify the "/etc/sysconfig/network" file to change the "hostname=******" line to the desired;

The code is as follows Copy Code

Networking=yes
Networking_ipv6=yes
Hostname=halo
gateway=74.117.63.225
Ipv6_autoconf=no

Then modify the "/etc/hosts" file,

Modified to:

The code is as follows Copy Code

127.0.0.1 localhost.localdomain localhost
74.117.63.238 Halo


Complete:
First step:

The code is as follows Copy Code
#hostname Oratest

Step Two:
Modify the hostname in/etc/sysconfig/network
Step Three:
modifying/etc/hosts files


another way to do that is to change the configuration file

Modify/etc/sysconfig/network Modify this file, the system is valid
/etc/hosts hostname command to read this configuration file

There are a lot of friends on the Internet that can directly modify the/etc/hosts file, but the system itself used to host the name of the place will not change, so I think
/etc/hosts is used in the network,/etc/sysconfig/network is the local function, and the meridian test is like this, I have the version is

Linux AS3

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.