Edit === "Virtual Network Editor
change settings
Select VMnet8 NAT mode === "NAT settings
You can also customize the gateway IP by default, as long as there is no conflict.
DHCP settings
Go back to the virtual machine option === "Edit virtual machine settings
Network adapter === "Network connection select NAT mode
Restart the virtual machine
Set IP or use dynamic IP i.e. DHCP
Edit network configuration file
vi /etc/sysconfig/network-scripts/ifcfg-ens33
Restart the network after configuration
systemctl restart network
check ip address
ip addr
128 is the address provided by dhcp, and 130 is the static ip address.
Start VMnet8
If VMnet8 is not enabled, connection tools such as xshell cannot be used. Because the virtual machine communicates with the host network through VMnet8.
Turn off the firewall of the virtual machine, otherwise the virtual machine and the host may not be able to ping each other
systemctl stop firewalld && systemctl disable firewalld