Debian change DNS settings for speed improvement or privacy. It is really easy to do. So let us see how it’s done and get to it. The instructions are at the bottom of the article.
Why do you want to change DNS?
Some reasons to change DNS (Domain Name Server) is speed, privacy or avoid censorship from your ISP (Internet Service Provider).
Some internet providers have slow DNS. This will affect your speed when browsing on the internet. Because your computer needs to get the IP address for everything on the internet. Some web pages might need a lot of DNS lookups, and if your internet providers DNS is slow, your internet browsing will become slow.
When it comes to privacy, the DNS you use knows every address you have visited. Because it gave you the address for it. Who knows what the providers is doing with the data. They might sell it.
A common way to block websites is to remove the entry for the website in the DNS or set it to 0.0.0.0. This is how many internet providers blocked PirateBay and many other websites.
What DNS is available to use?
Several companies offer DNS for everyone to use. Google, Cloudflare, and OpenDNS are some of them. Who you trust is up to you. If you are concerned about privacy I would avoid Google.
Google: 220.127.116.11 & 18.104.22.168 Cloudflare: 22.214.171.124 & 126.96.36.199 OpenDNS: 188.8.131.52 & 184.108.40.206 Quad9: 220.127.116.11 & 18.104.22.168 CleanBrowsing: 22.214.171.124 & 126.96.36.199 Verisign: 188.8.131.52 & 184.108.40.206
These are just a few of the many available DNS you can use. Cloudflare claim to be the fastest one. OpenDNS is probably one of the more secure ones, as they don’t log any browsing and will never sell your data. Another option is to create your own DNS, but that will not be covered in this article. You can find more in this lifewire article.
How to change DNS in Debian?
The DNS address is in /etc/resolv.conf. This is how it might look like if your are using your default ISP DNS.
If we want to use Cloudflare’s DNS instead, we change it to this instead (only change nameserver for this):
domain home search home nameserver 220.127.116.11
Or you could also add the secondary DNS to, if the primary can’t be reached. I would recomend using the primary and secondary DNS.
domain home search home nameserver 18.104.22.168 nameserver 22.214.171.124
Debian change DNS is easy as you see. To verify that you are using Cloudflare DNS you can install dnsutils and do the following test.
dig any google.com
At the bottom note this part.
The server tells you where the DNS request came from. So this shows we are now using Cloudflare DNS instead of our ISP DNS. Also, note the query time was 11 milliseconds. That is fast. If your ISP DNS is slow it might take up to 100-200 milliseconds. That will have a huge impact on browsing speed, even if you have good download speed.
If you are interested in how to Change hostname, domain or FQDN permanently in debian, check it out.