[Linux] [memo] linux virtual machine NAT Network Configuration

 
 
Linux virtual machine on the network with a memo (based on VMware Workstation 15 Pro, CentOS7)

A, (generated by default) under windows10 network adapter (Address: \ network and the Internet \ Network Connections Control Panel)

Two virtual machine's NIC
Right Properties - "Select Internet Protocol Version 4--" Click Properties on the right you can see the virtual machine ip address auto-configuration (in addition to two different ip, the other is the same)
Virtual machine network card properties
Virtual machine network card properties
Note! VMnet1 default corresponds to the Virtual Network Editor inside the only host mode, VMnet8 default corresponding to the virtual network editor inside the NAT mode. Not propose to amend the corresponding mode, the beginning of time is not recommended to modify ip address
 
 


二、VMware Workstation

(A) the virtual machine configuration

NOTE:
Direct mode: the virtual machine in the mode of having a separate IP
host mode: the virtual machine in this mode direct only connected host can not connect to external networks
NAT modes: virtual machine in this mode may be connected to a host may be connected Extranet

Here use NAT mode
1, click on the virtual machine - "click Set
Click Virtual Machine
2, click the network adapter -" click NAT mode - "Click OK
Here Insert Picture Description
 
 

(B) the Virtual Network Editor

1, click Edit - "Click Virtual Network Editor
Click Edit
2, click VMnet8--" Click NAT settings - "Remember VMnet8 gateway
Here Insert Picture Description
 
 


Third, the virtual machine configuration

1, start the virtual machine, enter the ip address ip addr view (different linux release command)
Three -1
2,
enter "cd / etc / sysconfig / network -scripts /" Jump to network-scripts folder,
enter "ls" command to view the file folder, you can see a "ifcfg-" plus the file name of the card
Three -2
3, "vi ifcfg-ens33" edit ifcfg-ens33 input file (symbol symbols are in English)
Three -3
4, save and exit the file input "service network restart "to restart the service
 
 


Fourth, test and summary

Test: ping4 times www.baidu.com
four
Summary:
Internet network accessible from the virtual machine network card (192.168.153.11) using VMnet8 card (192.168.153.1) by the total VMware NAT router gateway (192.168.153.2) to communicate with the host or with external communications (usually the default subnet mask is 255.255.255.0)

Published 11 original articles · won praise 96 · views 60000 +

Guess you like

Origin blog.csdn.net/weixin_42159233/article/details/105166922