Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

virtualbox: what is the difference of --natdnsproxy1 and --natdnshostresolver1?

The virtualbox documentation did not explain it clearly.

https://www.virtualbox.org/manual/ch09.html

9.11.5. Enabling DNS proxy in NAT mode The NAT engine by default offers the same DNS servers to the guest that are configured on the host. In some scenarios, it can be desirable to hide the DNS server IPs from the guest, for example when this information can change on the host due to expiring DHCP leases. In this case, you can tell the NAT engine to act as DNS proxy using the following command:

VBoxManage modifyvm "VM name" --natdnsproxy1 on

9.11.6. Using the host's resolver as a DNS proxy in NAT mode For resolving network names, the DHCP server of the NAT engine offers a list of registered DNS servers of the host. If for some reason you need to hide this DNS server list and use the host's resolver settings, thereby forcing the VirtualBox NAT engine to intercept DNS requests and forward them to host's resolver, use the following command:

VBoxManage modifyvm "VM name" --natdnshostresolver1 on Note that this setting is similar to the DNS proxy mode, however whereas the proxy mode just forwards DNS requests to the appropriate servers, the resolver mode will interpret the DNS requests and use the host's DNS API to query the information and return it to the guest.

can anyone really understand the difference?

EDIT: need a actual example.

like image 682
osexp2003 Avatar asked Jun 27 '18 10:06

osexp2003


People also ask

What is VirtualBox NAT network?

Network Address Translation (NAT) is the simplest way of accessing an external network from a virtual machine. Usually, it does not require any configuration on the host network and guest system. For this reason, it is the default networking mode in Oracle VM VirtualBox.

How do I create a NAT network in VirtualBox?

Open VirtualBox Preferences (File -> Preferences) and go to Network Tab. Click on the + icon on right side (Adds new NAT network). It will create a new NAT Network without asking any questions. You can also add Port Forwarding for accessing VM (over ssh or http kind of protocols).


1 Answers

If the natdnsproxy option of a NAT-typed network adapter is enabled, VirtualBox's NAT gateway will accept DNS traffic from the guest and forward it to the resolver used by the host. It will solely act as a network-layer proxy. Only DNS traffic sent to the gateway IP will be redirected, it will not intercept DNS traffic sent to other IPs. Make sure your guest is using your gateway IP (e.g. 10.0.2.2) as resolver (this should work out of the box if your guest does DHCP).

The natdnshostresolver option is similiar - it will cause the NAT gateway to accept DNS traffic too - but the gateway will read (i.e. parse) the query and use the host's operating system APIs to resolve it. On Linux this would be getaddrinfo(). This is the preferred option IMHO.

The number (1) refers to the network adapter and is interchangable. --natdnshostresolver2 on would enable the option for the second interface of the given VM.

like image 168
fnkr Avatar answered Sep 23 '22 18:09

fnkr