How do I set my DNS when resolv.conf is being overwritten?
367
votes
18
answers
1172107
views
Most of the info I see online says to edit
/etc/resolv.conf
, but any changes I make there just get overridden.
$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND --
# YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1
It seems that 127.0.1.1 is a local instance of dnsmasq
. The dnsmasq
docs say to edit /etc/resolv.conf
. I tried putting custom nameservers in /etc/resolv.conf.d/base
, but the changes didn't show up in /etc/resolv.conf
after running sudo resolvconf -u
.
FYI, I don't want to change DNS on a per-connection basis, I want to set default DNS settings to use for all connections when not otherwise specified.
***UPDATE:***
I answered this question myself:
https://unix.stackexchange.com/a/163506/67024
I think it's the best solution since:
1. It works.
2. It requires the least amount of changes and
3. It still works in conjunction with dnsmasq's DNS cache, rather than bypassing it.
Asked by Seán Hayes
(4571 rep)
May 7, 2014, 01:31 AM
Last activity: Dec 27, 2024, 10:59 PM
Last activity: Dec 27, 2024, 10:59 PM