Can't connect to www.google.com even being connected to the Internet.
I always need to change the DNS to 8.8.8.8
in /etc/resolv.conf
but it changes automatically into 127.0.0.1
and then www.google.com do not work.
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up.
Sign up to join this communityCan't connect to www.google.com even being connected to the Internet.
I always need to change the DNS to 8.8.8.8
in /etc/resolv.conf
but it changes automatically into 127.0.0.1
and then www.google.com do not work.
Edit /etc/network/interfaces
file and add the following to the end:
dns-nameservers 8.8.8.8
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 the put there the lines with the dns servers you want. For example, for google and OpenDns:
#Google DNS
nameserver 8.8.8.8
#OpenDns Servers
nameserver 208.67.222.222
nameserver 208.67.220.220
The lines you write in this file are automatically added to resolv.conf when it is generated.