resolv.conf keeps getting overwritten when dnsmasq is restarted, breaking dnsmasq
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Hypnotic Puzzle3
--
Chapters
00:00 Resolv.Conf Keeps Getting Overwritten When Dnsmasq Is Restarted, Breaking Dnsmasq
01:42 Accepted Answer Score 14
02:13 Answer 2 Score 5
02:31 Answer 3 Score 3
02:55 Answer 4 Score 1
03:39 Thank you
--
Full question
https://superuser.com/questions/894513/r...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#linux #networking #debian #dns #dnsmasq
#avk47
ACCEPTED ANSWER
Score 14
There appears to be a bug in the start-up script for dnsmasq
that uses resolvconf
to clobber the local resolver if the local loopback interface is not explicitly except
-ed in the /etc/defaults/dnsmasq
file.
The short answer is that you can add...
DNSMASQ_EXCEPT=lo
to /etc/defaults/dnsmasq
to solve the problem.
For more info, see this question...
ANSWER 2
Score 5
bigjosh is right - except there's been an update to dnsmasq, and there's now an option at the end of /etc/default/dnsmasq
which you can un-hash:
IGNORE_RESOLVCONF=yes
ANSWER 3
Score 3
Don't use
resolv-file=/etc/resolv.dnsmasq
Put dns server into dnsmasq.conf, like
server=/localnet/192.168.0.1 # change ip for your ip-server
server=8.8.8.8
server=8.8.4.4
And add into dnsmasq.conf
no-resolv
ANSWER 4
Score 1
If you just want a caching-only DNS server and nothing else fancy that dnsmasq can do, you'd be better off installing either lwresd
or unbound
and using the stock default configuration which gives you a caching-only DNS server. Then you just set /etc/resolv.conf
to use "nameserver 127.0.0.1" and you're done.
The nice thing is these two packages do not mess around with what's in /etc/resolv.conf
like dnsmasq does and is thus a cleaner solution IMHO. You can also usually remove the resolvconf
package so nothing messes around with /etc/resolv.conf
.
FYI, dnsmasq has gotten rather complicated, too many bells and whistles and is just causing pain for most people anymore. Violates KISS in my book.