我在 VMware 环境中。在主机上我执行
C:\WINDOWS\system32>nslookup www.vmware.com
Server: UnKnown
Address: 109.169.85.7
*** UnKnown can't find www.vmware.com: Query refused
但我可以在浏览器中访问该网站。一切都运行良好。我之所以有这个问题,是因为我的虚拟机无法访问互联网,当我从虚拟机 ping 到主机时,我可以 ping 并得到回复。从虚拟机 ping 到主机操作系统如下
C:\Users\Debian>ping 192.168.1.14
Pinging 192.168.1.14 with 32 bytes of data:
Reply from 192.168.1.14: bytes=32 time<1ms TTL=128
Reply from 192.168.1.14: bytes=32 time=2ms TTL=128
Reply from 192.168.1.14: bytes=32 time=3ms TTL=128
Reply from 192.168.1.14: bytes=32 time=1ms TTL=128
Ping statistics for 192.168.1.14:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 3ms, Average = 1ms
虚拟机上的 nslookup
C:\Users\Debian>nslookup www.vmware.com
Server: UnKnown
Address: 192.168.136.2
*** UnKnown can't find www.vmware.com: Query refused
因此在这两种情况下,我都得到了类似的 nslookup 查询拒绝输出。但输出有所不同,因为在主机上我得到的是 ip 地址。所以我想知道的是默认的 nslookup 行为是什么,我在主机操作系统上犯了什么错误。主机操作系统上的 ip 配置
Wireless LAN adapter Wi-Fi 2:
Connection-specific DNS Suffix . : domain.name
IPv4 Address. . . . . . . . . . . : 192.168.1.14
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1
在虚拟机上
Ethernet adapter Ethernet0:
Connection-specific DNS Suffix . : localdomain
IPv4 Address. . . . . . . . . . . : 192.168.136.128
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.136.2
虚拟机上route print的输出
===========================================================================
Interface List
12...00 0c 29 fb 2a 71 ......Intel(R) 82574L Gigabit Network Connection
1...........................Software Loopback Interface 1
===========================================================================
IPv4 Route Table
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.136.2 192.168.136.128 25
127.0.0.0 255.0.0.0 On-link 127.0.0.1 331
127.0.0.1 255.255.255.255 On-link 127.0.0.1 331
127.255.255.255 255.255.255.255 On-link 127.0.0.1 331
192.168.136.0 255.255.255.0 On-link 192.168.136.128 281
192.168.136.128 255.255.255.255 On-link 192.168.136.128 281
192.168.136.255 255.255.255.255 On-link 192.168.136.128 281
224.0.0.0 240.0.0.0 On-link 127.0.0.1 331
224.0.0.0 240.0.0.0 On-link 192.168.136.128 281
255.255.255.255 255.255.255.255 On-link 127.0.0.1 331
255.255.255.255 255.255.255.255 On-link 192.168.136.128 281
===========================================================================
Persistent Routes:
None
主机操作系统上的路由打印输出
===========================================================================
Interface List
25...18 60 24 13 ea a4 ......Realtek PCIe GbE Family Controller #2
2...00 50 56 c0 00 01 ......VMware Virtual Ethernet Adapter for VMnet1
16...00 50 56 c0 00 08 ......VMware Virtual Ethernet Adapter for VMnet8
12...0c b6 d2 cf 9e b1 ......D-Link DWA-131 Wireless N Nano USB Adapter(rev.E)
14...f8 da 0c 50 44 91 ......Realtek RTL8723DE 802.11b/g/n PCIe Adapter
1...........................Software Loopback Interface 1
===========================================================================
IPv4 Route Table
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.14 50
127.0.0.0 255.0.0.0 On-link 127.0.0.1 331
127.0.0.1 255.255.255.255 On-link 127.0.0.1 331
127.255.255.255 255.255.255.255 On-link 127.0.0.1 331
192.168.1.0 255.255.255.0 On-link 192.168.1.14 306
192.168.1.14 255.255.255.255 On-link 192.168.1.14 306
192.168.1.255 255.255.255.255 On-link 192.168.1.14 306
192.168.56.0 255.255.255.0 On-link 192.168.56.1 291
192.168.56.1 255.255.255.255 On-link 192.168.56.1 291
192.168.56.255 255.255.255.255 On-link 192.168.56.1 291
192.168.136.0 255.255.255.0 On-link 192.168.136.1 291
192.168.136.1 255.255.255.255 On-link 192.168.136.1 291
192.168.136.255 255.255.255.255 On-link 192.168.136.1 291
224.0.0.0 240.0.0.0 On-link 127.0.0.1 331
224.0.0.0 240.0.0.0 On-link 192.168.1.14 306
224.0.0.0 240.0.0.0 On-link 192.168.56.1 291
224.0.0.0 240.0.0.0 On-link 192.168.136.1 291
255.255.255.255 255.255.255.255 On-link 127.0.0.1 331
255.255.255.255 255.255.255.255 On-link 192.168.1.14 306
255.255.255.255 255.255.255.255 On-link 192.168.56.1 291
255.255.255.255 255.255.255.255 On-link 192.168.136.1 291
===========================================================================
Persistent Routes:
None
这是主机上的虚拟网络编辑器的屏幕截图
以及虚拟机上的网络适配器配置
因为我的虚拟机没有连接到互联网,并且我在 vmnet 中使用 NAT 配置,所以我想了解 nslookup 输出中的问题出在哪里。
更新 1
这是我执行虚拟机 nslookup 时的输出
C:\Users\Debian>nslookup www.vmware.com
Server: UnKnown
Address: 192.168.136.2
DNS request timed out.
timeout was 2 seconds.
*** Request to UnKnown timed-out
nslookup www.vmware.com 192.168.1.1
Server: UnKnown
Address: 192.168.1.1
Name: e751.dscx.akamaiedge.net
Addresses: 2600:1417:2c:194::2ef
2600:1417:2c:1a8::2ef
104.114.87.171
Aliases: www.vmware.com
www.vmware.com.ds.edgekey.net
nslookup www.vmware.com 8.8.8.8
Server: dns.google
Address: 8.8.8.8
Name: e751.dscx.akamaiedge.net
Addresses: 2600:1417:2c:194::2ef
2600:1417:2c:1a8::2ef
104.114.87.171
Aliases: www.vmware.com
www.vmware.com.ds.edgekey.net
192.168.1.1 是我的 ADSL 路由器 DHCP 和 DNS,我从那里获得宽带连接。我的 ADSL 路由器的 DNS 设置配置如下 虚拟机中基本上没有互联网连接。