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:
- Raspberry Pi Zero W
- microSD (2GB should be sufficient but I personally got a 16GB one just because it’s really not that expensive) with adapter
- Micro USB to USB cable
Here’s my personal experience in the form of a simple, straightforward tutorial:
- Download and install Etcher
- Download the latest Raspbian Stretch Lite
- Insert and flash the microSD using Etcher. After the process is completed successfully, the microSD will be renamed
bootand you will be able to view its system files.
- Create the file `/boot/wpa_supplicant.conf`. Replace YOURWIFINETWORKNAME and YOURWIFIPASSWORD appropriately.
/boot/config.txt. Add the following to the end of the file.
# Enable UART
/boot/ssh. Leave it blank.
- 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.
- 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.
- You can now SSH into your Pi0. The default password is
ssh [email protected]
- 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
- Install Pi-hole
curl -sSL https://install.pi-hole.net | bash
- The installer will ask a bunch of questions and it’s mostly fine to go with the defaults for now. If you’d like to take it a step further to enhance your privacy, you can follow this guide after to run your own recursive DNS server.
- 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
- If you’d like to access your admin panel via the `http://pi.hole/admin` URL instead of the Pi-hole’s IP address, edit
[replace with Pi-hole's IP] pi.hole [replace with the actual hostname of the machine running Pi-hole]
- Login to your home network router’s admin panel (probably via 192.168.1.1.). Update the DNS 1+2 to use Pi-hole’s IP. I’m using Linksys’s and the settings can be found under Connectivity –> Local Network –> DHCP Server –> Static DNS. Save.
- Reboot any device connected to your network.
- That’s it. You should now have Pi-hole running on your network.
- While not recommmended by the developers, I run the following script via cron to keep my Pi-hole and the Gravity list updated:
echo "Update started" >> $LOG_FILE
date >> $LOG_FILE
pihole -up >> $LOG_FILE
pihole-g >> $LOG_FILE
- If you need to temporarily disable Pi-hole for whatever reason, you can either do so via the administrative panel or the API:
http://pi.hole/admin/api.php?disable=300&auth=[YOUR API AUTH KEY]
You can retrieve the API key by logging into the administrative panel, navigate to Settings -> API/Web Interface and click the ‘Show API token’ button.