This guide will show you how to create a minimalistic adblocking DNS server. This is a great alternative to Pi-Hole, which requires being run on a Raspberry Pi or in a Docker container.
dnsmasq using your distribution’s package manager.
Next, replace the contents of
/etc/dnsmasq.conf with the following:
domain-needed bogus-priv no-resolv server=22.214.171.124 server=126.96.36.199 interface=eth0 listen-address=127.0.0.1 cache-size=10000 local-ttl=300 addn-hosts=/etc/hosts-block
Note: you can remove the
listen-address lines if you want
dnsmasq to listen on all interfaces.
Next, you will need to download an ad server list. We will be using Peter Lowe’s adservers list in this example, but you can use other ones, such as this one available to use.
curl "https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0" -o /tmp/hosts-block sudo mv /tmp/hosts-block /etc
# Alpine Linux rc-service dnsmasq start # systemd distros (Debian, Ubuntu, Fedora, etc) systemctl start dnsmasq
That’s it! Enjoy your new ad-blocking DNS server. Remember to set your routers’ DHCP server to hand out the IP of your new DNS server.