2.1.3 VMware Network Configuration
The strength of VMware software is that it can ensure equal and parallel operation of virtual machines and host machines and allow network communication between the two. We use the network when developing Android applications, in the future, we will need more network support for porting Android systems. Therefore, VMWare's network configuration is very important to developers.
Ø host network interface:
After the VMware software is installed, three virtual NICs are automatically created in the network connection of the host machine: vmnet0, vmnet1, and vmnet8, as shown in Figure 2-29.
Figure 2-29 VM Nic
We can see that there are two virtual NICs. By default, vmnet0 is bridging with a physical Nic and is not displayed in the network connection of the host machine.
Ø Client Network Configuration:
The client has three connection modes: bridged bridging, Nat proxy connection, and host-only private host connection. As shown in Figure 2-30, the client configuration item is enabled.
Figure 2-30 enable the NIC configuration of the Client
Figure 2-31 Nic configuration of the Client
The connection relationship between the client and the three NICS is 2-32.
Figure 2-32 VMware Nic connection
The virtual client Nic can be connected to vmnet0 in bridging mode (as shown in ①), vmnet1 in host-only mode (as shown in ②), or vmnet8 in Nat mode (as shown in ③ ).
When the client Nic is configured as a bridged bridge, the physical Nic of the host machine and the NIC of the virtual machine are bridging through the virtual bridge on the vmnet0 switch, the client and the physical network are directly connected and shared with the physical network card. Network Data is directly transferred to the client through the physical network card, just like the independent host of the client and the host on the same network segment, it can be discovered by hosts outside the network and has its own IP address. This connection mode is usually used to set up services in the client to allow access from other hosts on the network.
When the client is configured as Nat, the VM instance's virtual Nic vmwarenetwork adaptervmnet8 is connected to the vmnet8 vswitch to communicate with the VM Nic. However, the VM instance's vmnet8 Nic is only used to communicate with the vmnet8 network segment, no route is provided for vmnet8. The client Nic connects to the Internet through the NAT proxy server, which means that the client cannot be seen on hosts outside the network.
When the client is configured as host-only, it is similar to the NAT network. The host machine vmnet1 Nic and the client NIC are connected to the vmnet1 CIDR Block through a virtual switch. Similarly, the CIDR block has no route, cannot connect to the Internet. It is a private and independent network established between the host and the client. This method is usually used for private communication between the host and the client, such as file transmission.
You can set the virtual network configurator to modify the virtual network card information of the host machine, as shown in Figure 2-32.
Figure 2-32 physical network bridging
By default, vmnet0 directly bridges bridged with the NIC of the host machine. If there are more than two NICs on the host machine, you can select the physical Nic to which vmnet0 is connected. For example, the current host machine has two physical NICs, vmnet0 can be either a bridge on a wireless network card or an Ethernet card.
You can select the NAT or host-only connection mode for vmnet1 and vmnet8. The default vmnet1 is host-only, and the default vmnet8 is Nat. Nat can only be connected by one virtual network card, and host-only has no connection restrictions.
2.1.4 VMware and host data sharing
VMware software provides the sharedfolders data sharing feature, which facilitates file sharing between virtual machines and host machines.
From 2 to 33, set data sharing and choose VM> Settings.
Figure 2-33 enable data sharing settings
Select Options-> sharedfolders, select always enabled on the right to enable data sharing, click the Add button below, and select the directory of the host machine to be shared.
Figure 2-34 enable data sharing
Select the linux_share directory on the host machine as the shared directory.
Figure 2-36 enable data sharing
After data sharing is enabled, you can see that the content in the Ubuntu client/mnt/HGFS/linux_share directory is consistent with the files on the host.
Figure X-x host directory content
Figure X-X client directory content
The data sharing feature of VMware allows you to conveniently copy, share, and synchronize files between the host and the client, without the need to enable the FTP download service or the Internet neighbor sharing service, greatly improve development efficiency.
2.1.5 add new hardware to Vmware
When using a virtual machine, new virtual machine hardware is often added. For example, if the disk space is insufficient, you want to increase the disk space and add a network adapter when practicing networking. To add new hardware, you can use the Add new hardware Wizard provided by VMware.
Choose VM-> Settings, open VM settings, and select Add to add new hardware, as shown in X-X.
Figure X-X Add new hardware
Take adding a new disk as an example. Select harddisk and click Next.
Figure X-X Add a new disk
Select how to add a disk. Just like setting up a new virtual machine, select create a new virtual disk to create a new disk, set the new disk type to SCSI, and set the new disk space configuration, set the new disk name.
Figure X-X Add a new disk
Note: After adding a new disk, you must format it and mount the partition. For details, please query relevant information.
2.1.6 exercise
1. The VMware software can Virtualize a client running in parallel with the host machine. Does it mean that the host machine can run without being started?
2. If the disk in the client is formatted, will it affect the host disk?
3. How do I configure file sharing between the host and the client? If I install the Ubuntu client, how do I access the shared directory of the host in Ubuntu?
4. How to set the memory size for the virtual client?
5. If there is a client in VMware that can access the Internet on the host, how many network settings can be used to allow the client to access the Internet? Which network setting method should be used if an FTP server is set up in the host and accessed by other hosts outside the host?