加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – Unix主机文件顺序

发布时间:2020-12-14 02:40:41 所属栏目:Linux 来源:网络整理
导读:很长一段时间我甚至没有注意到,但我在许多机器上做错了/ etc / hosts配置.手册的订单: 127.0.0.1 localhost 192.168.1.10 foo.example.org foo 192.168.1.13 bar.example.org bar 146.82.138.7 master.debian.org master 209.237.226.90 www.opensource.org
很长一段时间我甚至没有注意到,但我在许多机器上做错了/ etc / hosts配置.手册的订单:
127.0.0.1       localhost
   192.168.1.10    foo.example.org       foo
   192.168.1.13    bar.example.org       bar
   146.82.138.7    master.debian.org     master
   209.237.226.90  www.opensource.org

而我所做的是:

192.168.1.10    foo foo.example.org

这个订单真的很重要吗?或者它是80年代以来的一些古老的unix功能?

解决方法

hosts文件确实是一个古老的东西 from the past.但是,正如您在自己的/etc/nsswitch.conf文件中看到的那样,您仍然使用它,并且可能它优先于DNS.

/ etc / hosts文件的正确格式记录在hosts(5)手册页中:

IP_address canonical_hostname [aliases...]

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读