首页 > 系统服务 > 详细

Linux /etc/hosts

时间:2016-07-05 14:09:15      阅读:291      评论:0      收藏:0      [点我收藏+]

用途:

关联主机名和IP地址

在机器启动时,在DNS正常工作前,需要知道一些主机名和IP地址的映射关系,这个映射关系就保存在/etc/hosts文件中,在DNS不能正常工作是,系统中所有的网络程序将查看该文件以决定IP地址对应的主机名。

格式:

每行一个IP地址

IP_address canonical_hostname [aliases...]

注释:

从 #开始,到一行的结束。

示例一:

127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6

示例二:

# The following lines are desirable for IPv4 capable hosts
       127.0.0.1       localhost

       # 127.0.1.1 is often used for the FQDN of the machine
       127.0.1.1       thishost.mydomain.org  thishost
       192.168.1.10    foo.mydomain.org       foo
       192.168.1.13    bar.mydomain.org       bar
       146.82.138.7    master.debian.org      master
       209.237.226.90  www.opensource.org

       # The following lines are desirable for IPv6 capable hosts
       ::1             localhost ip6-localhost ip6-loopback
       ff02::1         ip6-allnodes
       ff02::2         ip6-allrouters

 

Linux /etc/hosts

原文:http://www.cnblogs.com/rushoutasia/p/5643310.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!