Home > Article > Operation and Maintenance > How to solve the problem that CentOS7 in the virtual machine cannot access the Internet
How to solve the problem that CentOS7 in the virtual machine cannot access the Internet?
In daily study, we often use virtual machines to test different systems. So after you install the CentOS7 virtual machine, you will be very depressed if you find that the virtual machine cannot access the Internet. Well, after all, there are many commands that need to be connected to the network to be implemented. If you cannot access the Internet, then of course you cannot fully test and learn the CentOS7 system!
The following will introduce to you a quick way to solve the problem of Internet access in CentOS7 virtual method
First: open the edit menu of the virtual machine and select "Virtual Machine Network Editor"
Virtual Machine Network Editor
Select Restore Default Settings in the Virtual Machine Network Editor
Next open the CentOS7 virtual machine Machine
It should be noted here that you must set up as an administrator, so you need to log in to the system as an administrator
Then enter ls /etc/sysconfig/network-scripts in the opened terminal to view the network information of the virtual machine
Then enter vi /etc/ in the terminal sysconfig/network-scripts/ifcfg-ensXXXX
At this time enter the reading mode of the network configuration file ifcfg-ensXXXX
Then press the i key to enter text insertion editing mode.
Focus on setting BOOTPROTO=dhcp and ONBOOT=yes.
After modification, press the Esc key first, then enter a colon (:), then enter wq, and finally press the Enter key to exit the vim editor
Next, set the VMware DHCP Service and VMware NAT Service of the virtual machine in the physical machine and ensure that these two services are turned on. Create a new bat file, then run the batch file to open these two services
Finally, restart the network service of the virtual machine and enter service network in the terminal of the virtual machine restart, press Enter to confirm restarting the network service!
The setup is basically over now, hurry up and try to see if you can get online
Related references:centOS tutorial
The above is the detailed content of How to solve the problem that CentOS7 in the virtual machine cannot access the Internet. For more information, please follow other related articles on the PHP Chinese website!