I'm recently interested in DNS for a cleaner, faster & more secure Internet surfing. In my country many websites are obscured and I was told that changing DNS may allow me to use them as I did before. I also don't like to share my metadata with others and some DNSs, such as the ones provided by OpenDNS, seem to provide more privacy to the user.
Is it true that changing DNS results in a more secure web experience?
How do I change DNS on Ubuntu 18.04, and most importantly, which DNS should I switch to?
First, I recommend that you install namebench.
namebench searches the fastest DNS servers available for your computer to use. namebench runs a fair and thorough benchmark using your web browser history, tcpdump output, or standardized datasets in order to provide an individualized recommendation.
Install namebench from the terminal:
Start the program:
namebench makes thousands of queries and takes a few minutes to complete; please be patient. When it completes, a report will be prepared that illustrates the fastest available nameservers. Here is a sample from my machine:
When we examine the saved report, we see:
Once you know the two or three most ideal nameservers, apply them in Network Manager's settings like this:
Turn DNS Automatic to off. Insert the IP addresses of the preferred nameservers, seperated by commas, click Apply and close.
Does changing DNS result it a more secure web experience?
Yes, only if you do not trust your network provider. In which case, you can set up DNS. I actually use Google DNS, as this is generally faster.
Normally OpenDNS and GoogleDNS are faster than provider DNS.
However, there is a catch. If your network is such that it requires you to login before you can access the internet (like in airports, some cafes, co-working spaces), then they might not work if you overwrite the provider's DNS settings, as their authentication process depends upon DNS.
There is, however a very good solution available. You setup DNS per connection.
Finally, for the command line oriented: Open the connection file in Network Manager. For example, if the WiFi Name is Tarzan, then look for a file (case sensitive):
/etc/NetworkManager/system-connections/Tarzan
In that file, make sure the ipv4 block is like this:
replace 8.8.4.4;8.8.8.8; with your DNS servers.
This instructs NetworkManager to use DHCP to get IP address for the interface.
This instructs NetworkManager to ignore the DHCP provided DNS servers.
That should do the trick.
You need to do that for every WiFi AP that you connect to.
PS: Google DNS are 8.8.8.8 , 8.8.4.4