Set DNS Servers For All Wifi Networks

Martín Cigorraga martincigorraga at gmail.com
Thu Sep 11 11:10:15 UTC 2014


TL;DR, have anyone mentioned /etc/resolv.conf.head?

I myself use OpenNIC as my first choice and Yandex as a fallback (while
still having OpenDNS set on my home router, need to switch it to Yandex too
though).
So the file looks like:

/etc > cat resolv.conf.head
# OpenNIC
nameserver 37.235.52.191

# Yandex
nameserver 77.88.8.8
nameserver 77.88.8.1

options timeout:1

And /etc/resolv.conf looking like:
/etc > cat resolv.conf
# Generated by resolvconf
# OpenNIC
nameserver 37.235.52.191

# Yandex
nameserver 77.88.8.8
nameserver 77.88.8.1

options timeout:1
nameserver 208.67.222.222
nameserver 208.67.220.220


As you see Sajan no matter your DNS vary from one connection spot to
another the DNS addresses you set in the head file are still the first to
be used.
Another sweet method you can employ is to set the immutable attribute on
for /etc/resolv.conf once you are done setting your preferred DNS:
/etc # chattr +i resolv.conf

Just remember to turn it off again when you want to edit the file in the
future.


-Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20140911/78698235/attachment.html>


More information about the ubuntu-users mailing list