/etc/resolv.conf包含一个活着的名称服务器(如ping命令所报告的那样)host或者nslookup能够解决google.com
$ host google.com
google.com has address 74.125.228.3
google.com has address 74.125.228.4
...
$ nslookup google.com
...
Non-authorative answer:
Name: google.com
Address: 74.125.228.0
Name: google.com
Address: 74.125.228.1
..
Run Code Online (Sandbox Code Playgroud)ping或telnet无法解决google.com
$ ping google.com
ping: unknown host google.com
$ telnet google.com
google.com: node name or service name not known
Run Code Online (Sandbox Code Playgroud)Ada*_*ion 10
似乎ping并且telnet无法解析主机名,因为它们没有查询配置的 DNS 服务器(host并且nslookup似乎使用了不同的 DNS 查询代码),解决方案是:
覆盖/etc/nsswitch.conf有/etc/nsswitch.dns:
cp /etc/nsswitch.dns /etc/nsswitch.conf
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
29437 次 |
| 最近记录: |