Home  >  Article  >  Operation and Maintenance  >  How to connect virtual machine centos to the Internet

How to connect virtual machine centos to the Internet

藏色散人
藏色散人Original
2020-03-13 11:01:176607browse

How to connect virtual machine centos to the Internet

How to connect virtual machine centos to the Internet? How to access the Internet with a CentOS7 virtual machine

Edit the virtual machine settings, select the NAT address translation method for the network adapter mode

How to connect virtual machine centos to the Internet

Open the VMware menu, edit -Virtual network editor, in the pop-up dialog box, click NAT settings, write down the subnet IP, subnet mask, gateway address information

How to connect virtual machine centos to the Internet

How to connect virtual machine centos to the Internet

##Enter the CentOS7 virtual machine in VMware, and the command to enter the directory is as follows:

cd /etc/sysconfig/network-scripts

The command to display the files in the current folder is as follows

ls

The first ifcfg-ens33 is the CentOS7 network configuration to be edited File, the specific file name may be different, the prefix is ​​ifcfg-ens

How to connect virtual machine centos to the Internet

To edit the file, the command is as follows

vi ifcfg-ens33

as shown in the figure below. Note that you need to change it based on the information you see in the second step. IPADDR must be in the subnet. The gateway and subnet mask are the same as in the second step. In addition, you need to configure DNS, etc. Finally, save and exit.

How to connect virtual machine centos to the Internet

The next command to restart the network service is as follows:

service network restart

How to connect virtual machine centos to the Internet

Try to ping the Baidu server again and it will be normal. The command is as follows

ping www.baidu.com

How to connect virtual machine centos to the Internet

Recommended video tutorial for learning Linux:

https://www .php.cn/course/list/33.html

The above is the detailed content of How to connect virtual machine centos to the Internet. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Is centos linux?Next article:Is centos linux?