Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am using Mac OS X 10.6.8. When I am trying to ping a particular domain it returns me "Unknown host" but when I run nslookup on that same host immediately it returns me the correct IP.

Ping continues to throw the DNS error for almost a minute and then recovers automatically.

I looked into /var/log/system.log of my system and found the below entries logged at the time of failure. I used the following commands to get the debug logs.

"killall -USR1 mDNSResponder"
"killall -USR2 mDNSResponder"
"killall -INFO mDNSResponder"

Log entries during failure:

Feb 24 12:50:25 Administrators-MacBook-Pro-15 mDNSResponder[30]:  29: Adding FD for uid 501\
Feb 24 12:50:25 Administrators-MacBook-Pro-15 mDNSResponder[30]:  29: DNSServiceCreateConnection START\
Feb 24 12:50:25 Administrators-MacBook-Pro-15 mDNSResponder[30]:  29: Error socket 30 created 00000000 00000001\
Feb 24 12:50:25 Administrators-MacBook-Pro-15 mDNSResponder[30]:  29: DNSServiceQueryRecord(5000, 0, api-beta.mydomain.com., Addr) START\
Feb 24 12:50:25 Administrators-MacBook-Pro-15 mDNSResponder[30]:  29: Error socket 30 closed  00000000 00000001 (0)\
Feb 24 12:50:25 Administrators-MacBook-Pro-15 mDNSResponder[30]:  29: DNSServiceQueryRecord(api-beta.mydomain.com., Addr) ADD    0 api-beta.mydomain.com. Addr \
Feb 24 12:50:25 Administrators-MacBook-Pro-15 mDNSResponder[30]:  29: Cancel 00000000 00000001\
Feb 24 12:50:25 Administrators-MacBook-Pro-15 mDNSResponder[30]:  29: DNSServiceQueryRecord(api-beta.mydomain.com., Addr) STOP\
Feb 24 12:50:25 Administrators-MacBook-Pro-15 mDNSResponder[30]:  29: Error socket 30 created 00000000 00000002\
Feb 24 12:50:25 Administrators-MacBook-Pro-15 mDNSResponder[30]:  29: DNSServiceQueryRecord(5000, 0, api-beta.mydomain.com., Addr) START\
Feb 24 12:50:25 Administrators-MacBook-Pro-15 mDNSResponder[30]:  29: Error socket 30 closed  00000000 00000002 (0)\
Feb 24 12:50:25 Administrators-MacBook-Pro-15 mDNSResponder[30]:  29: DNSServiceQueryRecord(api-beta.mydomain.com., Addr) ADD    0 api-beta.mydomain.com. Addr \
Feb 24 12:50:25 Administrators-MacBook-Pro-15 mDNSResponder[30]:  29: Cancel 00000000 00000002\
Feb 24 12:50:25 Administrators-MacBook-Pro-15 mDNSResponder[30]:  29: DNSServiceQueryRecord(api-beta.mydomain.com., Addr) STOP\
Feb 24 12:50:25 Administrators-MacBook-Pro-15 mDNSResponder[30]:  29: DNSServiceCreateConnection STOP\
Feb 24 12:50:25 Administrators-MacBook-Pro-15 mDNSResponder[30]:  29: Removing FD\
Feb 24 12:50:42 Administrators-MacBook-Pro-15 sudo[3675]: administrator : TTY=ttys004 ; PWD=/Users/administrator ; USER=root ; COMMAND=/usr/bin/killall -INFO mDNSResponder\
Feb 24 12:50:42 Administrators-MacBook-Pro-15 mDNSResponder[30]: ---- BEGIN STATE LOG ---- mDNSResponder mDNSResponder-258.21 (May 26 2011 14:40:13)\
Feb 24 12:50:42 Administrators-MacBook-Pro-15 mDNSResponder[30]: Timenow 0x91434D92 (-1857860206)\
Feb 24 12:50:42 Administrators-MacBook-Pro-15 mDNSResponder[30]: ------------ Cache -------------\
Feb 24 12:50:42 Administrators-MacBook-Pro-15 mDNSResponder[30]: Slt Q     TTL if     U Type rdlen\
Feb 24 12:50:42 Administrators-MacBook-Pro-15 mDNSResponder[30]:  28       269 -U-    - AAAA     0 api-beta.mydomain.com. AAAA \
Feb 24 12:50:42 Administrators-MacBook-Pro-15 mDNSResponder[30]:  28        31 -U-    - Addr     0 api-beta.mydomain.com. Addr \

The below entries are logged after it has recovered from a DNS failure for a minute.

Log entries during success:

Feb 24 12:52:55 Administrators-MacBook-Pro-15 mDNSResponder[30]:  29: Adding FD for uid 501\
Feb 24 12:52:55 Administrators-MacBook-Pro-15 mDNSResponder[30]:  29: DNSServiceCreateConnection START\
Feb 24 12:52:55 Administrators-MacBook-Pro-15 mDNSResponder[30]:  29: Error socket 30 created 00000000 00000001\
Feb 24 12:52:55 Administrators-MacBook-Pro-15 mDNSResponder[30]:  29: DNSServiceQueryRecord(5000, 0, api-beta.mydomain.com., Addr) START\
Feb 24 12:52:55 Administrators-MacBook-Pro-15 mDNSResponder[30]:  29: Error socket 30 closed  00000000 00000001 (0)\
Feb 24 12:52:56 Administrators-MacBook-Pro-15 mDNSResponder[30]: -- Sent UDP DNS Query (flags 0100) RCODE: NoErr (0) RD ID: 34816 29 bytes from port 62558 to 192.168.1.1:53 --\
Feb 24 12:52:56 Administrators-MacBook-Pro-15 mDNSResponder[30]:  1 Questions\
Feb 24 12:52:56 Administrators-MacBook-Pro-15 mDNSResponder[30]:  0 api-beta.mydomain.com. Addr\
Feb 24 12:52:56 Administrators-MacBook-Pro-15 mDNSResponder[30]:  0 Answers\
Feb 24 12:52:56 Administrators-MacBook-Pro-15 mDNSResponder[30]:  0 Authorities\
Feb 24 12:52:56 Administrators-MacBook-Pro-15 mDNSResponder[30]:  0 Additionals\
Feb 24 12:52:56 Administrators-MacBook-Pro-15 mDNSResponder[30]: --------------\
Feb 24 12:52:56 Administrators-MacBook-Pro-15 mDNSResponder[30]: -- Received UDP DNS Response (flags 8180) RCODE: NoErr (0) RD RA ID: 34816 45 bytes from 192.168.1.1:53 to 192.168.1.2:62558 --\
Feb 24 12:52:56 Administrators-MacBook-Pro-15 mDNSResponder[30]:  1 Questions\
Feb 24 12:52:56 Administrators-MacBook-Pro-15 mDNSResponder[30]:  0 api-beta.mydomain.com. Addr\
Feb 24 12:52:56 Administrators-MacBook-Pro-15 mDNSResponder[30]:  1 Answers\
Feb 24 12:52:56 Administrators-MacBook-Pro-15 mDNSResponder[30]:  0 TTL      30    4 api-beta.mydomain.com. Addr 172.16.2.176\
Feb 24 12:52:56 Administrators-MacBook-Pro-15 mDNSResponder[30]:  0 Authorities\
Feb 24 12:52:56 Administrators-MacBook-Pro-15 mDNSResponder[30]:  0 Additionals\
Feb 24 12:52:56 Administrators-MacBook-Pro-15 mDNSResponder[30]: --------------\
Feb 24 12:52:56 Administrators-MacBook-Pro-15 mDNSResponder[30]:  29: DNSServiceQueryRecord(api-beta.mydomain.com., Addr) ADD    4 api-beta.mydomain.com. Addr 172.16.2.176\
Feb 24 12:52:56 Administrators-MacBook-Pro-15 mDNSResponder[30]:  29: Cancel 00000000 00000001\
Feb 24 12:52:56 Administrators-MacBook-Pro-15 mDNSResponder[30]:  29: DNSServiceQueryRecord(api-beta.mydomain.com., Addr) STOP\
Feb 24 12:52:59 Administrators-MacBook-Pro-15 mDNSResponder[30]:  29: DNSServiceCreateConnection STOP\
Feb 24 12:52:59 Administrators-MacBook-Pro-15 mDNSResponder[30]:  29: Removing FD\
Feb 24 12:53:18 Administrators-MacBook-Pro-15 mDNSResponder[30]: ---- BEGIN STATE LOG ---- mDNSResponder mDNSResponder-258.21 (May 26 2011 14:40:13)\
Feb 24 12:53:18 Administrators-MacBook-Pro-15 mDNSResponder[30]: Timenow 0x9145AF41 (-1857704127)\
Feb 24 12:53:18 Administrators-MacBook-Pro-15 mDNSResponder[30]: ------------ Cache -------------\
Feb 24 12:53:18 Administrators-MacBook-Pro-15 mDNSResponder[30]: Slt Q     TTL if     U Type rdlen\
Feb 24 12:53:18 Administrators-MacBook-Pro-15 mDNSResponder[30]:  28       113 -U-    - AAAA     0 api-beta.mydomain.com. AAAA \
Feb 24 12:53:18 Administrators-MacBook-Pro-15 mDNSResponder[30]:  28        17 -U-      Addr     4 api-beta.mydomain.com. Addr 172.16.2.176\

This is happening randomly and I am able to reproduce the case every time, but not able to understand the cause of the error.

Does anyone know why ping is failing with "Unknown host" and how to resolve it?

Thank you!

share|improve this question

closed as off-topic by HopelessN00b, Ward, Katherine Villyard, mdpc, TheCleaner Feb 27 at 14:42

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must be relevant to professional system administration. Server Fault is dedicated to professional system and network administrators. End user and enthusiast questions are off-topic (contact your system administrator or hire a professional to help you out). Please see the Help Center for more information." – HopelessN00b, Ward, Katherine Villyard, mdpc, TheCleaner
If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

Are you familiar with how mDNS is different from normal, regluar DNS? Not trying to be rude, but I wanted to point out that they're two different systems trying to solve similar problems, but it's important not to confuse the two.

So, to answer your question, it seems like you're connected to multiple networks and are receiving conflicting or infrequent responses via mdns. Specifically, from your log files you're getting mdns responses indicating 172.16.2.176 for api-beta.mydomain.com on the 192.168.1.2 interface - which doesn't seem to make much sense.

nslookup ought to directly query a DNS server for it's answer and since you indicated it was working correctly, I suspect that mdns is simply confusing everything. I recommend you disable the mdns unicast resolution using the following instructions from apple:

http://support.apple.com/kb/HT3789

I hope this does the trick! Good Luck

share|improve this answer
    
api-beta.mydomain.com resolves to 172.16.2.176 and the host is in different network. The IP 192.168.1.2 is my system IP. When I disable the mDNSResponder I am not able to ping any of the host. It also happen when I use my iPhone connected to my local WiFi. Can you please tell me 1) Does mDNSResponder is the local DNS resolver in iPhone? 2) Why it is storing null value in the cache instead of making a fresh lookup? –  Supratik Feb 24 at 14:02
    
mDNSResponder is for mDNS, not DNS. It's a broadcast system and not intended as a DNS replacement. If you're developing something that needs real DNS, consider using a proper DNS server. –  etherfish Feb 24 at 14:06
    
@etherfish: In recent versions of OS X, mDNSResponder handles all DNS resolution -- both multicast and regular unicast. –  Gordon Davisson Feb 24 at 17:11
    
@etherfish I am developing an app for iPhone which will by used by the users, so I have to use what apple uses by default. I first noticed the issue in iPhone and the same I am able to reproduce in my Mac. The above log messages are from the Mac system. I think it is something to do with mDNSResponder, Why it is storing null value in the cache instead of making a fresh lookup? –  Supratik Feb 25 at 3:41

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