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

I am unable to resolve hostnames, except using dig/nslookup. Declaring hosts in /etc/hosts works fine. DNSmasq nor bind is running. Below is the output of tcpdump port 53 when running dig

21:02:49.269083 IP >  7362+ A? (28)
21:02:49.269614 IP >  7362 5/0/0 A,[|domain]
21:02:49.270506 IP >  30910+ PTR? (44)
21:02:49.303321 IP >  30910*- 1/0/0 (83)

And the results while running ping

21:03:05.027197 IP >  56092+ A? (28)
21:03:05.029069 IP >  56092 5/0/0 A,[|domain]
21:03:05.029309 IP >  10345+ PTR? (44)
21:03:05.065058 IP >  10345*- 1/0/0 (83)

Ping does not return any packets when used with hostnames. The results above are delayed ~5 seconds from when the command is given. I have no trouble pinging IPs.

Contents of /etc/resolv.conf:


Both name servers give good results when used with dig.

Results of route -n:

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface   U     0      0        0 eth0     U     0      0        0 eth0         UG    0      0        0 eth0

Contents of /etc/hosts:       localhost.localdomain localhost
::1     localhost6.localdomain6 localhost6 ast01

SSHD does not even allow logins if UseDNS is set to yes. NSCD is running: nscd 28525 0.0 0.0 233652 2900 ? Ssl 20:10 0:00 /usr/sbin/nscd.


. . . EDIT

I resolved this. /etc/nsswitch.conf had the line:

hosts: files wins dns

I changed it to read:

hosts: dns files wins

and everything works now. What's bizarre is that things were working fine up until last week. Nothing changed, certainly not as far as DNS. Hope this helps someone.

share|improve this question
This also affects ubuntu when the setup is hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 – boatcoder Jun 25 '12 at 21:42

Are you relying on hostname completion (or "dns suffix appending" in the Windows world) to get a Fully Qualified Domain Name when you're running ping? If so, your /etc/resolv.conf is missing the domain and/or search options.


This should automatically append to $HOST so you have a FQDN that correctly resolves.

See the manpage for more details.

share|improve this answer
I was never before, and had no problems, but it does seem like that would've fixed things. I'll test with the previous nsswitch.conf and a search option set to see what happens. – lorsungcu Jan 24 '12 at 4:15

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.