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
Best Answer
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
andnslookup
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 thekillall
command.Source: Snoop Dogg on that same thread.