Summary
Get inspired by this project. If you need some out-of-the-box functionality, try PiHole - just download the image and run. Tested at our makerspace.
Turn a cheap Raspberry Pi into a network-wide ad blocker. If you’re tired of AdBlock Plus slowing your browser down, this DNS-based option is a great alternative that works on any device. Unlike other solutions, this filters the web before it gets to your device, meaning you can block ads on your iPad or Android without the need for jailbreaking or rooting.
On top, the solution itself is very light-weight. So don't hesitate to use an older version of Raspberry Pi to host it - keeping your brand new and shiny devices for something more demanding.
Pi-hole is not only for your Raspberry Pi. As of this writing, you can add it to Fedora, Docker, Ubuntu, Debian ... basically onto any device.
Installation
This is a copy from Instructions and introduction from Jacob Salmela. Those are enhanced with my own comments, because the Pi-Hole got better since then. For instance, you are not required to setup a static IP address anymore. The script handles this part as well.
- Install Raspbian onto the Pi. Any version is OK, but Raspbian Lite works just fine. You can use it the limit some overhead
- Run
sudo raspi-config
to expand the filesystem and give the GPU less memory - At this point you were supposed to set a static IP address. The link is still provided but you can skip this step: the new script takes care of this. If this step fails, set a static IP address anyway - you can use our Recipe: Static IP on Raspberry Pi.
- Run this command:
curl -L install.pi-hole.net | bash
- [Critical Step] Configure your computers/devices to use the Pi as their DNS server
- [Optional] Block malware or tracking sites
- [Optional] Use alternative upstream DNS servers
- [Optional] Installing the mini LCD for real-time monitoring
NOTE: Don't forget to setup your timezone and location. The Raspberry Pi pulls the date / time on startup (if connected) and this reflects on the Pi-Hole statistics.
Monitoring
Since the first version of this script, a lot has changed. You can now connect to the Pi-Hole portal and have a nice graphical interface to show AD-Blocking performance.
You will find it at:
http://<YourIPAddress>/admin
Installation Notes
This section might help you if you get stuck, or might help you to discover more interesting features.
Changing Admin Password
If you ran the automated installation script, you will be presented at the end with a summary of settings: your IP, hostname, and password. This is autogenerated and is strong. However you might want to change the password; this can be done from the command line (not from the GUI itself). Just SSH to your Pi Hole Pi, and type:
pihole -a -p
Done.
And while you're at the command-line, check other available options. There's plenty to choose from: