Skip to content

Instantly share code, notes, and snippets.

@mencargo
Last active August 20, 2021 16:36
Show Gist options
  • Save mencargo/1c66729f3db840f49c8cde2012d437d7 to your computer and use it in GitHub Desktop.
Save mencargo/1c66729f3db840f49c8cde2012d437d7 to your computer and use it in GitHub Desktop.
Simple DNSmasq filter

DNSmasq for local DNS service:

Config file usualy in /etc/dnsmasq.conf

no-resolv
user=root
server=8.8.8.8
server=1.1.1.1
server=9.9.9.9
cache-size=6400
listen-address=127.0.0.1

Filter Ads, Malware, Porn, Fakenews, Gambling, etc:

Get/Update your hosts file, make it IPv4 & IPv6 friendly:

# /usr/bin/curl /root/dns/hosts https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-porn/hosts | awk '$1 == "0.0.0.0" { print "::1 "$2"\n0.0.0.0 "$2""}' > /root/dns/hosts

You may want to choose a different hosts file.

You may want to create an @ reboot record for crontab, or something like that

Add the following line to your dnsmasq.conf hostsdir=/root/dns

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment