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.

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.

Installing Pi-Hole

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:

curl -sSL | bash

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


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 as the only DNS server on your network. Make sure you zero out the other DNS servers.

4. Check out the 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.

Alexander Fox
Alexander Fox

Alexander Fox is a tech and science writer based in Philadelphia, PA with one cat, three Macs and more USB cables than he could ever use.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox