up vote 4 down vote favorite
2
share [g+] share [fb]

I think this started with the Snow Leopard update. Cleaned out the .ssh directory, still having the issue.

~: uname -a
Darwin california-example-com.local 10.0.0 Darwin Kernel Version 10.0.0: Fri Jul 31 22:47:34 PDT 2009; root:xnu-1456.1.25~1/RELEASE_I386 i386

~: ssh -V
OpenSSH_5.2p1, OpenSSL 0.9.8k 25 Mar 2009

~: ls -l ~/.ssh

~: nslookup nevada
Server:     10.94.62.3
Address:    10.94.62.3#53

Name:   nevada.example.com
Address: 10.94.62.3

~: ssh nevada
ssh: Could not resolve hostname nevada: nodename nor servname provided, or not known
link|improve this question
Can you ssh to (a) nevada.example.com and (b) 10.94.62.3? – SvenW Sep 12 '09 at 20:02
2  
Can you ping nevada? What does "ssh -v nevada" show? – markdrayton Sep 12 '09 at 20:44
Odd question; do you use Split DNS and/or can ping nevada? – Chealion Sep 13 '09 at 6:48
Thanks for the follow-ups... answers: ssh nevada.example.com = no ssh 10.94.62.3 = yes (and had to confirm host key because I'd cleared known hosts) ping nevada = name resolution problem telnet nevada (tho it doesn't run telnetd) = name resolution problem Split DNS = not intentionally, don't know what it is :-) From OS X network settings pane, I've got 10.94.62.3 as the DNS server listed before the two provided by my ISP, and example.com in the search domains list. Other systems on my network can use DNS normally to ssh to nevada (and others). – Peter Cardona Sep 13 '09 at 17:21
sorry about the lack of line breaks in the above comment... – Peter Cardona Sep 13 '09 at 17:22
feedback

9 Answers

up vote 6 down vote accepted

I ran into the exact same problem and found a thread about a Mac mini having DNS issues on Apple's Discussions extremely helpful.

The crux of the issue: mDNSResponder seems to occasionally change the order of the DNS servers it queries and so if it queries your ISP's DNS servers first it won't get a proper record (or if you're using split DNS you'll get your public IP).

The best fix for this is to ensure (as you did) that only the required DNS servers are listed in your DNS settings. This may require removing the ISP DNS servers from your DHCP (as I had to do as well - all requests are forwarded through the local DNS server anyway).

The reason utilities like dig and nslookup will succeed as normal is they are using BIND and /etc/resolv.conf directly unlike the rest of the operating system.

For reference in Snow Leopard the DNS cache is now stored by mDNSResponder and in order to clear it you need to restart the process using sudo killall -HUP mDNSResponder. You can get more info (logging, dump internal state, etc.) by using different flags to the killall command.

"sudo killall -USR1 mDNSResponder" to enable operation logging.
"sudo killall -USR2 mDNSResponder" to enable packet logging.
"sudo killall -HUP mDNSResponder" to clear the DNS cache.
"sudo killall -INFO mDNSResponder" to dump mDNSRepsonder's internal state.

Source: Snoop Dogg on that same thread.

link|improve this answer
Thanks, googling led me here, this fixed it. "arp" reported the wrong IP, dig reported the correct "ip". No amount of dns flushing fixed it before I tried this. I do note that I had to execute the dscacheutil -flushcache as well. I'd also point out that local routers can behave strangely and ISPs don't also play fair in terms of TTL sometimes. – Aitch Oct 5 '11 at 9:18
feedback

I noticed I had 10.94.62.3 in the DNS server list (network prefs pane) followed by 2 from my ISP. I removed the other 2, forcing all name lookups thru 10.94.62.3 for this Location and now I can resolve names on my network as well as outside.

No idea why this worked.

link|improve this answer
feedback

we had problems like this:

host someaddress.com     <<< WORKED
ping someaddress.com     <<< FAILED

Solved with something like this:

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist

Applications on Mac OS X do not use the same mechanism for DNS as "host/dig/nslookup".

Using "host/dig/nslookup" were useful for determining this was not a network issue. It was an issue with the local system resolved with the above commands.

link|improve this answer
wow that worked!!! I've been looking everywhere for a solution!!!! i was just about to format and restore my laptop, you saved me a ton of time! thanks! sorry but I couldn't upvote :-( Note: My DNS stopped working after I ran the Util OnyX, don't know why. I was able to use dig/nslookup but nothing else. – user85044 Jun 20 '11 at 3:13
feedback

Have you tried nevada-example-com.local?

link|improve this answer
Had not tried that, but got same resolution issue. Starting to seem like NOTHING (ssh, telnet, ping, http) resolves thru the server that nslookup is defaulting to. How could that be? Maybe a conflict between the OS X level settings and some /etc/whatever file that the underlying BSD implementation cares about? – Peter Cardona Sep 13 '09 at 17:25
No, OS X does not use init levels — not even the BSD syubsystem. – Nerdling Sep 13 '09 at 20:05
feedback
dscacheutil -flushcache

That command refreshes your DNS cache.

Is 10.94.62.3 a DNS Server you trust? If so, why is there only one? You should have at least 2 DNS servers to refer to for failover purposes. If that one goes down, you're a sitting duck.

link|improve this answer
feedback

I also experienced the same problem. I tried "ping www.google.com" with resolve failure message but "nslookup www.google.com" gives a correct answer. The command "dscacheutil -q host -a name www.google.com" gives nothing. That means the DNS lookup library in Mac fails but not the standard Internet lookup. This is what I know so far. I have no idea on how to solve this issue. Neither I know why it occured.

link|improve this answer
feedback

DNS order lookups seems to work differently in Snow Leopard. If you can't lookup a domain, check to see if you have any invalid DNS servers listed in your network preferences. If you are using a standard DHCP setup, then you shouldn't have any DNS Servers listed. Prior to my upgrate I had an old DNS server listed, and it didn't affect anything. Once I upgraded I totally lost dns.

Open Network Preferences > Choose Airport > Advanced. Select the DNS tab, and remove any DNS Servers that are invalid.

link|improve this answer
feedback

I had the same problem with nslookup resolving my windows box, but ping giving me a "unknown host". I tried what Navdeep suggested and went to clear out the nameservers in the Network Preferences->Advanced->DNS tab. It would not let me subtract them, they were grayed out. I finally hit the + and they disappeared. I canceled adding a new one and applied changes, once no DNS servers were showing. Ping started working after that. The strange thing is that my local router/DHCP server was the first in the list and is the one responsible for resolving the Windows box. It must be something weird with the ordering. The other nameserver listed, is a work NS and would not be able to resolve the windows host. THANKS Navdeep!

link|improve this answer
feedback

Have you looked at Console? (Applications -> Utilities -> Console) You may find that mDNSResponder is showing up under: Diagnostic and Usage Information -> System Diagnostic Reports

If it's crashing due to another program which is loading modules (such as Little Snitch or Hands Off) you may see it there.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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