3

I installed dnsmasq on a machine of mine (It's a Kubuntu 12.04 LTS), backed only by /etc/hosts (no connection to the Internet until later). Now, if I dig mymachine, I get 192.168.0.1, but if I try to nslookup mymachine, I get:

>> connection timed out; no servers could be reached

Tried also nslookup mymachine.mynicedomain.org - didn't work either. pinging (Edit:) succeeds. This happens both on the server machine itself and on other machines on the network.

How can I get the DNS lookups to work? What problem is preventing nslookup from succeeding?

Additional Information

In the server's /etc/hosts:

192.168.0.1   mymachine

In the server's nsswitch.conf:

hosts: files mdns4_mininal [NOTFOUND=return] dns mdns4

(admittedly, this is a bit weird; but I also tried:

hosts: files dns

instead, with the same effect)

In resolv.conf (which is generated by dnsmasq):

nameserver 127.0.0.1
search mynicedomain.org

In the server's /etc/hosts.allow:

domain: ALL    

In the other machines' /etc/resolv.conf (this is set by the DHCP client):

nameserver 192.168.0.1
search mynicedomain.org

Relevant netstat output on the server:

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

Finally, here's the ipconfig output from one of the client machines on the network (running Windows 7):

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

Notes:

einpoklum
  • 1,622
  • 3
  • 19
  • 30
  • So far all you (appear) to know is that dnsmasq is listening and responding on the server's 127.0.0.1 intrface. Is dnsmasq listening on 192.168.0.1 (dig @192.168.0.1 ... | netstat ...)? Can the remote machines contact 192.168.0.1 at all (ping ssh etc )? – user9517 Oct 21 '13 at 06:52
  • @Iain: Yes it is, and yes they can. Updated question accordingly. – einpoklum Oct 21 '13 at 07:01
  • Do you get any more hints as to what is happening if you do `set debug` in nslookup before the query? – Håkan Lindqvist Jan 24 '15 at 11:14
  • @HåkanLindqvist: This was over a year ago, I'm no longer experiencing the problem. – einpoklum Jan 24 '15 at 12:43

1 Answers1

2

Have you configured your /etc/resolv.conf? If not, it should be as follows:

search mynicedomain.org
nameserver 192.168.0.1 

When you use BIND or other DNS Servers, you should change /etc/nsswitch.conf file accordingly.

The following options are available:

  • dns: Use the Domain Name System (DNS) service to resolve the address. This makes sense only for host address resolution, not network address resolution. This mechanism uses the /etc/resolv.conf file.
  • files: Search a local file for the host or network name and its corresponding address. This option uses the traditional /etc/hosts and /etc/network files.

Your /etc/nsswitch.conf file should contain a like this, to enable DNS lookups.

hosts:       dns files
einpoklum
  • 1,622
  • 3
  • 19
  • 30
Zeeshan
  • 351
  • 1
  • 5
  • Yes, you are correct. I was trying to drill it down step by step. As all the configuration seems correct. I guess the problem is here--> hosts: files mdns4_mininal [NOTFOUND=return] dns mdns4 Check the following [link](http://askubuntu.com/questions/27541/why-cant-my-machine-resolve-local-windows-hostnames) You need to install apt-get install winbind – Zeeshan Oct 20 '13 at 15:01
  • okay deleted you can check the link in my last comment, if it works for you – Zeeshan Oct 20 '13 at 15:06
  • Well, it turns out pinging actually _works_. I was running ping with a wrong setup before. The conundrum is still basically the same though. – einpoklum Oct 21 '13 at 15:17