How do I set DNS Servers on Raspberry Pi?
I've found that in the latest version of Raspbian (stretch I think?) you now need to edit the last line of /etc/dhcpcd.conf
. There should be a line that starts with static domain_name_servers=
- there you can customise it with a list of space-separated DNS servers, like this:
static domain_name_servers=1.1.1.1 1.0.0.1 208.69.38.205 8.8.8.8
DNS Servers Featured: Cloudflare, OpenDNS, and Google
Edit: As @DavidOliver points out, you may need to restart dhcpcd too: sudo systemctl restart dhcpcd.service
.
Don't edit /etc/resolv.conf
since that file is generated automatically. Instead edit /etc/network/interfaces
and add the following to the end:
dns-nameservers 8.8.4.4 8.8.8.8
If you are using Debian on Raspberry Pi, then you need to edit /etc/resolv.conf
nano /etc/resolv.conf
then add the server IP of the openDNS
nameserver 208.67.222.222
nameserver 208.67.220.220
Btw, if you have any concern about speed of the DNS you may want to take a look at this post