我在 Windows 7 Pro 上有一个通过 VirtualBox 运行的 Linux/Boot2Docker 虚拟机。我无法从 Windows ping 或以其他方式访问虚拟机。(但是,从虚拟机 ping 我的 Windows IP 可以正常工作。)运行 tracert 似乎表明它在 LAN 上寻找虚拟机而不是 VirtualBox 适配器,但路由表看起来应该可以正确路由数据包。
更新:在 VirtualBox 管理器中,我将虚拟机的网络适配器链接到 Windows 适配器 #2 而不是 #3,现在我可以从 Windows ping 虚拟机。Tracert 仍然在 LAN 上查找,但这可能是一个转移注意力的借口。虚拟机仍然没有完成其实际工作,但这可能是另一个问题。如果我能证实这一点,我会回答这个问题。
tracert 的输出:
>tracert 192.168.59.103
Tracing route to 192.168.59.103 over a maximum of 30 hops
1 5 ms 3 ms 3 ms 10.25.80.254
2 * * * Request timed out.
3 * * * Request timed out.
4 * * * Request timed out.
Windows 上的 IP 配置:
Windows IP Configuration
Ethernet adapter Private Network :
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::39e9:8769:9302:b800%21
Autoconfiguration IPv4 Address. . : 169.254.184.0
Subnet Mask . . . . . . . . . . . : 255.255.0.0
Default Gateway . . . . . . . . . :
Ethernet adapter Corporate Network:
Connection-specific DNS Suffix . : pc.mycompany.com
Link-local IPv6 Address . . . . . : fe80::483c:a909:5355:6820%10
IPv4 Address. . . . . . . . . . . : 10.25.80.89
Subnet Mask . . . . . . . . . . . : 255.255.254.0
Default Gateway . . . . . . . . . : 10.25.80.205
Ethernet adapter VirtualBox Host-Only Network #2:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::78e7:30fe:75a0:1b27%23
IPv4 Address. . . . . . . . . . . : 192.168.59.3
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :
Ethernet adapter VirtualBox Host-Only Network #3:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::10db:8090:da3b:46e3%37
Autoconfiguration IPv4 Address. . : 169.254.70.227
Subnet Mask . . . . . . . . . . . : 255.255.0.0
Default Gateway . . . . . . . . . :
Tunnel adapter isatap.pc.mycompany.com:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . : pc.mycompany.com
Tunnel adapter isatap.{8AB45835-1093-4C43-A8A5-6D016FB1B8DE}:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Tunnel adapter isatap.{C3E3838E-D107-4A3D-9CE4-1943D581BEB0}:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Tunnel adapter isatap.{FEADDB5F-620C-4083-9AC3-3E34D663191A}:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Windows路由表(“路由打印”):
===========================================================================
Interface List
21...00 1b 21 2c e2 a3 ......Intel(R) Gigabit CT Desktop Adapter
10...f0 4d a2 dd 00 4a ......Broadcom NetLink (TM) Gigabit Ethernet
23...08 00 27 00 18 d1 ......VirtualBox Host-Only Ethernet Adapter #2
37...08 00 27 00 e8 47 ......VirtualBox Host-Only Ethernet Adapter #3
1...........................Software Loopback Interface 1
11...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter
12...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #2
15...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #3
40...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #4
===========================================================================
IPv4 Route Table
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 10.25.80.205 10.25.80.89 10
10.25.80.0 255.255.254.0 On-link 10.25.80.89 266
10.25.80.89 255.255.255.255 On-link 10.25.80.89 266
10.25.81.255 255.255.255.255 On-link 10.25.80.89 266
127.0.0.0 255.0.0.0 On-link 127.0.0.1 306
127.0.0.1 255.255.255.255 On-link 127.0.0.1 306
127.255.255.255 255.255.255.255 On-link 127.0.0.1 306
169.254.0.0 255.255.0.0 On-link 169.254.184.0 266
169.254.0.0 255.255.0.0 On-link 169.254.70.227 276
169.254.70.227 255.255.255.255 On-link 169.254.70.227 276
169.254.184.0 255.255.255.255 On-link 169.254.184.0 266
169.254.255.255 255.255.255.255 On-link 169.254.184.0 266
169.254.255.255 255.255.255.255 On-link 169.254.70.227 276
192.168.59.0 255.255.255.0 On-link 192.168.59.3 276
192.168.59.3 255.255.255.255 On-link 192.168.59.3 276
192.168.59.255 255.255.255.255 On-link 192.168.59.3 276
224.0.0.0 240.0.0.0 On-link 127.0.0.1 306
224.0.0.0 240.0.0.0 On-link 192.168.59.3 276
224.0.0.0 240.0.0.0 On-link 10.25.80.89 266
224.0.0.0 240.0.0.0 On-link 169.254.184.0 266
224.0.0.0 240.0.0.0 On-link 169.254.70.227 276
255.255.255.255 255.255.255.255 On-link 127.0.0.1 306
255.255.255.255 255.255.255.255 On-link 192.168.59.3 276
255.255.255.255 255.255.255.255 On-link 10.25.80.89 266
255.255.255.255 255.255.255.255 On-link 169.254.184.0 266
255.255.255.255 255.255.255.255 On-link 169.254.70.227 276
===========================================================================
Persistent Routes:
None
IPv6 Route Table
===========================================================================
Active Routes:
If Metric Network Destination Gateway
1 306 ::1/128 On-link
23 276 fe80::/64 On-link
10 266 fe80::/64 On-link
21 266 fe80::/64 On-link
37 276 fe80::/64 On-link
37 276 fe80::10db:8090:da3b:46e3/128
On-link
21 266 fe80::39e9:8769:9302:b800/128
On-link
10 266 fe80::483c:a909:5355:6820/128
On-link
23 276 fe80::78e7:30fe:75a0:1b27/128
On-link
1 306 ff00::/8 On-link
23 276 ff00::/8 On-link
10 266 ff00::/8 On-link
21 266 ff00::/8 On-link
37 276 ff00::/8 On-link
===========================================================================
Persistent Routes:
None
答案1
您需要设置一个持久路由因此从您的计算机到虚拟机(192.168.59.130)的所有网络流量都通过相关的 NIC(以太网适配器 VirtualBox 仅主机网络 #2)路由
路由添加-p 192.168.59.103 掩码 255.255.255.0 192.168.59.3 如果 23