## Install Vmware virtual machine… ## download CentOS has a domestic image, eg: Ali Cloud and 163 speed is relatively fast, I download the Minimal ISO here (compact version has many commands are not, need to install their own)## Set fixed IP VMware editor – Virtual network editor VMnet8 cancel the use of local DHCPHere you can modify the subnet IP, modify to their own want, the premise is not occupied bar. Click NAT Settings to view the gateway IP address. Let me record my current information here. Subnet IP: 192.168.166.0 Subnet mask: 255.255.255.0 Gateway IP: 192.168.166.2

## Set the VM IP address

 cd /etc/sysconfig/network-scripts
vi  ifcfg-ens33
Copy the code

Note that the installed machine may not be named ifcfg-ens33, you can run the ls command to view the modification file as follows:

TYPE=Ethernet PROXY_METHOD= None BROWSER_ONLY=no # Static IP BOOTPROTO=static DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=ens33 UUID= 00ea1202-F98B-4894-9590-3a494f80dfa5 DEVICE=ens33 # boot ONBOOT=yes # IP address, The network segment must be consistent with VMnet8. IPADDR=192.168.166.101 # Subnet mask NETMASK=255.255.255.0 # GATEWAY GATEWAY=192.168.166.2 #DNS DNS1=114.114.114 HWADDR=00:0C:29:AE:0F:49 HWADDR=00:0C:29:AE:0F:49Copy the code

Save the Settings and exit to restart the network service

service network restart
Copy the code

Viewing network Addresses

ip addr
Copy the code

Run the ping command to check whether the network is connectedThen through xshell to connect to the VIRTUAL machine IP message has been disconnectedCause: The VMware Network Adapter VMnet8 is not configuredOpen control Panel – Network and Internet Settings – Network Links Set VMnet8 properties and modify IPv4 information

Set IP address: The IP address of the physical virtual gateway must be in the same network segment as the VM subnet IP address, but must be unique from the VM subnet IP address and the VM subnet IP address configured in Linux. Subnet IP address of the vm: 192.168.166.1 Subnet mask: 225.225.225.0 VM gateway: 192.168.100.2 Linux IP address of the VM: 192.168.166.101 Therefore, you can set the IP address of the physical virtual gateway to 192.168.166.X. You can set the subnet mask for all numbers from 0 to 255 except 0, 2, 101. Set this parameter to 225.225.225.0. Set this parameter to 192.168.166.2, which is the same as the VM gateway. Set DNS: This parameter is optional. You can also use other DNS servers, such as Google free DNS server 8.8.8.8 and 8.8.4.4

Then you can connect to the virtual machine through our SSH tools, such as Xshell