[arch-general] dnsmasq w/ad-blocking hosts file (was NTP: Possible permissions bug)

Carl Schaefer schaefer at trilug.org
Sat May 10 12:41:36 EDT 2014


On Fri, 2014-05-09 at 18:34 +0200, luc.linux at mailoo.org wrote:
> To cache your values of /etc/hosts, you can install a dns server locally
> (like dnsmasq). That way, dns resolution of cached values are nearly
> instantaneous, and you can have a lot of dns rules. I have an /etc/hosts
> of 16M, and yet I have a really fast DNS resolution.

thanks, that looks like a good solution.  This is what I ended up doing:

. revert /etc/hosts to local definitions
. download the ad-blocker hosts file to /etc/hosts-adblock
. install dnsmasq, and add to /etc/dnsmasq.conf:
  addn-hosts=/etc/hosts-adblock
. remove "hosts" from /etc/host.conf

Also, since my machine doesn't travel:
. add "nohook resolv.conf" to /etc/dhcpcd.conf
. put "nameserver 127.0.0.1" in /etc/resolv.conf
. add to /etc/dnsmasq.conf
  no-resolv
  server=8.8.8.8
  server=8.8.4.4

I haven't set this up on a laptop yet, but I imagine that would be more
complicated because sometimes the google DNS servers will be
inaccessible (e.g. hotel wifi).  Using OpenDNS on port 5353 might be a
good alternative.
Carl


More information about the arch-general mailing list