Connect with us

How To

How to Use the Raspberry Pi as a Network-Wide Ad Blocker?



Raspberry Pi Ad Blocker

Unlike many other ad blocking services, that blocks ads on your computer, the Raspberry Pi can do something more, which blocks the ads at the router level, So that there will be no ads on your computer, and also no ads on your smartphone, tablet and any other device on your network. This article will help you to use your Raspberry Pi as a network-wide ad blocker.

Raspberry Pi Ad Blocker
Raspberry Pi Ad Blocker

Related: How to Create a Raspberry Pi Thermometer Using Sense HAT?

How to Use Your Raspberry Pi as a Network-Wide Ad Blocker? | Raspberry Pi Ad Blocker

To block the ads at a router level, we will use Pi-hole, which is a server program. You should install it on Raspbian OS, so you can begin this by installing Raspbian and updating it (sudo apt-get update && sudo apt-get upgrade).

Step 1: Now Launch the Pi-hole installation wizard and enter into the Terminal and enter the following command:

curl -sSL | bash

This brings up the installation wizard. The installation wizard shows you that since the Pi-hole is a server, it needs the static IP address. It shows this in ALL CAPS to enlarge it.

Raspberry Pi Ad Blocker
Raspberry Pi Ad Blocker

Step 2: Now you can choose the interface and configure your static IP settings. Hit okay to get the installation wizard and then choose between the Wi-Fi and Ethernet. Either will work. Once you have clicked the OK for the installation wizard into submission, it will install the packages and let you know when it is complete.

Raspberry Pi Ad Blocker
Raspberry Pi Ad Blocker

Step 3: Write down the Raspberry Pi’s IPv4 address, When the installation wizard wraps up, you will get the dialogue box titled “Installation Complete!” In that box, you will be your Pi’s IPv4 address. You can write that down along with your password, you will need them in future.

Raspberry Pi Ad Blocker
Raspberry Pi Ad Blocker

Step 4: Now its time to change your server’s DNS settings. Everything that runs through your Pi-hole server will have ads blocked Now you have to force the device traffic through the server.

Related: How to Use the Raspberry Pi as a NAS box?

This part will vary based on your operating system:


  1. Right-click the Start button and then select Network Connections
  2. Right-click your Wi-Fi network or Ethernet and select Properties
  3. Double-click the Internet Protocol Version 4 (TCP/IPv4)
  4. Click Use the following DNS server addresses.
  5. Now enter the Raspberry Pi’s IP address as your Preferred DNS server.
  6. Click OK and then, once again, OK.


  1. Click the Apple menu and navigate to the System Preferences…>Network>[your network]>Advanced…>DNS
  2. Now click the plus sign on the left side and then enter your Raspberry Pi’s IP address
  3. Click OK and then Apply


  1. Navigate to Settings>Wi-Fi
  2. Press and hold the current network and then navigate to Modify Network>Show Advanced Options
  3. Change your IP Settings to Static
  4. Enter the Raspberry Pi’s IP address under DNS 1
  5. And tap Save


  1. Navigate to Settings>Wi-Fi>[your network]>DNS
  2. Enter the Raspberry Pi’s IP address.

Once you have done this, you couldn’t see ads anymore.

Step 5: If you want to whitelist some sites, just follow the step below.

To whitelist sites, go to the Pi-hole interface on your browser as you did in Step 3 – though this time you have to log in to the interface using the password that Pi-hole provided.

Raspberry Pi Ad Blocker
Raspberry Pi Ad Blocker

Now click Whitelist and add sites that you want to whitelist. That’s it you are done.

Raspberry Pi Ad Blocker
Raspberry Pi Ad Blocker

These are the ways to set up Raspberry Pi Ad Blocker. Thank you for reading this post.