Home  >  Article  >  Operation and Maintenance  >  What should I do if centos cannot ping Baidu?

What should I do if centos cannot ping Baidu?

王林
王林Original
2020-03-20 15:32:3912218browse

What should I do if centos cannot ping Baidu?

Problem:

Unable to ping www.baidu.com in Linux.

There are two solutions, as follows:

Method 1: Open the /etc/resolv.conf configuration file

vi /etc/resolv.conf

Add the following content: (Recommended tutorial:centos usage tutorial)

nameserver 114.114.114.114 (电信的DNS)
nameserver 8.8.8.8(googel的DNS)

You can ping the external network.

Method 2: First execute the command ip a or ifconfig to check the network card used, and then enter /etc/sysconfig/network-scripts to find the corresponding network card and modify it.

vi /etc/sysconfig/network-scripts/ifcfg-ethx

What should I do if centos cannot ping Baidu?

Finally restart the network card.

service network restart

Recommended related video tutorials: linux video tutorial

The above is the detailed content of What should I do if centos cannot ping Baidu?. 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