Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For some reason, all DNS queries on one of my Ubuntu 9.04 boxes get routed to localhost, which results in no domain names being resolved. When trying for instance dig, it hangs for ~20 seconds, before quitting with the message ";; connection timed out; no servers could be reached". However, dig @ returns the correct result immediately. This problem applies to all DNS queries, not only from dig.

$ cat /etc/resolv.conf

I do not have a .digrc, NetworkManager has been uninstalled, and the network is otherwise working (e.g. I can use it normally for hosts in /etc/resolv.conf). I do not have a local DNS server installed, and nmap confirms that nothing is listening on port 53. I have several other boxen running Ubuntu 9.04 on the same network, DNS is working fine on all of them.

I have used strace to confirm that dig actually reads resolv.conf:

open("/etc/resolv.conf", O_RDONLY|O_LARGEFILE) = 6
read(6, "\n193.75.75.193\n"..., 4096) = 27

I have also used tcpdump to confirm that the problem is indeed DNS queries getting routed to localhost:

$ sudo tcpdump -i lo
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on lo, link-type EN10MB (Ethernet), capture size 96 bytes
14:11:54.175580 IP localhost.45910 > localhost.domain: 38233+ A? (29)
14:11:54.175633 IP localhost > localhost: ICMP localhost udp port domain unreachable, length 65
14:11:55.175542 IP6 ip6-localhost.54963 > ip6-localhost.domain: 38233+[|domain]
14:11:55.175575 IP6 ip6-localhost > ip6-localhost: ICMP6, destination unreachable[|icmp6]

I am out of ideas for resolving this issue, so any input and suggestions are most welcome.

share|improve this question
up vote 4 down vote accepted

A record in /etc/resolv.conf should look like

share|improve this answer
I cannot belive i didn't see that, and went off on a wild hunt with strace, nc, tcpdump, and friends... Thanks anyway! – knatten Sep 12 '09 at 13:53

The format of /etc/resolv.conf is incorrect, it should read:


The search line is of course optional. If it exists it will be used to qualify hostnames, eg. looking up the address for router will return the address for

share|improve this answer

If you've changed this recently, have you tried "service network restart" or restarting all of the server?

Sounds pretty newb, but that's what it takes when resolv.conf is modified.

share|improve this answer
You don't have to restart any networking after modifying /etc/resolv.conf – Anonymous Sep 12 '09 at 13:03
Ubuntu doesn't even have a service command. If anything restarting networking will most likely overwrite resolv.conf – theotherreceive Sep 12 '09 at 13:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.