Mimicking Pi-hole's ad blocking

Sat Aug 15 2020

I have been running Pi-hole in my home network for quite a while now but often had issues combining it with other services running in the network. So I decided to run an incredibly basic version of it myself.

Under the hood Pi-hole is nothing more than a dnsmasq server which caches all of your dns records and a bunch of dnsmasq address= configurations that resolve to nothing.

So what do you need? A single dnsmasq container will do and an ad blacklist found here.

Simply start up a dnsmasq container of your choice and create two volumes. One for the blacklist you just downloaded (mount it wherever you feel like) and one for the dnsmasq.conf config file itself as we still need to point dnsmasq to the blacklist.

1version: "3" 2 3services: 4 dnsmasq: 5 image: jpillora/dnsmasq 6 ports: 7 - 5380:8080 8 - 53:53/udp 9 restart: always 10 volumes: 11 - /home/foo/dnsmasq/dnsmasq.conf:/etc/dnsmasq.conf 12 - /home/foo/dnsmasq/dnsmasq.blacklist.txt:/path/to/dnsmasq.blacklist.txt

In your dnsmasq.conf you place the following line:


Point your router to your newly setup DNS server, restart your container and there we go. Everything defined in the blacklist will simply not resolve. A basic Pi-hole configuration that's entirely under our own control with a minimal setup. 😎