DNS lookup for NAT resets when computer does

Discussions related to using VirtualBox on Windows hosts.
Post Reply
HofDS
Posts: 3
Joined: 22. Apr 2021, 19:30

DNS lookup for NAT resets when computer does

Post 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.
fth0
Volunteer
Posts: 5677
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: DNS lookup for NAT resets when computer does

Post 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.
HofDS
Posts: 3
Joined: 22. Apr 2021, 19:30

Re: DNS lookup for NAT resets when computer does

Post by HofDS »

UPDATE:

it actually just happened after shuting down the guest and the restarting the guest.
HofDS
Posts: 3
Joined: 22. Apr 2021, 19:30

Re: DNS lookup for NAT resets when computer does

Post by HofDS »

@ fth0

I will try it, but why would VBManage.exe make a permanent change with one and not the other?
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: DNS lookup for NAT resets when computer does

Post 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.
fth0
Volunteer
Posts: 5677
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: DNS lookup for NAT resets when computer does

Post 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.
Post Reply