Copyright Notice: All original articles in this blog can be used for personal, educational, or non-commercial purposes, however, it is important to ensure the integrity of the article and to indicate the original author, source and this statement in the form of a hyperlink without any modification.
Blog address: Http://blog.csdn.net/shuxiao9058
Original Author: Ji ya
I. First, I posted my knowledge about VMware network connections on the network.
After the virtual machine is installed, two virtual NICs, vmnet1 and vmnet8, are installed by default. Others are not installed (you can also manually install others ). Vmnet1 is the host Nic used to connect to the network in the host mode. Vmnet8 is a NAT Nic used to connect to the network in Nat mode. Their IP addresses are randomly generated. If you want to use virtual machines for experiments, you 'd better remove the IP addresses from vmnet1 to vmnet8. Traditionally, the network segment used by the VMware Virtual Network Card is "fixed". The following principle is used: the network segment of vmnet1 is 192.168.10.0, and the network segment of vmnet2 is 192.168.20.0. Others are similar. Of course, you don't need to change it if you just use it. You can just access the internet.
VMware network connections include: bridged, Nat, and host-only ).
1. Use bridged networking (using a bridge network)
Note: If you use a vmnet0 vswitch, the virtual machine has an independent IP address, which is equivalent to an independent computer and host on the network. As shown in network topology 1,, a1, A2, and B can communicate with each other.
Figure 1 topology diagram of Bridging Mode
2. Use Network Address Translation (NAT) Description: When a vmnet8 vswitch is used, the virtual machine can access other workstations on the one-way network of the host, and other workstations cannot access the virtual machine. As shown in network topology 2, A1 and A2 can access B in Nat mode, but B cannot access A1 and A2. However, a, A1, and A2 can communicate with each other.
Figure 2 Nat Topology 3. Use host-only networking (using the host network) Description: when using a vmnet1 vswitch, the virtual machine can only communicate with the Virtual Machine and host. That is, you cannot access the Internet. As shown in Network Topology 3, you can access a, A1, and A2 in the host mode. However, A1 and A2 cannot access B or B. Figure 3 topology of the host network mode shows the actual application: currently, the most common use is broadband. When bridging is used, the host must be able to access the Internet, but the operating system on the virtual machine cannot access the Internet. At this time, your host is equivalent to a, and the virtual machine is equivalent to A1. Unless you apply for an IP address from the carrier (such as China Telecom or China Netcom), this is obviously not desirable. If you have a vro, you can use the bridging method to access the Internet, because the IP address you applied for is written on the vro, not on your machine. This includes your host, virtual machine, other machines connected to the vro can access the Internet and use the IP address automatically allocated by the vro. The IP address is generally 192.168.0.xxx. It seems that the operator is not happy with you to use the vro. What you say will damage the interfaces of their vswitches. Of course, as long as your host can access the Internet and use the NAT method, virtual machines can always access the Internet (of course, not when you modify IP, gateway, DNS, and other information randomly ). Manual instance setting: assume that the network segment address of vmnet1 is 192.168.10.0, the network segment address of vmnet8 is 192.168.80.0, And the gateway address is 192.168.80.254 (that is, the NAT router address, which can be set by yourself, on vmnet8), the host NIC address is 192.168.1.1. I. Using the bridging method, the IP address of Virtual Machine A1 can be set to 192.168.1.5 (the IP address of the VM can be the same as the IP address of the host Nic), other such as the gateway address, DNS, the subnet mask is the same as that of the host. 2. In Nat mode, the IP address of Virtual Machine A1 can be set to 192.168.80.5 (the same network segment as vmnet8). The Gateway is a NAT router address, that is, 192.168.80.524. The host-only mode is used, the IP address of Virtual Machine A1 can be set to 192.168.10.5 (the same network segment as vmnet1). Note: Generally, you do not need to manually set the IP address to automatically obtain the IP address or enable the DHCP service. The above content from the Network: http://blog.chinaunix.net/space.php? Uid = 20653907 & Do = Blog & id = 1590716
2. Personal Configuration experience if you are familiar with or even proficient in the network, the above content is enough. However, we may encounter other problems in actual use. Especially for embedded developers, most embedded boards now support network startup (NFS and TFTP ), therefore, you must ensure the network communication between the target machine and the host machine. Before you install a virtual machine, I suggest you install the full version of VMware Workstation. We do not recommend using the green version because the green version is much simpler and some services may not be completely green, I have a VMware
Workstation8.0 Virtual Machine installation package (http://115.com/file/e6gdchs2# vmware-workstation-full-8.0.0-471780&keygen.rar), has been uploaded to 115 and shared, which comes with a registration machine, readers can rest assured to download and install. Next I will discuss the configuration methods of the above three network connection methods in sequence. As mentioned above, we recommend that you use the fully-Installed VMware Workstation for installation and use. Do not disable the VM startup option (including service and network connections) by using system maintenance software such as 360 ). We recommend that you reset the Virtual Machine network before performing the following operations (Note: all virtual machines must be shut down or suspended before resetting ), you can select "edit"-"Virtual Network Editor"-"Restore Default" (lower left corner) to reset the settings for a while. 1. perform the following steps to bridge the network: (1) Select "Virtual Machine"> "Settings". The following page is displayed:
Figure 4 Virtual Machine Setting Dialog Box
(2) Select "hardware"-"network adapter" to go to the page 5 shown. In the network connection option on the right of the dialog box, select "bridge" and click "OK ".
Figure 5 select "bridge" Connection Mode
(3) enter the virtual machine, open the terminal (Linux system), enter the setup command and select the "Network Configuration" option.
Figure 6 enter the "setup" command under the terminal and select the "Network Configuration" option
(3) Go to "Device Configuration"> "eth0" in sequence, and go to the page 7. Do not check "use DHCP, and configure the IP address, subnet mask, gateway, DNS, and other information below and save the configuration options. Therefore, you must be familiar with your network environment before configuration, in this case, the virtual machine and your host are in the same network segment. For example, if my host's network IP address is 192.168.1.8 and the gateway is 192.168.1.254, the virtual machine gateway should also be configured in this network segment, the environment variable/IP address of the corresponding board should also be configured in the network segment 192.168.1.0/24, and then enter "service" under the terminal
The Network restart command restarts the network to complete the configuration of the Bridge Connection mode.
Figure 7 save and exit After configuring the IP address and gateway
Figure 7 restart and test the network
2. the Nat network is the simplest configuration in the three networks. You only need to change the Virtual Machine network to the NAT connection mode (figure 8 ), then, set the network to DHCP in the virtual machine to automatically obtain the IP address. in Linux, select the "use DHCP" option in Figure 9 to save and quit, and restart the network.
Figure 8 change the Virtual Machine network configuration to "Nat" Connection Mode
Figure 7 select "use DHCP" to save and exit
Figure 8 restart the network and view the network configuration
According to the eth0 configuration in figure 8, we find that the virtual machine and the host are not in the same CIDR block, but the virtual machine can ping any machine in the CIDR block, and vice versa, I have already explained it clearly. I will not repeat it here. 3. Host-only Network
In general, we do not select this configuration method unless you really do not want the virtual machine to access the Internet or want to communicate with other machines. In some special network debugging environments, you must isolate the real environment from the virtual environment. In this case, you can use the host-only mode. In host-only mode, all virtual systems can communicate with each other, but the virtual system and the real network are isolated. If you want to use VMware to create a virtual system isolated from other machines in the network and perform some special network debugging, you can select the host-only mode. The steps are as follows: (1) Open the network connection in the host, right-click "VMWare virtual Ethernet adapter for vmnet1" and select Properties to go To the IPv4 configuration option ("Internet protocol TCP/IP "), 9.
Figure 9 vmnet1 Network Connection Properties
(2) As Figure 9 shows that the network connection of vmnet1 is in the network segment 192.168.136.0/24, we can configure 10 in the virtual machine.
Figure 10 host-only configuration. Pay attention to DNS configuration information.
(2) After saving the network configuration, restart the network and use the host to ping the Virtual Machine. If the network can be pinged, the configuration is successful.
Figure 11 test the host-only Network
Note: 1. if the network is still disconnected, disable the firewall of the host and Virtual Machine respectively, and then verify whether the configuration is successful. 2. we recommend that you use the bridge network connection mode when using embedded development to build a network environment. In this way, you can fix an IP address for the host, virtual machine, and Development Board to facilitate intercommunication.