Home > Article > Operation and Maintenance > 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
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!