[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:
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).
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
nslookup have any problems resolving the IP. Below is an image when all the aforementioned tools are working:
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 Server: 192.168.56.2 Address: 192.168.56.2#53 Name: mipal.int Address: 192.168.56.2 user@host:[13:26]$ host mipal.int mipal.int has address 192.168.56.2 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 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ;; QUESTION SECTION: ;mipal.int. IN A ;; ANSWER SECTION: mipal.int. 60 IN A 192.168.56.2 ;; AUTHORITY SECTION: mipal.int. 60 IN NS ns2.abms.int. mipal.int. 60 IN NS ns1.abms.int. ;; ADDITIONAL SECTION: ns1.abms.int. 60 IN A 192.168.56.2 ns2.abms.int. 60 IN A 192.168.56.2 ;; Query time: 0 msec ;; SERVER: 192.168.56.2#53(192.168.56.2) ;; 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.)