CentOS: how to fix error ping Name or service not known


CentOS: how to fix error ping Name or service not known?

[root@tutorialspots ~]# ping google.com
ping: google.com: Name or service not known

How to fix it?
Method 1:
Check file /etc/resolv.conf:

[root@tutorialspots ~]# cat /etc/resolv.conf
# Generated by NetworkManager
search nocix.net
nameserver 127.0.0.1

Add theses lines:

nameserver 8.8.8.8
nameserver 8.8.4.4

Done!, now you can ping

[root@tutorialspots ~]# ping google.com
PING google.com (172.217.12.78) 56(84) bytes of data.
64 bytes from dfw28s05-in-f14.1e100.net (172.217.12.78): icmp_seq=1 ttl=52 time=
40.8 ms

But every time when you restart the computer your /etc/resolv.conf will be replaced by default.

Method 2: check your /tmp directory, it is full, delete some files

Recent search terms:

  • https://tutorialspots com/centos-how-to-fix-error-ping-name-or-service-not-known-4520 html

Leave a Reply