DNS查找失败

网关192.168.122.1运行dns,命令dig @192.168.122.1 www.google.com返回有效的IP地址,因此dns正在工作并且可以到达。

命令tracepath www.google.com返回gethostbyname2: Host name lookup failure

命令tracepath 74.125.129.103 (www.google.com)产生有效结果,所以默认路由设置正确。

命令route -n输出:

 Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.122.1 0.0.0.0 UG 100 0 0 eth0 192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 

/etc/network/interfaces的适用部分是:

 auto eth0 iface eth0 inet static address 192.168.122.5 netmask 255.255.255.0 broadcast 192.168.122.255 gateway 192.168.122.1 dns-servers 192.168.122.1 

目前没有防火墙正在运行。

我想,考虑到这些设置, tracepath www.google.com将联系DNS信息192.168.122.1 ,这是validation工作和可及。

接下来我应该做什么来找出tracepath命令返回gethostbyname2: Host name lookup failure


编辑 (更多信息)

/etc/resolv.conf是空的。 Ubuntu 12.04使用一个新的子系统resolvconf ,它自动生成/etc/resolvconf/resolv.conf.d/* resolv.conf数据。

/etc/resolvconf/resolv.conf.d/original包含:

 nameserver 192.168.122.1 

所有其他的resolv.conf.d文件( headbase )都是空的。

/etc/nsswitch.conf包含:

  passwd: compat group: compat shadow: compat hosts: files dns networks: files protocols: db files services: db files ethers: db files rpc: db files netgroup: nis 

/etc/hosts包含:

  127.0.0.1 localhost 127.0.1.1 hostname # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters 

我不是很熟悉resolv.conf.d版本,但我相信你应该把查找设置放在/etc/resolv/resolv.conf.d/base而不是/etc/resolv/resolv.conf.d/original

/etc/resolv/resolv.conf.d/base文件中的nameserver指令所接受的答案是pipe理ubuntu的新的resolvconf子系统中的名称服务器设置的一种方法,但也有另一种方法,我一直在尝试与我的configuration。

名称服务器也可以使用dns-nameservers指令在/etc/network/interfaces文件中dns-nameservers

我的问题是一个错字 ! 我把dns-nameservers写成了“dns-servers”。

我已经validation了接受的答案和这个工作的答案。