How to fix error can’t ping any hostname on Linux

How to fix error can’t ping any hostname on Linux?

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

But you can ping IP. So strange! How to fix this error?
Simple, you only need flush DNS cache.
You can read this artice: How to flush DNS cache on CentOS


service named restart

Now you can ping hostname

[root@tutorialspots ~]# ping
PING ( 56(84) bytes of data.
64 bytes from ( icmp_seq=1 ttl=57 time=10.8 ms
64 bytes from ( icmp_seq=2 ttl=57 time=10.6 ms
64 bytes from ( icmp_seq=3 ttl=57 time=10.7 ms

cant ping hostname on linux

If you get this error:

[root@tutorialspots ~]# service named restart
Redirecting to /bin/systemctl restart named.service
Authorization not available. Check if polkit service is running or see debug message for more information.

You must reboot your server.

Leave a Reply