I have a local domain for my home network, which uses .loc as a TLD (not .local). Name resolution for hosts on that network always works using dig or nslookup from a terminal, but intermittently fails everywhere else. One day it will work fine and I'll start regrowing my hair, and the next I'm unable to ssh to another machine to save my life.

Is this an mDNSResponder/Bonjour issue? I have tried simply disabling mDNSResponder, but SIP disallows it (and IT is unlikely to go along with disabling SIP). Flushing DNS doesn't help. What else can I try?

mac:~ user$ sudo killall -HUP mDNSResponder
mac:~ user$ scp ~/.ssh/id_rsa.pub user@kube1.domain.loc:/id_rsa.pub
ssh: Could not resolve hostname kube1.domain.loc: nodename nor servname provided, or not known
lost connection
mac:~ user$ dig kube1.domain.loc

; <<>> DiG 9.8.3-P1 <<>> kube1.domain.loc
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 59092
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;kube1.domain.loc.          IN  A

kube1.domain.loc.       900 IN  A

;; Query time: 4 msec
;; WHEN: Thu Feb  1 18:59:51 2018
;; MSG SIZE  rcvd: 48

mac:~ user$ 
  • Despite its name, mDNSResponder does all lookups on macOS, both multicast and unicast. As for the problem: do you have multiple DNS servers configured? If so, do the .loc lookups work on all of them? – Gordon Davisson Feb 2 '18 at 7:02
  • I have an internal server, and as an external backup. That could explain it if mDNS doesn't reliably use the primary first. I'll try changing the config in DHCP in the morning... – superstator Feb 2 '18 at 7:12

macOS doesn't treat its DNS server list as having any sort of priority at all, it just scatters queries across all of them in a semirandom fashion. Set it to only use the internal DNS server, and you should get much more reliable lookups.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .