Setting Up Pi-hole
This is the process I used to install a Pi-hole on my home network. For this project, I followed the instructions from The World’s Greatest Pi-hole Tutorial but adapted it to fit my situation.
Background
It can’t just me who thinks that website advertisements are more aggressive than they used to be. Recently, I encountered websites so laden with advertisements that I can barely see the content, and my older devices struggled to even scroll.
Plus, when I became a father, I gained a new perspective on life. With this new perspective, I began to question the criteria advertisers use in determining what is appropriate to show to impressionable minds.
At first, I tried to configure my router to block a few addresses, but this only slowed the internet more. Then, after some brief research, the answer was unanimous: get a Pi-hole.
Materials
As with any project, it starts with gathering materials. Below are the materials I gathered:
- Rasberrry Pi. I opted for the Raspberry Pi Zero 2 W. I purchased a kit which included many of the other required materials listed below.
- A compatible microSD card.
- An ethernet adapter. The Pi Zero doesn’t have a built-in network cable port, so one has to be added on with a USB adapter. Sure, I could have connected over Wi-Fi, but I find a physical wired connection to be more reliable.
- A microSD card reader.
- A laptop or some way to write OS images to removable media. I used a Chromebook and the Rasberry Pi Imager. See my previous write-up on using the Raspberry Pi Imager on a Chromebook.
Setup Procedure
Below is the process I followed in installing Pi-Hole on the Pi.
1. Write the OS Image
Write the Raspberry Pi OS image onto the memory card. There are many ways to do this. I chose to use the Raspberry Pi Imager because it sets configuration when writing the image. For the configuration, I set values for: hostname, user credentials, SSH, timezone and keyboard layout.
2. Boot Up
Insert the memory card into the Pi and boot it up.
3. Attach to the Network
After a few minutes of the Pi running, attach the network cable. It took me a while to figure out I needed to attach the network cable as a separate step. Because I used an ethernet adapter, the OS had to first recognize the adapter before it recognized the network connection. Otherwise, the Pi would just sit there and not connect.
4. IP Address
Find the Pi’s IP address. I found it on the list of connected devices on my home router. Since I was already in my router’s administration screen, I also set its address as static.
5. SSH
SSH into the Pi. Use the credentials configured earlier.
6. Update
Install updates on the machine.
sudo apt update && sudo apt upgrade -y
7. Install Pi-hole
Use the command below to install the Pi-hole service on the Pi. This will start an installation wizard.
curl -sSL https://install.pi-hole.net | bash
For its configuration values, I used the default values except for the upstream DNS servers. For these, I manually entered addresses for Cloudflare (listed here).
At the end of the installation wizard, take note of the web GUI admin password displayed.
8. Password Update
If you choose, you can update the web GUI admin password by entering the command below.
pihole -a -p
9. Look around the Web GUI
Log onto the Pi-hole web GUI and take a look around. To do so, enter the Pi-hole admin address into your web browser. Depending on the hostname you configured earlier, the address will be something like http://pi-hole/admin.
10. Router DNS Settings
Update your router’s DNS settings to use the new Pi-hole server. Enter the Pi-hole IP address into the field for the primary DNS server field. If you have only one Pi-hole server, leave the secondary server field blank.
11. Donate
Totally optional. The Pi-hole project is community-driven, so I encourage you to donate to keep it going. Navigate to https://pi-hole.net/donate/ to give.
Results
Since adding a Pi-hole to my home network, I have seen mostly positive results:
- Less advertisements appear (as designed).
- Website browsing speed greatly improved. The speeds boost is mostly a result of less memory/CPU utilization from the lack of advertisements. Also, Pi-hole caches DNS results locally, which reduces DNS query times.
- There is less worry about what content appears to children. Additionally, any additional websites I want blocked are only a few clicks away from becoming blocked.
- From browsing Pi-hole’s web GUI, I have gained a better understanding of traffic traversing the network.
Although, there have been downsides:
- For many websites, advertising is their sole revenue source. Running ad blockers, in turn, reduces their income. To compensate, I attempt to enroll into subscriptions when appropriate.
- I found a few online shopping sites tied in tightly with their advertisement platform, which prevents results from loading.
Conclusion
The Pi-hole is a great product. I definitely recommend it for those who want to have greater control over a home network and the content traversing it.
The journey to set up a Pi-hole on my home network was my first exposure to using a Raspberry Pi. In the end, it was a positive learning experience for me.