How to setup Pi-hole with Raspberry Pi Zero W?

After finding out how much it costs in the US to purchase the Raspberry Pi Zero W and combined with my longstanding desire to tinker and get my hands on a Raspberry Pi, even though I had no idea what I was gonna do with it, I ordered one from Argon40. With shipping, it added up to around S$20.

As I am usually quite annoyed by the rampant advertising encountered everywhere online, one of the first things I’ll download on my new devices (aside from the browser) is the amazing uBlock Origin. However, my family aren’t as savvy and while I do try to help them whenever I can, it can be quite cumbersome to do so for all their devices.

Naturally, the first project which came to mind is the Pi-hole, a network-level solution designed to block advertisements and trackers. I’ve gone through a number of tutorials but most of them are by the Raspberry Pi accessories sellers themselves which left me uncertain if I actually do need a certain component to get my Pi0 working.

What you really need:

Here’s my personal experience in the form of a simple, straightforward tutorial:

  1. Download and install Etcher
  2. Download the latest Raspbian Stretch Lite
  3. Insert and flash the microSD using Etcher. After the process is completed successfully, the microSD will be renamed boot and you will be able to view its system files.
  4. Create the file /boot/wpa_supplicant.conf. Replace YOURWIFINETWORKNAME and YOURWIFIPASSWORD appropriately.

    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
  5. Edit /boot/config.txt. Add the following to the end of the file.

    # Enable UART
  6. Create /boot/ssh. Leave it blank.

  7. Eject the microSD safely and insert it into your Pi0. Connect the Pi0 PWR IN port to the router USB port. That will be serving as the Pi0’s power source.

  8. Wait for at least 2 minutes to allow the OS to boot. You can verify it’s working from the blinking green LED light on the Pi0.

  9. You can now SSH into your Pi0. The default password is raspberry.

    ssh pi@raspberrypi.local
  10. Run the following commands to update the system and configure your Pi0. Probably a good idea to change the password.

    sudo apt-get update
    sudo apt-get upgrade
    sudo raspi-config
  11. Install Pi-hole

    curl -sSL | bash
  12. The installer will ask a bunch of questions and it’s mostly fine to go with the defaults (I went with Quad9 for my upstream DNS provider).

  13. It’ll probably take a while but once the installation finishes, take note of the web admin login URL and default password. You can change it immediately with the following command:

    pihole -a -p
  14. Login to the Pi-hole web admin. Under the settings menu, enable DHCP. Save.

  15. Login to your router admin (probably via and disable the DHCP there.

  16. Reboot any device connected to your network and you should see the name of the device appear on the Pi-hole DHCP leases control.

  17. That’s it. You should now have Pi-hole running DHCP services on your network.

So simple!

20 March 2019