virtualbox:--natdnsproxy1 和--natdnshostresolver1 有什么区别?

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

virtualbox文档没有解释清楚

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.

谁能真正理解其中的区别?

编辑:需要一个实际的例子。

如果启用 NAT-typed 网络适配器的 natdnsproxy 选项,VirtualBox 的 NAT 网关将接受来自来宾的 DNS 流量并将其转发到主机使用的解析器。它将仅充当 network-layer 代理。只有发送到网关 IP 的 DNS 流量会被重定向,它不会拦截发送到其他 IP 的 DNS 流量。确保您的来宾使用您的网关 IP(例如 10.0.2.2)作为解析器(如果您的来宾使用 DHCP,这应该开箱即用)。

natdnshostresolver 选项类似 - 它会导致 NAT 网关也接受 DNS 流量 - 但网关会读取(即解析)查询并使用主机的操作系统 API 来解析它。在 Linux 上,这将是 getaddrinfo()。这是首选选项恕我直言。

数字(1)是指网络适配器,可以互换。 --natdnshostresolver2 on 将为给定 VM 的第二个接口启用该选项。