Network wide Ad Blocking With Raspberry Pi Pi-Hole

Network wide Ad Blocking With Raspberry pi Pi-Hole

We all use some kind of extensions in our browsers and computers to block ads on our devices – smartphones, tablets etc. But whatever we do there are still the issues blocking in-app ads like most are in mobile games. For that, we will be setting up Network wide Ad Blocking With Raspberry Pi Pi-Hole.

We need something that is better at doing all the stuff automatically. Welcome to Pi-Hole a Network-wide Ad Blocking solution, it blocks ads on router level and works as a DNS server and blocks out all the domains that are related to Ads.

And the best this is that you can set it up on a Raspberry Pi system so if you have a Raspberry Pi sitting around collecting dust pick it up and let’s make it into a Network-wide Ad Blocking With Raspberry pi Pi-Hole.

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 your 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.

What You’ll Need for Network wide Ad Blocking With Raspberry pi Pi-Hole:

  • Raspberry Pi (any model)
  • SD card and a card reader
  • Power supply
  • Ethernet cable
  • Keyboard (for initial setup)

Setting Up Raspberry Pi:-

The first thing that you need to do is download the Raspbian Stretch Lite as we don’t need the full GUI for this setup the GUI would use extra memory so we will just stick with the Lite version.

Download the image from Here, once you have downloaded the Raspbian image you need to burn it on your SD card you can use Etcher to do so I prefer it over Win32 Disk imager but you can use whatever you like.

Also Read: Linux For Beginners 

Configure Raspbian:-

After you have successfully written Raspbian to your SD card plug it in Raspberry Pi and power on and connect your monitor and keyboard for the initial setup then login to your account with username: pi and password: raspberry, then type this command and enable SSH:

  1. Enter sudo raspi-config in a terminal window.
  2. Select Interfacing Options.
  3. Navigate to and select SSH.
  4. Choose Yes.
  5. Select Ok.
  6. Choose Finish.
  7. Type ifconfig and write done the IP of raspberry pi

Now you can disconnect your monitor and do all the configuration over an ssh connection. Now the best thing that you can do to assign the static IP to your Raspberry Pi is in the router DHCP settings.

Static IP

Note down the Mac address of your Raspberry Pi from if config and under DHCP > Address Reservation assign static IP against your Raspberry Pi, using this way you don’t have to change any setting in your Raspberry. It will automatically get the same IP whenever it connects to the network.

Login using Putty (SSH client) and install the latest updates on the system type these commands in the terminal.

  1. sudo apt-get update
  2. sudo apt-get upgrade

Setting up Pi-Hole:-

After all the Configuration have been made then it’s time to install Pin-hole, so after that run this command on your terminal:-

curl -sSL | bash

Installing Pi-hole

This will automatically install all the required packages on your system just restart your Raspberry Pi system and visit the IP of your Raspberry Pi in your browser you will see something like this:

Just click on the Link on the page and you will be taken to the admin panel.

Pi-Hole Dashboard

Configuring Network-wide:-

Now to set it up on the whole network just log in to your router and in the DHCP setting add the Primary DNS with the IP address of your Raspberry Pi and save the settings then reboot your router.

Pi-Hole Network Configuration

Now all the devices that are connected to the network will have ad blocking enabled now enjoy your own ad blocking service.