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 google.com:

21:02:49.269083 IP txxxxxx1.corp.mxxxxxxs.com.39872 > dxxxxxx3.corp.mxxxxxs.com.domain:  7362+ A? google.com. (28)
21:02:49.269614 IP dxxxxxx3.corp.mxxxxxxs.com.domain > txxxxxx1.corp.mxxxxxxs.com.39872:  7362 5/0/0 A ord08s07-in-f19.1e100.net,[|domain]
21:02:49.270506 IP txxxxxx1.corp.mxxxxxxs.com.33316 > dxxxxxx3.corp.mxxxxxxs.com.domain:  30910+ PTR? (44)
21:02:49.303321 IP dxxxxxx3.corp.mxxxxxxs.com.domain > txxxxxx1.corp.mxxxxxxs.com.33316:  30910*- 1/0/0 (83)

And the results while running ping google.com:

21:03:05.027197 IP txxxxxx1.corp.mxxxxxxs.com.59151 > dxxxxxx3.corp.mxxxxxxs.com.domain:  56092+ A? google.com. (28)
21:03:05.029069 IP dxxxxxx3.corp.mxxxxxxs.com.domain > txxxxxx1.corp.mxxxxxxs.com.59151:  56092 5/0/0 A ord08s07-in-f18.1e100.net,[|domain]
21:03:05.029309 IP txxxxxx1.corp.mxxxxxxs.com.58238 > dxxxxxx3.corp.mxxxxxxs.com.domain:  10345+ PTR? (44)
21:03:05.065058 IP dxxxxxx3.corp.mxxxxxxs.com.domain > txxxxxx1.corp.mxxxxxxs.com.58238:  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
10.xxx.131.0   U     0      0        0 eth0     U     0      0        0 eth0         10.xxx.131.1         UG    0      0        0 eth0

Contents of /etc/hosts:       localhost.localdomain localhost
::1     localhost6.localdomain6 localhost6
10.xxx.131.xxx      txxxxxx1.corp.mxxxxxxs.com ast01
10.xxx.32.xxx       mail.mxxxxxxs.com

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.

  • 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.

domain corp.mxxxxxxs.com

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

See the manpage for more details.

  • 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. – tsz Jan 24 '12 at 4:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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