Did you know that it’s possible to block advertisements in your home before they even get to the network? Introducing Pi-Hole, the software that can transform an ordinary Raspberry Pi into an advertisement blocking machine.
Pi-Hole doesn’t have its own Pi Linux distribution. Instead, anyone looking to use the software must first choose a Linux distribution. Pi-Hole officially supports a whole lot of distributions. That said, Addictivetips recommends the Raspbian operating system, as it’s officially supported by the Raspberry Pi developers themselves.
To learn how to install Raspbian, please follow our in-depth walk-through. When Raspbian is fully installed on your Raspberry Pi device, return to this guide to continue.
Note: Raspbian is the focus of this article, but other Pi distributions exist as well. The instructions for installing Pi-Hole are universal, so it’s safe to follow along with this guide even if you’re not using the operating system we use. Keep in mind that you’ll be responsible for troubleshooting any errors that come up.
The Pi-Hole blocking software isn’t a traditional Linux installer package. Instead, it’s a universal, “run-once” bash script. To start the installation, open up a terminal on Raspbian and execute the following command. If you choose to do this installation remotely, be sure your user can log in to the Pi over the SSH protocol.
curl -sSL https://install.pi-hole.net | bash
Using Curl to pipe the installation script directly to bash is very efficient, but doesn’t always work. If the above method fails, for whatever reason, grab the code via Github:
‘); if (navigator.appVersion.indexOf(“Mac”)!=-1) document.write(”);
git clone --depth 1 https://github.com/pi-hole/pi-hole.git Pi-hole cd "Pi-hole/automated install/" sudo bash basic-install.sh
Regardless of theÂ way you use to grab the Pi-Hole software, they’ll both automatically run the automatic installation script. When the script runs, it’ll let you know that it was “called with non-root privileges”. Pi-Hole’s installation tool can’t modify anything on the system without root, so you’ll be prompted to enter a password.
Note: running the setup the Github way will not run into root privilegeÂ issues.
The installation is completely automatic, so no interaction is required.
Once Pi-Hole is installed, the next step is to configure it. Directly after the installation script, a prompt appears. Read through and click “OK” with the enter key tillÂ the section on setting up a “Static IP address” appears.
Before the software can give Raspbian a dedicated IP address on the network, a DNS provider needs to enabled. Having a third-party DNS provider is essential, as going it alone with your own DNS server is slow. Choose one of the options (Google DNS, OpenDNS, etc.) and continue.
Following the selection of a DNS provider, Pi-Hole can set up an IP address. It’ll manually generate a new, permanentÂ IP. Don’t forget it, as this will be important later on.
Finish the installation by allowing Pi-Hole to install the web interface. When complete, open up a new browser tab and visit the URL shown on the screen.
Note: be sure to write down the password that Pi-Hole gives you at the end of the installation process.
Have some websites you want to support with advertising? Don’t worry, Pi-Hole makes it easy! Start off by logging in to the web interface. From there, click the side-bar menu, then select “Whitelist”. In the Whitelist area, type out the domain name you’d like to whitelist.
In addition to a Whitelist system that allows users to allow ads from certain websites, there is also a manual “blacklist” tool. If for some reason websites are coming through the ad-blocking system, you’ll need to add it to the blacklist. To add items to the blacklist, open up the Pi-Hole web UI, look to the side-bar menu and select “blacklist”.
Enter the IP address or domain name to the offending website. Pi-Hole should instantly block advertisements from the site right away.
Use Pi-Hole As Router DNS server
Pi-Hole at its core is a DNS server on the network. It works very well but falls flat if it’s not being used. To remedy this, you’ll need to change the default DNS settings on your home router to the IP address of the Pi-Hole. Keep in mind that each home router is different, and has its own unique user interface. To solve this problem, refer to your router’s manual (or do a quick Google search) to find out where the DNS settings are located.
Inside the DNS area of the router, delete any and all IP addresses from it and replace it with the Pi-Hole IP address. For ad-blocking to work, all other IP addresses in DNSÂ must be gone. When done, click “save” to apply the changes, and allow your router to restart. When it comes back online, your entire network will be protected with Pi-Hole!