Today, a quick how-to on how to:
- Override nameservers provided by your DHCP server by the ones from https://www.opennicproject.org, when you are using network-manager
- Use Network-Manager with dnsmasq to speed up DNS resolution
I assume you are using your Linux machine as a desktop, not a server, and with network-manager.
Always use OpenNIC name servers
In /etc/dhcp/dhclient.conf, add this line, this will override DNS provided by your DHCP server:1supersede domain-name-servers 220.127.116.11, 18.104.22.168;
You can put several servers separated per commas.
Restart network-manager, then you can check /etc/resolv.conf file has been written with the OpenNIC nameservers.123# Generated by NetworkManagernameserver 22.214.171.124nameserver 126.96.36.199
You can find the closest name servers to your location here: http://wiki.opennicproject.org/ClosestT2Servers
Use dnsmasq as local DNS cache
Easy, install dnsmasq package, then put this in /etc/dnsmasq.d/custom:1234# disable dnsmasq DNS serverport=0# Activate dnsmasq local cachelisten-address=127.0.0.1
To inform network-manager than you want to use dnsmasq as local DNS resolver, add this line in the [main] section of /etc/NetworkManager/NetworkManager.conf file:123[main]#(some other conf can be present before this line)dns=dnsmasq
You can now check than /etc/resolv.conf contain this:12# Generated by NetworkManagernameserver 127.0.0.1