Examples of several ways to surf the Internet on VMware virtual machines

  • 2020-05-17 07:08:34
  • OfStack

In order to better solve the sharing problem between virtual machine and host, VMware company has an VMWare-tools to realize file sharing. The main idea here is to share Vmware virtual Linux with windows under Windows.

The host is WindowsXP system, and Linux operating system is installed in VMware virtual machine. After installing VMware, two new connections appear in the network connection of the host, VMware Network Adapter VMnet1 and VMware Network Adapter VMnet8, as shown in the figure. The system installed in the virtual machine is connected to the Internet by these two virtual network CARDS. You must turn off the antiarp firewall 1 on the host computer or the virtual machine will not be able to surf the Internet.

There are several options:

1. Bridged (bridge) method:

If the host is connected to the Internet via LAN, the virtual machine can use the same Settings as the host network segment, gateway, DNS, etc., and a valid LAN IP can be selected.

Bridge mode can realize virtual machine < --- > Host virtual machine < ---- > Internet communication (host and virtual machine can be regarded as two machines on the same LAN). However, bridging requires a separate IP address that is different from the original host, which is difficult in some cases (IP and MAC are bound, the network administrator disagrees). And after the host unplug the network cable, the virtual machine can not communicate with the host through the network. The latter ones don't. So you don't really use Bridges.

2. NAT mode:

Using the NAT and DHCP services provided by VMware, the virtual machine USES the virtual network card VMnet8 in the host as the gateway, and the TCP/IP Settings should follow the DHCP and NAT Settings of vmnet8 in the program. If IP must be between StartIP and EndIP Settings of DHCP, the gateway should use Gateway IP Settings of NAT.

NAT mode can realize the virtual machine < --- > The host communicates, but the virtual machine -- > The Internet can only be virtual machine access to the Internet, but if you want to use the virtual machine as a server, let the Internet access, can not.

But if you have multiple network CARDS, the virtual machine can access the Internet connected to multiple network CARDS at the same time without changing the Settings.

3. host - only way:

By default, vmnet1 is used to set the virtual machine ip to the same network segment as vmnet1,gateway to ip of vmnet1, other Settings to be the same as vmnet1, and dns to be the same as the host

For example, vmnet1 ip :192.168.101.1

Virtual machine Settings: ip :192.168.101.100 gateway :192.168.101.1

This implements the virtual machine < --- > The host communicates, but the virtual machine < --- > The Internet still doesn't communicate.

4. The connection mode of Internet of the Shared host (it may not be applicable if the host is Win98 system) :

Share the Internet connection in the advanced part of the host's local connection property. If the VMnet1 virtual network card is selected, Host-only should be selected in the Ethernet setting of VMware. If VMnet8 is selected, NAT should be selected for the Ethernet setting. After sharing the connection, the IP of the selected virtual network card will be set to 192.168.0.1 by default (if the host is also surfing the Internet through the LAN's 192.168.0.1 gateway, then the virtual network card should be set to different network segment IP, such as 192.168.1.1). At this time, the virtual network card can be used as a gateway to surf the Internet in the virtual machine. In fact, it is a simple route NAT, so we will not discuss the NAT way, we will only take Host-only as an example.

Sharing host-only mode can realize virtual machine < --- > The host communicates, but the virtual machine -- > The Internet can only be virtual machine access to the Internet, but if you want to use the virtual machine as a server, let the Internet access, can not.

Conclusion:

Share the connection mode and NAT mode, can realize the virtual machine < --- > Host, virtual machine -- > Internet communication, NAT mode is easy to set up, and can achieve access to multiple physical network CARDS at the same time.

Bridge mode can realize virtual machine < --- > Host virtual machine < ---- > Internet communication, if the virtual machine as a server, only this way is feasible. However, a separate IP is required for the virtual machine, and if the physical network card is disconnected, the virtual machine and the host cannot be connected.

host-only only implements virtual machines < --- > Host communication, 1 generally not used alone.


Related articles: