thumb How to fix the issue if you see the message about the host is unknown when attempting to ping a domain name.

I can ping one of Google’s servers:

$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_req=1 ttl=51 time=8.09 ms
64 bytes from 8.8.8.8: icmp_req=2 ttl=51 time=8.34 ms
64 bytes from 8.8.8.8: icmp_req=3 ttl=51 time=12.4 ms

But I can’t resolve any domain names:

$ ping google.com
ping: unknown host google.com

This means that resolving of the domain names to IP via DNS (Domain Name System) is not working.

To fix this, simply type the following command:

echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf

Or you can manual edit the resolv.conf file. For this you need to open the resolv.conf file:

sudo nano /etc/resolv.conf

And add this line instead of what ever you have:

nameserver 8.8.8.8

Note: 8.8.8.8 - is a Google DNS servers.


Arthur Gareginyan

Arthur Gareginyan

Arthur is a designer and full stack software engineer. He is the founder of MyCyberUniverse.com. His personal website can be found at arthurgareginyan.com. Check out his free WordPress plugins at wordpress.org.

Follow Arthur: