Sunday, August 3, 2014

How to fix when Raspberry Pi cannot resolve DNS to IP address

I don't know why my Pi was having the issue; I have never had it before.
But it was not able to resolve DNS to IP address; in other words, I couldn't ping to
It is actually very easy to fix and I am posting this for people who may have the same issue later.

Make sure your file, /etc/resolv.conf, has proper DNS servers. Most of time, your Internet Service Providers will provide at least one server automatically. But I use Google's DNS: their IP numbers are and They are reliable and easy to remember. Also unintuitive they are faster than what IPS gives you.
pi@desktoppi ~ $ ping
ping: unknown host
pi@desktoppi ~ $ cat /etc/resolv.conf 

pi@desktoppi ~ $ sudo vi /etc/resolv.conf
pi@desktoppi ~ $ cat /etc/resolv.conf 
pi@desktoppi ~ $ ping
PING ( 56(84) bytes of data.
64 bytes from icmp_req=1 ttl=57 time=11.3 ms
64 bytes from icmp_req=2 ttl=57 time=14.8 ms
64 bytes from icmp_req=3 ttl=57 time=20.6 ms
^C64 bytes from icmp_req=4 ttl=57 time=11.1 ms

--- ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 15440ms
rtt min/avg/max/mdev = 11.185/14.496/20.603/3.817 ms
pi@desktoppi ~ $ 

Modify the file, /etc/resolv.conf, and add two lines below like the screenshot above:

And test it if you can resolve DNS to IP address with "ping"

1 comment:

  1. This blog is nice and very informative. I like this blog. blogPlease keep it up.


About Me

My photo
Tomorrow may not come, so I want to do my best now.