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.