[VirtualBox 5.1.30 r118389 (Qt5.6.3), HOST: MacBook Pro High Sierra 10.13.1, GUEST: Ubuntu 14.04 LTS]

My VM is setup with two NICs, one using NAT, the other using Host-Only Networking. My VM is running a DNS server and I have manually added its local IP to the DNS tab on my Mac's System Preferences -> Network Settings page for each adapter. Overall, the setup works fine. From the HOST, I am able to browse the virtual-hosts I have on the VM as well as the internet. From the GUEST, I am able to access the internet to get package updates etc.

However, periodically and unpredictably, the mDNSResponder on my Mac forgets the IP of my virtual-host and my browser, FireFox, returns the Server Not Found page. Using the Console.app and killing mDNSResponder with the INFO flag, I am able to capture mDNSResponder's cache. The picture below shows that mipal.int has an empty address, while another internal domain, jmfull.int, has the correct address:

mipal.int has empty IP address

In order to fix this, I flush the DNS cache on the Mac, after which I am able to continue doing what I was doing, that is, until the problem recurs. I use the following commands to flush my DNS:

sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder
sudo killall mDNSResponderHelper

Occasionally, after a some delay, the DNS record is restored without me having flushed the cache, but this not an acceptable workaround as the delay is unpredictable and can be quite long.

I have used Wireshark to try and track down the problem and, I think it has to do with mDNSResponder closing the port from which it made the DNS request to my DNS server before the DNS server was able to respond. This is evidenced by my Mac sending a Destination Unreachable (Port Unreachable) message to my DNS server on the port the DNS used to send its reply to the earlier request. The image below demonstrates the port closure problem (UDP port 55179).

enter image description here Note the timestamp of each packet.

What is interesting is that the DNS request in the image had nothing to do with the mipal.int domain I'm having problems with. I suspect there is some sort of accounting problem within mDNSResponder.

This problem only occurs with respect to the domains I host on the VM and for whom my local DNS is the Authoritative server. Whilst I am not able to browse the domain, nor able to ping it, neither dig, host, nor nslookup have any problems resolving the IP. Below is an image when all the aforementioned tools are working:

enter image description here

Then, when mDNSResponder forgets the address, the same tools give the following results (notice ping is the only one that does not work):

user@host:[13:26]$ ping mipal.int
ping: cannot resolve mipal.int: Unknown host

user@host:[13:25]$ nslookup mipal.int

Name:   mipal.int

user@host:[13:26]$ host mipal.int
mipal.int has address
mipal.int mail is handled by 10 mail.mipal.int.

user@host:[13:26]$ dig mipal.int

; <<>> DiG 9.9.7-P3 <<>> mipal.int
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 46994
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 3

; EDNS: version: 0, flags:; udp: 4096
;mipal.int.         IN  A

mipal.int.      60  IN  A

mipal.int.      60  IN  NS  ns2.abms.int.
mipal.int.      60  IN  NS  ns1.abms.int.

ns1.abms.int.       60  IN  A
ns2.abms.int.       60  IN  A

;; Query time: 0 msec
;; WHEN: Mon Nov 27 13:26:39 AEST 2017
;; MSG SIZE  rcvd: 127

This problem is similar in ways to another unanswered question here, from way back in 2012: ping and browsers do not seem to use local DNS server? (or: mDNSResponder looses local dns server?)

Any advice on how to overcome this problem is welcome.

(I would like to add the tag: mDNSResponder but don't have the reputation to do so.)

  • Please add text as text (e.g. the Terminal window containing: ... nslookup mipal.int and following)! – klanomath Nov 25 '17 at 13:50
  • What's the purpose of the Host-Only Networking NIC AND the NAT? My advice: replace the NAT/host-only NIC with a bridged network NIC attached to en0 (or en1) and run the DNS server on your Mac! – klanomath Nov 25 '17 at 14:39
  • With a bridged network, the IP changes depending on the location I'm in, and it also depends on which device (Airport or Thunderbolt Ethernet) I use to connect to the net/lan. This causes major problems for hosting my DNS server since it doesn't know what it's IP will be, and the DNS records for each of my domains would need to be updated. This makes it very cumbersome to maintain. – gone Nov 25 '17 at 18:18
  • Then set-up NAT only & port-forwarding for the VM(s) and a DNS server like dnsmasq (for name resolution in but forwarding other DNS requests to the router or directly to on the macOS host! – klanomath Nov 25 '17 at 18:23
  • Thanks for the suggestions, but I would like to fix the problem as the arrangement is otherwise working fine. – gone Nov 27 '17 at 1:41

You must log in to answer this question.

Browse other questions tagged .