Dnsmasq example: DNS sinkhole

From wikinotes
Revision as of 20:01, 11 October 2021 by Will (talk | contribs)

See wikipedia definition.
Here, we're using it to block advertisers.

The general idea is that we'll redirect several hostname DNS requests to 0.0.0.0/::1
(so they never reach their intended target) using address= substitutions.

/etc/dnsmasq.d/10-sinkhole.conf

Based on pi-hole

log-queries                   # log rejected attempts
localise-queries              # hostnames are localized to their subnets (allowing reuse in different subnets)
no-resolv                     # only configured nameservers are used (ignores resolv.conf)
cache-size=10000              # keep LRU cache of 10_000 domain-names
local-ttl=2                   # instructs requester caches host/dhcp-leases for 2s
log-async                     # async logging

# domain-name substitution
address=/example.com/         # redirect all requests to example.com to 0.0.0.0 or ::1
address=/example.com/0.0.0.0  # same

addn-hosts=/etc/foobar/hosts  # adds a file with several 'address=' statements


# use open-dns
server=208.67.222.222
server=208.67.220.220