Page 1 of 1

DNS lookup for NAT resets when computer does

Posted: 22. Apr 2021, 19:40
by HofDS
I'm running

Version 6.1.16 r140961 (Qt5.6.2) on Windows 10

After installing VB and selecting NAT as my network configuration of choice, I could ping the outside internet, but couldn't resolve websites by name.

I resolved the problem by running

Code: Select all

./VBoxManage.exe modifyvm "Ubuntu NiFi" --natdnshostresolver1 on
from the VB directory via PowerShell.

This seemed to solve my DNS problem immediately, but the modification seems to only last temporarily. Every time the host computer restarts I have to rerun the command.

I'd like to be able to have VB always use the host for DNS resolution as I run VPNs on the host and need to access the host's current understanding of DNS instead of Googles.

I'd appreciate any help on how to permanently make VB use the host for resolving URLs.

Re: DNS lookup for NAT resets when computer does

Posted: 22. Apr 2021, 20:19
by fth0
I'm not sure about this, but you could try if the natdnsproxy option works for you. For details, see 9.8.5. Enabling DNS Proxy in NAT Mode.

Re: DNS lookup for NAT resets when computer does

Posted: 22. Apr 2021, 20:32
by HofDS
UPDATE:

it actually just happened after shuting down the guest and the restarting the guest.

Re: DNS lookup for NAT resets when computer does

Posted: 22. Apr 2021, 20:39
by HofDS
@ fth0

I will try it, but why would VBManage.exe make a permanent change with one and not the other?

Re: DNS lookup for NAT resets when computer does

Posted: 22. Apr 2021, 20:45
by scottgus1
I tried the " --natdnshostresolver1 on" command on a scrap VM I had, and the following lines were added to the NAT adapter XML:
<Network>
<Adapter slot="0" enabled="true" MACAddress="0800276AE2E5" cable="true" type="82540EM">
<NAT>
<DNS use-host-resolver="true"/>
</NAT>
</Adapter>
</Network>
Check to see if that line gets added to your VM's .vbox file after you run the command, and if it is still there after your host reboots, then if it is still there after you run and shut down the VM.

Re: DNS lookup for NAT resets when computer does

Posted: 23. Apr 2021, 01:32
by fth0
HofDS wrote:I will try it, but why would VBManage.exe make a permanent change with one and not the other?
I can only make an educated guess: Whereas the DNS Proxy mode probably almost always works, the Host's Resolver mode only works if VirtualBox knows how to find it. If the latter does not work out, this mode is not used, and perhaps the configuration setting is then turned off, leading to it being omitted when writing back the .vbox file after the VM is shut down.