I’ve heard a lot of praise about Pi-hole project but hadn’t gotten around actually trying it yet until recently.
Pi-hole is a network-wide ad-blocking solution via local DNS. You set it up as a local DNS server and it will block all the ads that match the rule from DNS level. This way, you don’t have to setup adblock on each and every devices you have, especially tablets and mobiles.
People usually use it with a low powered device like Raspberry Pi (hence the name Pi-hole) but in my case, I already have an Intel NUC around as Plex server (running Windows 10). I could just use it instead of setting up sth new.
The easiest way to install Pi-hole is to use Docker. The process is as easy as
- Install Docker for Desktop.
- Create a few folders for pihole config. Let’s do it in Documents folder and mount it to container. If you change it to something else, make sure to update the following commands. Create the 3 folders with the folowing structure.
pi-hole-config/ ├── dnsmasq.d/ ├── pihole/
- Download and run pihole Docker container with the following command
docker run -d --name pihole \ -p 53:53/tcp \ -p 53:53/udp \ -p 80:80 \ -p 443:443 \ -v "/c/Users/<USESRNAME>/Documents/pi-hole-config/pihole/:/etc/pihole/" \ -v "/c/Users/<USESRNAME>/Documents/pi-hole-config/dnsmasq.d/:/etc/dnsmasq.d/" \ -e ServerIP="<YOUR_HOST_IP>" \ --dns=127.0.0.1 \ --dns=220.127.116.11 \ -e WEBPASSWORD=<PASSWD> \ --restart=unless-stopped pihole/pihole:latest
- I need to disable Windows Firewall for local network which I think it’s safe to do at home in order to access the container from other machine.
And that’s it. Now you can head over to
HOST_IP/admin to login and configure
Pi-hole. Once it’s done, you can config your router to use the
HOST_IP as the
default DNS server, and maybe Cloudflare or Google’s DNS as backup.
Ah, and make sure to set static IP for your Pi-hole host machine so you don’t
have to update router’s setting if the IP changes.
Keep in mind that Pihole is not a complete replacement for browser extension like uBlock origin. You probably still needs that because DNS-based adblocking functionality is quite limited. It’s mostly useful for mobile browser where adblocking is almost non-existent or not good enough.