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

标签 dns virtualbox nat

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.


谁能真正理解其中的区别?
编辑:需要一个实际的例子。

最佳答案

如果 natdnsproxy如果启用了 NAT 类型的网络适配器选项,VirtualBox 的 NAT 网关将接受来自 guest 的 DNS 流量并将其转发到主机使用的解析器。它将仅充当网络层代理。只有发送到网关 IP 的 DNS 流量会被重定向,它不会拦截发送到其他 IP 的 DNS 流量。确保您的访客使用您的网关 IP(例如 10.0.2.2 )作为解析器(如果您的访客使用 DHCP,这应该可以直接使用)。
natdnshostresolver选项类似——它也会导致 NAT 网关接受 DNS 流量——但网关将读取(即解析)查询并使用主机的操作系统 API 来解决它。在 Linux 上,这将是 getaddrinfo() .这是恕我直言的首选选项。

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

关于dns - virtualbox:--natdnsproxy1 和--natdnshostresolver1 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51060639/

相关文章:

ruby - vagrant 管理主机 dhcp

Azure VPN 连接和公共(public) IP

cakephp - 在 CakePHP 中按主机名路由

dns - 我在哪里可以购买 .app TLD?

iPhone离线缓存的应用程序在Safari中关闭后消失?

delphi - 确定何时在虚拟机中运行

java - VirtualBox:使用 SDK API 在 guest 中启动程序?

dns - Azure DNS 查找 CNAME 超时

node.js - 无法将 UDP 发送回 NAT 后面的内部 PC

routes - mikrotik nat 从本地重定向到本地