我在我的机器上安装了dnsmasq(这是一个Kubuntu 12.04 LTS),仅由/etc/hosts (直到后来才与Internet连接)。 现在,如果我dig mymachine ,我得到192.168.0.1,但如果我尝试nslookup mymachine ,我得到:
>> connection timed out; no servers could be reached
也试过nslookup mymachine.mynicedomain.org – 也没有工作。 ping( 编辑 :)成功。 这发生在服务器机器本身和networking上的其他机器上。
我怎样才能使DNS查找工作? 什么问题阻止nslookup成功?
在服务器的/etc/hosts :
192.168.0.1 mymachine
在服务器的nsswitch.conf :
hosts: files mdns4_mininal [NOTFOUND=return] dns mdns4
(不可否认,这有点奇怪,但我也试过:
hosts: files dns
相反,具有相同的效果)
在resolv.conf (由dnsmasq生成):
nameserver 127.0.0.1 search mynicedomain.org
在服务器的/etc/hosts.allow :
domain: ALL
在其他机器的/etc/resolv.conf (这是由DHCP客户端设置的):
nameserver 192.168.0.1 search mynicedomain.org
服务器上相关的netstat输出:
Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN tcp 0 0 192.168.0.1:53 0.0.0.0:* LISTEN
最后,这是来自networking上一台客户端机器(运行Windows 7)的ipconfig输出:
Connection-specific DNS Suffix . : mynicedomain.org Description . . . . . . . . . . . : Intel(R) 82579LM Gigabit Network Connection Physical Address. . . . . . . . . : 12-34-56-78-9A-BC DHCP Enabled. . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes IPv4 Address. . . . . . . . . . . : 192.168.0.50(Preferred) Subnet Mask . . . . . . . . . . . : 255.255.255.0 Lease Obtained. . . . . . . . . . : Sunday, October 20th 2013 16:20:25 Lease Expires . . . . . . . . . . : Sunday, October 20th 2013 18:20:24 Default Gateway . . . . . . . . . : 192.168.0.1 DHCP Server . . . . . . . . . . . : 192.168.0.1 DNS Servers . . . . . . . . . . . : 192.168.0.1 NetBIOS over Tcpip. . . . . . . . : Enabled
笔记:
你configuration了你的/etc/resolv.conf吗? 如果不是,应该如下:
search mynicedomain.org nameserver 192.168.0.1
当您使用BIND或其他DNS服务器时,应该相应地更改/etc/nsswitch.conf文件。
以下选项可用:
你的/etc/nsswitch.conf文件应该包含这样的内容,以启用DNS查找。
hosts: dns files