A Whole-Network Ad Blocker, or a Call-Home VPN
September 5, 2017What You’ll Need
- Raspberry Pi (any model)
- SD card and a card reader
- Power supply
- Ethernet cable
- Keyboard (for initial setup)
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.
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
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.
[RaspberryPiIPaddress]/pihole/index.php
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
andsite.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.