The SD card on one of my Pi Zero Ws died and now I have to set it back up again on a new one. It was running Pi-hole along with a few other stuff. For those that don’t know; Pi-hole is a open source, network-wide ad blocking solution that works by blocking DNS queries. Read more about it here.
First I setup a static IP for my Pi Zero W in the router’s DHCP.
SSH to the device and install Pi-hole. Installation is guided and interactive. It is the easiest way to install.
curl -sSL https://install.pi-hole.net | bash
Once its successfully installed, modify DNS on your router to use the reserved IP of the Pi.
Now all the DNS queries should go to the Pi.
It also provides a nice web ui that allows us to monitor the blocked queries.
I used a simple Ansible role to set this up without the web UI as the Zero W does not have a lot of resources.