【总结失败】

昨天没能成功地原因,主要是因为一直在使用默认的Bridge方式连接host和guest――根据VMware帮助,在Bridge模式下,guest会消耗掉host当前所在的LAN的一个地址(不论通过手动分配或DHCP方式),所以host必须有权限从当前LAN中获得一地址:
If the host computer is on an Ethernet network, bridged networking is often the easiest way to give your virtual machine access to that network. With bridged networking, the virtual machine appears as an additional computer on the same physical Ethernet network as the host. A virtual machine with bridged networking may transparently use any of the services available on the network to which it is bridged, including file servers, printers, gateways and so on. Likewise, any physical host or other virtual machine configured with bridged networking can use resources of that virtual machine.

【成功经验】

由于目前host没有通过网线连接到任何LAN中,故没有可用的网关(gateway)。虽然host(192.168.0.25/24)和guest(192.168.0.250/24)在同一个subnet中,仍无法ping通――因为无gateway,链路不完整。

现在,采用NAT或Host-only方式连接host和guest,以下是关于它们的说明:
NAT (Network Address Translation) ― If you want to connect to the Internet or other TCP/IP network using the host computer’s dial-up networking connection and you are not able to give your virtual machine an IP address on the external network, this is often the easiest way to give the virtual machine access to that network. The virtual machine does not have its own IP address on the external network. Instead, a separate private network is set up on the host computer. The virtual machine obtains an address on that network from the VMware virtual DHCP server.
Host-only ― When you use this type of network connection, the virtual machine is connected to the host operating system on a virtual private network, which normally is not visible outside the host. Multiple virtual machines configured with host-only networking on the same host are on the same network.
显然,NAT和Host-only方式不需要保证host已经连接到某个LAN上,并从LAN中分配地址;而是将host设置为在虚拟网络VMnet8(NAT方式)或VMnet1(Host-only方式)上的一台计算机。

从帮助文档及VMware的一些参数还可以得到以下信息:
1) 与NAT方式对应的虚拟子网为VMnet8(192.168.184.0/24),guest的可用地址为192.168.184.128 ~ 192.168.184.254。通过查看host中的VMware Network Adapter VMnet8的属性可知host在此情况下的地址为192.168.184.1(可以手工设置,但要避免与guest冲突)。
2) 与Host-only方式对应的虚拟子网为VMnet1(192.168.17.0/24),guest的可用地址为192.168.17.128 ~ 192.168.17.254。通过查看host中的VMware Network Adapter VMnet1的属性可知host在此情况下的地址为192.168.17.1(可以手工设置,但要避免与guest冲突)。

所以,如果使用NAT方式(必须保证NAT服务进程在host中已经启动),需要将guest的地址设置在192.168.184.128 ~ 192.168.184.254内,使guest和host在同一个subnet内。在guest内通过ping 192.168.184.1测试,说明已与host连通!

同样地,如果使用Host-only方式,需要将guest的地址设置在192.168.17.128 ~ 192.168.17.254内,使guest和host在同一个subnet内。在guest内通过ping 192.168.17.1测试,说明已与host连通!

发表评论

邮箱地址不会被公开。 必填项已用*标注