Can't connect to www.google.com even being connected to the Internet.

I always need to change the DNS to in /etc/resolv.conf but it changes automatically into and then www.google.com do not work.


Edit /etc/network/interfaces file and add the following to the end:


Don't edit /etc/resolv.conf since that file is generated automatically.


I had the problem that my raspberry 3 couldn't connect to inet, but it had connection (no ping to google.com but it had ping to the ip address). So I figured it was a DNS problem. After a search I found this solution. Sorry, but I don't remember where, so I can't post the link.

It's true that /etc/resolv.conf is created at every reboot, so you lose the changes you make.

A solution is to create a file in /etc named resolv.conf.head

sudo nano resolv.conf.head

and then put there the lines with the dns servers you want. For example, for google and OpenDns:

#Google DNS

#OpenDns Servers

The lines you write in this file are automatically added to resolv.conf when it is generated.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.