Home > Article > Operation and Maintenance > How to solve the problem that centos cannot access the Internet under the virtual machine
1. First, ensure that the network adapter of the virtual machine is in NAT mode.
2. Set the "Edit" of the virtual machine-- 》In the "Virtual Network Editor", both options of VMnet8's DHCP settings are checked
3. Set the physical host and ensure that the IP address of the virtual gateway is automatic. Obtain; at the same time, the local connection is also set to automatically obtain
4. Enable the VMware DHCP Service and VMware NAT Service of the physical host. The command is
net start "VMware DHCP Service" net start "VMware NAT Service"
5. CentOS does not start the network card by default and needs to be manually Start
cd /etc/sysconfig/network-scripts/
Check what the corresponding number is after ifcfg-eno, take eno32 as an example
ls
Switch to the root user, vi ifcfg-eno32, edit the file
Set ONBOOT=yes
That is to say, automatically enable the network connection
:wq Save and exit.
6. In the virtual machine environment, restart the network, the command is
service NetworkManager stop service network restart service NetworkManager start
7. Ping Baidu test
ping www.baidu.com## Related tutorials Recommended:
The above is the detailed content of How to solve the problem that centos cannot access the Internet under the virtual machine. For more information, please follow other related articles on the PHP Chinese website!