For a project I need to intercept/redirect DNS queries to a VM, which in turn runs dnsmasq. This VM is hosted by xhyve and when connected to the network, the setup works well; I have an file in /etc/resolver.conf/test.io which has:

search_order 1

Doing dig node.test.io @ or dig node.test.io give the expected results.

But when going offline, there is a problem. It seems that when macOS is not connected to a network, it only allows /etc/resolver.conf/* entries to work when they use

I tried setting up a port-forwarding, like:

$ echo "                           
rdr pass inet proto udp from any to port 53 -> port 53
" | sudo pfctl -ef -

and changing /etc/resolver.conf/test.io to:

search_order 1

However, the domain test.io can not be found when I try to do a nslookup or dig node.test.io @localhost. The VM is still reachable as dig node.test.io @ still gets resolved.

scutil --dns gives the following:

resolver #9
  domain   : test.io
  nameserver[0] :
  flags    : Request A records, Request AAAA records
  reach    : 0x00030002 (Reachable,Local Address,Directly Reachable Address)
  order    : 1

Note: nslookup does not seem to handle resolver well, so I have also tried to use curl/wget and the browser to see if queries got resolved correctly. Also, no difference with dns-sd. All failed...


In disconnected mode there is no DNS query going at all... We solved this by adding a TUN/TAP device to the macOS node and 'pretend' with this that it is connected.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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