Blocking Ads On Entire Wifi Network Using a Raspberry Pi

Setting up a Raspbery Pi as a “black hole” for your internet, blocking ALL ads from displaying on any device on your network. This not does this make your internet experience nicer, it saves you bandwidth, speeds up your connection, and protects you from spyware and virus-ridden websites.

Here is my first time setting up Pi-Hole on a raspberry pi to block ads on my network. This means, like browser add-ons that block ads, this DNS black hole will just block the ads before they even get a chance to get to your device.
The best part is blocking ads that overlay on Android / iPhone apps and also makes your network feel slightly faster.

This is not meant to be a thorough tutorial. If you’re not an tech-savvy person, or don’t have a lot of experience with a Raspberry Pi, I suggest you do some research on these tiny computers before trying something like this.

Here’s a preview of the glorious admin page you will be presented with once it is set up on your network. Keep in mind the default domain list is about 100k domains. I’ve downloaded a list of Reddit to get nearly 1.2 million domains blocked. This gave a lot of false positives and blocks instagram, etc. So if you’re willing to go through your query log and whitelist everything you’re trying to use manually you can download that list here.

Pi-Hole in action

First you need to get a Raspberry Pi, and install the latest version of Raspbian stretch.

After you’ve got it booted for the first time, run the following commands to update your Pi:

sudo apt-get update

sudo apt-get upgrade

sudo apt-get dist-upgrade

Wait for it all to finish updating.

Then, install the pi-hole software using the following command:

curl -sSL | bash

Disclaimer — As stated on the official Pi-hole website:

Our code is completely open, but piping to bash can be dangerous. For a safer install, review the code and then run the installer locally.

Once you’ve completed the install, that’s pretty much all you need to do on the Pi itself to get it running.

Now you just need to find out your Raspberry Pi’s IP address. Log into your internet routers Admin page and view the connected clients.

Another way to do this is download an app called Fing. This app scans your network and shows you the IP Address of every client connected to your network.

Here’s what my DHCP Table looked like:


Once you know the address of your Pi, you just need to set that exact same IP address as your DNS code on the same router.

Here’s what mine looked like:



Leave a comment