centos7 can not access the Internet problem

I installed centos7 in the virtual machine VM, but I cannot access the Internet. In the same virtual machine, I also installed Ubuntu and I can access the Internet. I don’t know what happened, so I checked the information blog on the Internet, and the summary is as follows.

1. First open the virtual settings, you can see that the virtual machine network settings default to NAT mode, and other modes are not understood, so use the default mode

2. Follow the online operations, log in to the centos7 operating system, and view the network configuration file of the system

ls /etc/sysconfig/network-scripts

We can see a bunch of files and find something like ifcfg-ensXXX, mine is ifcfg-ens33, it will be different depending on everyone's machine.

vim /etc/sysconfig/network-scripts/ifcfg-ens33, you can see the following

The blog I saw at that time focused on setting BOOTPROTO=dhcp and ONBOOT=yes. Found out that my setup itself was like this without any issues

(I checked the meaning of these sentences online:

  • In /etc/sysconfig/network-scripts/ifcfg-eth0 (confirm ONBOOT=yes), where eth0 is the device name;

  • ONBOOT indicates whether the network card is activated when the system is started. Only the network card in the activated state can connect to the network and conduct network communication.

  • DEVICE: network card name (must write eth0)

  • ONBOOT=yes (equivalent to the switch to start this network card, if you want to use eth0, it must be yes, which means open) BOOTPROTO=none (this is what kind of routing protocol you use, there are three different ways of writing, if it is none and static means If you are using static routing, then you must fill in the three options of IPADDR, NETMASK and GATEWAY in the next project. If dhcp means you use dynamic routing protocol, then IPADDR, NETMASK, GATEWAY these options do not need to be filled in . If filled in, the value you filled in shall prevail)

  • HWADDR: The physical address of your network card (you don't need to write it, the system will automatically generate it)

  • IPADDR: ip address  

  • NETMASK: subnet mask    

  • GATEWAY: gateway)

 3. Then proceed to the next step

  In win10, open the execution, enter services.msc to open the windows service

 

  can be seen

 

   I found that these two services were not turned on. After turning it on, I found that the problem was solved and I could access the Internet.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325282805&siteId=291194637