很长一段时间,我甚至没有注意到,但是我在很多机器上做了错误的/ etc / hostsconfiguration。 手册的顺序:
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年代的一些古代unixfunction?
hosts文件确实是一个古老的东西。 然而,正如你可以在你自己的/etc/nsswitch.conf文件中看到的那样,你仍然使用它,它可能优先于DNS。
hosts(5)手册页中logging了/etc/hosts文件的正确格式:
IP_address canonical_hostname [aliases...]