After configuring the network file, it still can't connect to the Internet

After configuring the network file, it still can’t connect to the external network.

There are a lot of network configurations on the Internet, but not all of them are applicable to every computer. Maybe you have configured the basic network files, but still can't connect to the external network. Here are the problems and solutions I encountered in configuring the network.

First of all, recommend a good CentOS configuration network blog: CentOS7 network configuration

After following the tutorial inside to configure the file, I found that Baidu still cannot
Rest of life
be pinged : Of course, the physical machine must also not be able to ping centos:
Rest of life

At this time, it may be that the DNS service is not configured properly. You can check the DNS configuration file : Change thevi /etc/resolv.conf
content of the file to:
nameserver1 114.114.114.114 nameserver2 8.8.8.8
Rest of life
Important reminder: Do not add a number after the nameserver! ! (For example: nameserver1 8.8.8.8)

114.114.114.114 and 8.8.8.8, these two IP addresses are part of the public domain name resolution service DNS, and because they are not used for commercial purposes, these two DNS are very pure, do not worry about the DNS caused by the ISP operator The most important thing about hijacking and other issues is free and free. There are many free DNS IP addresses on the Internet, and you can check them yourself if you need them.

***114.114.114.114*** is the common DNS for domestic mobile, telecommunications and China Unicom. It can be used on mobile phones and computers. It is clean and free of advertisements. The resolution success rate is relatively higher. Domestic users use more and speed Relatively fast and stable, it is the DNS commonly used by domestic users to access the Internet.

***8.8.8.8*** is the DNS provided by GOOGLE. The address is universal, and relatively speaking, it is more suitable for foreign users and users who visit foreign websites.

After our DNS file configuration, Baidu can give a response:
Rest of life
At this time, the physical machine cmd is still
Rest of life
unable to ping Centos: At this time, the physical machine cannot ping the virtual machine, and the xshell cannot be connected. See the solution

Then it's OK:
Rest of life
Rest of life

Guess you like

Origin blog.csdn.net/m0_46202060/article/details/109125977
Recommended