Dnsmasq example: DNS sinkhole: Difference between revisions

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


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

Revision as of 19:57, 11 October 2021

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

/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