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 OVERWRITTENnameserver 127.0.1.1It 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/67024I think it's the best solution since:It works.It requires the least amount of changes andIt still works in conjunction with dnsmasq's DNS cache, rather than bypassing it.
How do I set my DNS when resolv.conf is being overwritten?
linux;ubuntu;networking;dns;dnsmasq
I found out that you can change the nameservers that dnsmasq uses by adding the following lines to /etc/dnsmasq.conf:server=8.8.8.8server=8.8.4.4I didn't have a /etc/dnsmasq.conf file though, since it's installed by the dnsmasq package, but Ubuntu only comes with dnsmasq-base. I ran sudo apt-get install dnsmasq, then edited /etc/dnsmasq.conf, then sudo service dnsmasq restart and sudo service network-manager restart.I ran sudo tail -n 200 /var/log/syslog to check my syslog and verify that dnsmasq was using the nameservers I specified:Oct 21 23:00:54 mylaptop dnsmasq[8611]: using nameserver 8.8.8.8#53Oct 21 23:00:54 mylaptop dnsmasq[8611]: using nameserver 8.8.4.4#53