How to Configure Raspberry Pi as Network Ad-Blocker


What is Raspberry Pi?

The Raspberry Pi is a series of single board computer which can be used to learn to program through fun and practical projects. It is a tiny affordable computer and is available to buy immediately.

The developers provide Raspbian, a Debian-based Linux distribution for download.

Buy Raspberry Pi from here.

Raspberry Pi as a network adblocker:

Here we will learn to configure our Raspberry Pi as an adblocker for our Wi-Fi network and block ad’s on all the devices connected to that network. It is an easy process and some of the features are as follows:

  • Block over 100,000 Ad-Serving Domains
  • Block Advertisement on Any Device
  • Improve Overall Network Performance
  • Reduce Data Usage
  • Monitor the Statistics and Performance
  • It is Free

How to Install Raspbian on Raspberry Pi?

Installing the OS for Raspberry Pi is a very easy process. Here are the steps on how to do so:

  • Download Raspbian Image – here


  • Insert SD Card into your computer and check for the letter which is assigned to the drive. Ex: D; If you do not have an SD card reader use a cheap SD card reader.
  • Download Win32DiskImage utility from here.
  • Install Wind32DiskImage utility and Run it.
  • Unzip the Raspbian Image zip file.
  • Run Win32diskImage software select the  Image file that you extracted and the SD card drive letter.

Win32 Disk Imager

  • Click on Write and wait for the write to complete.
  • Exit the imager and eject the SD card.


  • Connect the SD Card.
  • From the Apple menu, choose “About This Mac”, then click “System Report”
  • Click on “USB” or “Card Reader” if you are using the inbuilt card reader then search for your USB or card. Click on it and search for BSD name in the lower section. Take a note of this number.

macOS system report

  • Now unmount the partition so you are allowed to override the disk. Open Disk Utility and unmount it, do not eject or you have to reconnect the device.

Disk Utility - Unmount

  • Now, open Terminal and run the following command:

Pushing raspbian onto USB

sudo dd bs=1m if=path-of-your-image.img of=/dev/rdiskn

Remember to replace “n” with the number you noted before. Press Control+t to check the progress.

  • If this command fails then try using “disk” instead of “rdisk”
sudo dd bs=1m if=path-of-your-image.img of=/dev/diskn

Wait for the process to complete, after which we will move on to the next part.

Now just put the SD Card in your Raspberry Pi and we are done.

How To Configure Raspberry Pi as Ad-Blocker using Pi-Hole:

  • After Installation with above steps, power up your raspberry pi and connect it to the internet using ethernet.
  • Find IP of your Pi and enable SSH using the guide – here.
  • Login to Raspberry Pi using mac terminal. Using the following commands, by default, the login name is “pi” and the password is “raspberry“.

Raspberry Pi login

ssh pi@your-raspi-ip-address
  • First Update the package list using:

update package list

sudo apt-get -y update
  • Now to update the package themselves (this will take some time, please be patient):

Update package

sudo apt-get -y upgrade
  • Now we need to set our IP as static so that it does not change when we reboot raspberry pi.

Firstly, Type the following command:

sudo command

sudo nano /etc/network/interfaces

Next, change the below:

static ip

Lastly, change the above to:

Static ip set

Remember here address is your IP address and gateway your router’s address. Netmask should be same as above.

  •  Now to install the Ad-Blocker just enter the following command in the command line:

pi hole setup command

curl -sSL | bash

network wide ad blocker

  • Click on Ok, Ok until you need to select DNS Provider, I prefer Google.
  • Keep hitting Ok again till you reach the window below, Now select IPV4.

IPv4 Config

  • Click Ok till It will ask you to use current settings as a static check and save the IP displayed.

Static ip settings

  • It will run some background commands and install Pi-Hole.
  • After Installation, you will reach a page showing you the password to login to pi-hole to check all about it. Just save it.

Pi Hole Login details

  • Reboot your raspberry pi after all this and this is all you need to do on your pi.

Now Configure Your Pi-Hole to your network:

  • Login to your router
  • Find the type of internet access and select DHCP under internet settings.
  • Select Manually Configure DNS
  • DNS1: IP address of Raspberry Pi
  • DNS2: IP address of google in case Raspberry Pi is not working.

DHCP wifi settings

  • Apply the new settings and reboot your router.

Now, you can log in to your Pi-Hole using: your-ip/admin/ (ex:

This is what it looks like:

Pi Hole Console

That’s It!!!!

Let us know if you were able to turn you Raspberry Pi into an Ad-Blocker. Also if you faced any problems during installation.


Please enter your comment!
Please enter your name here