VMware, linux virtual machine set up network to realize the network intercommunication between the virtual machine and the host

Three aspects need to be configured, namely: WMware network configuration, windows host network configuration, and virtual machine network configuration.

First, confirm that the network connection mode configured in the VMware virtual machine settings is: NAT mode

It can be found in the menu above VMware: virtual machine ----> settings, then find the network adapter, set the network connection mode to: NAT mode, as shown below:

1. Configure VMware network configuration

Find in the menu above VMware: Edit---->Virtual Network Editor, open it as shown in the figure below:

Select: Change settings

Then, select VMnet8 above, you may need to configure as shown below:

Then, find the button "NAT Settings (s)" on the right side of the NAT mode, configure the gateway as shown in the figure below, and then click the OK button: 

Then, click the OK button in the figure below to close:

 

Two, windows network configuration

Find WMware8 in the network adapter, as shown in the following figure:

 

Then, right-click to select Properties, and double-click Internet Protocol Version 4 (TPC/IPv4), as shown in the figure below:

 

Then, configure as shown below:

 

(Note: If VMware8 is not found in the network adapter, you can go back to VMware, select the "Restore Default Settings" button on the page just now, and then start the configuration from the first step "VMware Network Configuration"), as shown in the figure below :

 

3. Configure the virtual machine network

 First, use the root account to enter the virtual machine , then open the terminal, and enter the following command:

1. vim /etc/sysconfig/network-scripts/ifcfg-ens33

    After executing the command, modify the file as shown in the figure below (press i to edit the file, press the Esc key in the upper left corner of the keyboard to exit editing, and use :wq to save and exit the file):

 

2. Host name mapping (optional)

(Note: This step can be omitted, and the network strategy configuration has been completed in the above steps.)

 The function of this step is: when modifying the network ip address of the virtual machine in the future, you only need to modify one place in the configuration file [that is, IPADDR in the previous step]. mysql, rabbitMQ, zookeeper, etc.) do not need to be changed, and the latest ip will be used automatically. Of course, the ip address of these software cannot be hard-coded, and the host name must be used.

Come, enter the command line: vim /etc/hosts

Then modify the file as shown below:

 

Then save and exit editing.

 4. Verify that the network is interoperable

(1) In the virtual machine terminal, enter:

1. If ping www.baidu.com     is normal, it has been connected, indicating that the virtual machine can connect to the external network

2. If the ping 192.168.10.1     is normal, it has been connected, indicating that the virtual machine can already connect to the windows host

(2) Enter in the cmd of the windows host:

If ping 192.168.10.100     is normal, it has been connected, indicating that the windows host can already connect to the virtual machine

At this point, the virtual machine and the windows host can communicate with each other and both can connect to the external network

 

おすすめ

転載: blog.csdn.net/dd2016124/article/details/128361941