CENTOS7 Host Modification

Source: Internet
Author: User

First of all, hostname and the hosts file does not necessarily contact, have not understood the classmate can first consult the data to understand the relationship between hostname and the hosts file. Here is a brief description.

The Hosts file is the predecessor of the DNS service, the network just began to appear when the site is relatively small, on each host set up the Hosts file, in order to use for domain name resolution, and then the site more and more, the hosts file this way can not manage and effectively query the domain name information, So the DNS of this kind of distributed domain name resolution service (even if there is DNS, or will first check the hosts file, if not found, and then through DNS to resolve the domain name). Since hostname is a string, it can also be considered a domain name, so you can configure IP for hostname in the hosts file. and hostname represents the hostname, and the domain name is not the same. Hostname More is used in this machine, for other users is not very significant (personal feeling is this). Even if you configure your own hostname, if someone doesn't put your hostname in the Hosts file on his console, he won't be able to access you through hostname. Even if you do not configure hostname, someone else on their host will be a <IP hostname> configuration in the Hosts file, he can visit you through hostname. If you configure the hostname, if you are not in the hosts hostname and your IP bindings, ping hostname also ping does not pass. Hostname can appear at the command prompt to prompt you to the current login is that host, of course, there are other uses, but it is more on the local program.

Centos7 the configuration of hostname from/etc/sysconfig/network to/etc/hostname, so configuring/etc/sysconfig/network in hostname is not working.

According to the previous instructions, hostname and the Hosts file relationship is not big, some blog said changed hostname after the hosts in the presence of localhost to change to hostname, this is wrong, all need to communicate through the network software or programs, Basic use of IP, some will use the domain name, perhaps there will be software in the access to the local localhost, if you change the Hosts file in the localhost to hostname, then these need to network programs will fail. Your own ping localhost will also fail. So it is generally not recommended to replace the hosts file inside the localhost.

CENTOS7 Host Modification

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.