You have software to block ads on your computer, but if you want to block ads on all your devices—from your smartphone to your tablets—you’ll need something a little stronger. Enter the Pi-Hole, a Raspberry Pi image that blocks ads of all sorts at the router level.


Some ads are obnoxious, but remember: ads are how sites like us make enough money to run, so unless you want to see all your favorite sites go out of business, we humbly remind you to whitelist the sites you love.

Once you set up the Pi-Hole, ads get blocked before they even get to your computer, smartphone, or any other device on your home network. Besides freeing up your browser from running another extension, this should speed up your browsing and cut down on load times (it should even cut out things like those annoying in-game ads in iOS and Android). This will only work when devices are connected to you home network so if you leave the house, the blocking won’t work anymore, but it’s still useful if you’re not a fan of ads. Luckily, developer Jacob Salmela has a pre-configured Pi image that’s easy to install and set up. With it, your Pi gets set up automatically and you simply need to change a few settings on your devices.


What You’ll Need

Step One: Download and Burn the Pi-Hole Image

The first thing you’ll need to do is download and burn the Pi-Hole image. The image is a version of a Raspberry Pi operating system called Diet Pi, which cuts a lot of junk from Raspbian, and is packed with all the software needed to run the ad blocker. You can follow our guide to make an image here, but here’s the short version.

Windows

Download the preconfigured Pi-Hole image Download Win32DiskImager Connect your card reader to your Windows PC and insert your SD card. Open Win32DiskImager.exe, the application you just downloaded, by double-clicking it. If you’re running Windows 7, 8, or 10, right click on it and choose “Run as Administrator” instead. If your SD card isn’t automatically detected by the application, click on the drop-down menu at the top right (labeled “Device”) and choose it from the list. In the image file section of the application, click the little folder icon and choose the Pi-Hole .img file you just downloaded. Click the Write button and wait for Win32DiskImager to do its thing. When it finishes, you can safely eject your SD card and insert it into your Raspberry Pi.


OS X

Download the preconfigured Pi-Hole image from here Download RPi-sd card builder Connect your card reader to your Mac (if necessary) and insert your SD card. Open RPi-sd card builder. You’ll immediately be asked to choose a Pi-Hole image. Choose the .img file you downloaded earlier. You’ll be asked if your SD card is connected. Since we inserted it earlier, it is, so go ahead and click Continue. You’ll be presented with SD card options. If you only have one inserted, you won’t see anything else in the list and it’ll be checked. If not, just check only the card you want to use and click OK. Enter your administrator password and click OK. You’ll be asked if the SD card was ejected. This is supposed to happen, as the application needs to unmount it to perform a direct copy. Double-check that your SD card is no longer available in the Finder. DO NOT remove it from your USB port or card reader. When you’re sure, click Continue. RPi-sd card builder will finish prepping your SD card. Safely eject it and insert it into your Raspberry Pi.


Step Two: Boot Up and Configure Your Raspberry Pi

Insert your SD card into your Raspberry Pi and connect the keyboard. Connect the Ethernet cable to your Wi-Fi router, then plug in your Raspberry Pi, and wait for it boot.


When you first boot up your Raspberry Pi, it’ll boot and reboot several times. This is normal, so let it happen. For the most part, it’s doing basic setup procedures like expanding the file system and getting the network settings configured. Eventually it will boot up to a login screen.

Log in with the username: root and password: dietpi. Once you do so, your Raspberry Pi will check for and possibly download a set of updates, so wait this out as well. When it’s done, you’ll need to reboot again, then login.


Step Three: Set Up a Static IP Address for Your Pi


After all those reboots, you’ll eventually get to the DietPi Setup screen where you can assign a static IP address. This is necessary so your Pi will always be available at the same address from any of your devices. Here’s what you’ll need to do:

Select Okay at the initial setup screen. Select Change Wired Network Settings. Select Change Mode and press Enter to change it to Static. Select Copy Current Address to Static. Make a note of the IP address listed at the top, you’ll need that in the next step. Select Apply to save the changes and restart the network. When that’s complete, select Exit to restart the device one more time.

After the network settings are configured, your Pi will restart again. Next, install the Pi-Hole software (this can take a while, it took about 20-30 minutes for me), then restart one final time. Once it restarts, the ad blocking software will be run automatically, so all you need to do is set up your computers.


Step Four: Point Your Devices to the Raspberry Pi for DNS


Once your Raspberry Pi is running the Pi-Hole software, you’ll still need to route your device traffic through it so ad blocking works. To do this, you’ll need to change your devices’ DNS settings. This way, you devices ping the Pi to block ads as long as they’re all on teh same network. This is pretty simple, but varies depending on your devices and what they’re running.

Windows

Right-click the Start Button and select Network Connections. Select your Wi-Fi or Ethernet network. Double-click Internet Protocol Version 4. Click Use the following DNS server addresses. Under the Preferred DNS server, enter your Raspberry Pi’s IP address you gathered in step three.


OS X

Open System Preferences. Click on Network. Select your Wi-Fi or Ethernet network. Click on Advanced. Click the DNS tab. Click the plus sign and enter your Raspberry Pi’s IP address you gathered in step three.


Android

Open Settings. Select Wi-Fi. Long press on your current network and select Modify Network. Tap Show Advanced Options. Change the IP Settings to Static. Enter your Raspberry Pi’s IP address under the DNS field.

iOS

Open Settings. Select Wi-Fi and tap your home network. Tap DNS and enter your Raspberry Pi’s IP address.

You can also track how the Pi-Hole is doing at blocking ads by heading to: [RaspberryPiIPaddress]/pihole/index.php


Here, you’ll see stats and additional info.

Whitelist Sites

By default, the Pi-Hole blocks a lot of sites, but you can whitelist your favorite sites, though it’s a little complicated right now. First, you’ll need to head back to your Raspberry Pi. When you boot up the Raspberry Pi and login, you will automatically be at the command line. Here, you can create and edit a text file with the sites you want to not block ads on:

From the Raspberry Pi’s command line, type in cd /etc/pihole/ Type in nano whitelist.txt to open a blank text file. Type in the URL of any sites you don’t want to block ads on. Press Enter between each entry to put each on a new line. Use both www.site.com and site.com for the sites you don’t want to block. Press CTRL+X to save and exit. Restart the Raspberry Pi and the changes will take effect.

Future updates also promise the ability to edit white and black lists from the aforementioned Index screen, so keep an eye on that. For a more in-depth look at creating your own white and black lists, you can follow this guide.