The DNS servers in Raspberry Pi are listed in
If you want to change the Raspberry Pi’s DNS server settings you shouldn’t update this file manually, because all changes will be overwritten after reboot by data that your local DHCP server provides.
In this note i will show how to change DNS servers in Raspberry Pi and make the settings permanent.
Cool Tip: Free fast public DNS servers! Read more →
Raspberry Pi DNS Server Settings
$ sudo nano /etc/dhcpcd.conf
At the bottom of the file, uncomment the following line and set the IP addresses of the required DNS servers, for example:
static domain_name_servers=126.96.36.199 188.8.131.52
Save the changes and restart the
$ sudo systemctl restart dhcpcd
Check the DNS server settings:
$ cat /etc/resolv.conf # Generated by resolvconf nameserver 184.108.40.206 nameserver 220.127.116.11
To ensure additionally that the new DNS server settings are in place, you can install
dnsutils and execute the
$ sudo apt update $ sudo apt install dnsutils $ nslookup www.shellhacks.com Server: 18.104.22.168 Address: 22.214.171.124#53 Non-authoritative answer: Name: www.shellhacks.com Address: 126.96.36.199 Name: www.shellhacks.com Address: 2a01:4f8:13b:3f55::2
Cool Tip: Mount USB drives in Raspberry Pi automatically! Read more →