Block and Send Ads to a Black Hole with Pi-Hole

A Pi-Hole is a network-wide ad blocker that intercepts ads on any device on your network. It targets a list of thousands of ad-serving domains and directs their content to a black hole, removing them from sight. Because it runs network wide, it on any any device that’s connected to your network, without additional software. It even runs in mobile device apps, reducing bandwidth usage and improving performance. You can run it off a measly Raspberry Pi or any other Linux box you have lying around.

pi-hole-what-is-pi-hole

Pi-Hole calls itself “a black hole for Internet advertisements.” It works by running all out-bound server requests against an internal blacklist. To make this happen, you’ll need to set the Pi-Hole as your DNS server. This allows the Pi-Hole handle address resolution requests and view the IP addresses of requested information. As a result, it has the power to selectively mute certain outbound requests based on their IP addresses.

If the Pi-Hole sees a connection request that matches its blacklist, it blocks that request from reaching the ad server or destination. Over 10,000 domains are on the blacklist, and Pi-Hole stops requests from ever reaching their servers. This means no ads are downloaded, so bandwidth is saved and connection speed is improved.

Pi-Hole doesn’t just block ads, either. It can also protect your network against all kinds of Web-based attack vectors. The system also includes a robust web-based portal for monitoring and auditing Pi-Hole’s operation.

Better still, all of this is free and open-source. The only part that isn’t open-source is the name and logo, which are registered as trademarks.

1. Install a compatible Linux distro

Pi-Hole can run on just about any Linux-capable device. For reference, Pi-Hole officially supports these distros:

  • Raspbian: Jessie / Stretch (lite / with pixel)
  • Ubuntu: 14.04 / 16.04 / 16.10
  • Fedora: 24 / 25
  • Debian: 8.6
  • CentOS: 7.2.1511 / 7.3.1611

2. Run the installer

Pop open a Terminal and run the command below to install the software:

Do note that you’re piping a curl command in to bash. That should make you a little nervous, since it’s pretty dangerous. If you want to ensure the software is not malicious, you can review Pi-Hole’s source code. You can also install the software manually from Pi-Hole’s Github repository.

3. Set the Pi-Hole as your DNS server

pi-hole-dns-server-settings

You’ll need to configure the DCHP settings on your router to set the Pi-Hole as your network’s DNS server. Instructions will vary for each model. Set the Pi-Hole’s IP address (something like 192.168.0.250) as the only DNS server on your network. Make sure you zero out the other DNS servers.

4. Check out the web interface

pi-hole-web-interface

Once you set Pi-Hole as your DNS server, you’re done. You’ll be blocking ads everywhere, for any device on your network. To tweak the Pi-Hole’s configuration, you can visit http://pi.hole on your network.

Pi-Hole is an extremely powerful tool for some heavy duty ad-blocking. It does require you to do some serious system configuration and put your trust in open-source software. But if you have a spare Linux box lying around, you’re probably used to that! If the system doesn’t work out for you, you can always return your DNS settings to their defaults and disconnect the Pi-Hole without any adverse effects.

7 comments

  1. > This means that the Pi-Hole is in charge of routing all Internet traffic in and out of your local network.

    This is inaccurate. The Pi-Hole does not route any traffic. It simply tells any machines using it for DNS which servers they should talk to. This may sound like routing, but the big difference is that traffic other than DNS does not go through the Pi-Hole. It’s still your router that routes traffic.

  2. this would be so GREAT if it would also run on a Windows system or even where it could run on a home network system via a router/wireless system. I hope that they are working on something along this line

    • It would be GREAT if certain Windows programs ran on Linux, but, alas, that is not to be. :-)

      Window Fans never cease to point out to us deprived Linux users that Windows has so many more apps than Linux. Well, it doesn’t have Pi Hole. Now the shoe is on the other foot and it pinches.

  3. The curl doesn’t work for Arch Linux distros. But, you can install pi-hole using the Add/Remove Software packager or Octopi. I tried with thPacman but it was a no go.

  4. I had assumed form the headline this was a tool for use with a Raspberry Pi.. and since it’s not, why use the the ‘Pi’ name at all? (and it is a weird and slightly rude name anyway.. could you think of anything more accurate?).

    Thanks for the article!

Leave a Comment

Yeah! You've decided to leave a comment. That's fantastic! Check out our comment policy here. Let's have a personal and meaningful conversation.

Sponsored Stories