How to take effect after/etc/hosts file modification

Source: Internet
Author: User
Tags aliases

Http://blog.sina.com.cn/s/blog_605f5b4f0101847z.html

After modifying the/etc/hosts, the normal situation should be effective immediately after the save, but sometimes not. use uname-a to see how hostname is, and you can see if the changes are in effect. if not
the policy at this time is:
1) Restart the Machine
2) Restart service
     Ubuntu:  $sudo /etc/init.d/ Networking Restart       gentoo: /etc/init.d/net.eth0restart 3) using hostname command        hostname defined host name
hostname relationship to/etc/hosts

Many people mention change hostname first of all think about modifying/etc /hosts file, think the hostname configuration file is/etc/hosts. Actually, it's not. The

Hosts file functions as DNS, providing a corresponding IP address to hostname. Early Internet computers were few, and the stand-alone hosts file was sufficient to store all networked computers. But with the development of the Internet, this is far from enough. The distributed DNS system is then present. By the DNS server to provide a similar IP address to the domain name of the corresponding. Concrete can be manhosts. The

Linux system queries the/etc/hosts file before it sends a domain resolution request to the DNS server, and if it has a corresponding record, it uses the records in the hosts. /etc/hosts files typically contain this record

127.0.0.1   localhost.localdomain  localhost The
Hosts file format is one line of records, the IP address hostname aliases, the three separated by white space characters, and the aliases optional .

127.0.0.1 to localhost this recommendation is not to be modified because many applications use this, such as SendMail, which may not function properly after 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.