Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I've recently (as in minutes ago) added a hostname and reverse (A and PTR) records for a hostname on my internal network, using a Bind DNS server. For some reason, i can both dig and nslookup this new name successfully, but ping and my GUI applications can not resolve the name.

I have attempted flushing the DNS cache on my local machine with dscacheutil -flushcache to no effect.

Here's an example of my session (names, IPs changed for security):

$ nslookup newbox.internal
server     10.0.0.2
address    10.0.0.2#53

Name:    newbox.internal
Address: 10.1.1.1

$ ping newbox.internal
ping: cannot resolve newbox.internal: Unknown host

WTF? Okay, I'm sure my DNS is set up correctly though:

$ dig newbox.internal

; <<>> DiG 9.8.3-P1 <<>> newbox.internal
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 33812
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 4

;; QUESTION SECTION:
;newbox.internal.   IN  A

;; ANSWER SECTION:
newbox.internal. 21600 IN   A   10.1.1.1

;; AUTHORITY SECTION:
internal.       10800   IN  NS  dns001.internal.
internal.       10800   IN  NS  dss001.internal.
internal.       10800   IN  NS  dhdns001.internal.
internal.       10800   IN  NS  dhdns002.internal.

;; ADDITIONAL SECTION:
dns001.internal. 10800 IN   A   10.0.0.2
dns002.internal. 10800 IN   A   10.0.0.3
dhdns001.internal. 10800 IN A   10.0.0.20
dhdns002.internal. 10800 IN A   10.0.0.21

;; Query time: 1 msec
;; SERVER: 10.0.0.2#53(10.0.0.2)
;; WHEN: Mon Jul  1 14:43:35 2013
;; MSG SIZE  rcvd: 245

Why does my system demonstrate this odd DNS resolver behavior?

As a side note, DNS works fine otherwise on my system. At this moment, this new hostname is the only one I'm having trouble resolving. My system is configured to use the 10.0.0.2 DNS server as it's primary.

EDIT

Killing mDNSResponder fixed this issue.. but why?

share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted

Killing mDNSResponder fixed this issue.. but why?

Because you flushed the local DNS cache!

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

A direct lookup command will query the DNS server directly, however the resolution mechanism for just about anything else is that mDNSResponder process you killed.

dscacheutil -flushcache is deprecated as per the KB.

share|improve this answer
    
I did not know that was the official method. Neat, and thanks for the pointer! –  Mikey T.K. Jun 7 at 19:42
add comment

From man nslookup and man dig:

Mac OS X NOTICE

The nslookup command does not use the host name and address resolution or the DNS query routing mechanisms used by other processes running on Mac OS X. The results of name or address queries printed by nslookup may differ from those found by other processes that use the Mac OS X native name and address resolution mechanisms. The results of DNS queries may also differ from queries that use the Mac OS X DNS routing library.

man host has the same notice. ping however does not.

More information and possible solution here:

DNS lookups fail with e.g. `ping`, but work with `host`

share|improve this answer
add comment

Your Answer

 
discard

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.