Search results for

All search results
Best daily deals

Affiliate links on Android Authority may earn us a commission. Learn more.

How to block ads across your entire home Wi-Fi network with a Raspberry Pi

Tired of ads on your smartphone and smart TV? Use a Raspberry Pi to block them all.

Published onSeptember 1, 2023

A Raspberry Pi 4 functioning as a desktop computer.

It’s no secret that online advertisements can sometimes disrupt your web browsing experience. Even on mobile, it’s impossible to escape banner ads, pop-ups, and other unwelcome distractions. Phone and TV manufacturers have also started sneaking advertisements into Android skins and interfaces. Thankfully, there’s an easy way to block ads on your entire Wi-Fi or home network, with hardware as inexpensive as a Raspberry Pi Zero (~$10) and a piece of free software known as Pi-hole. Follow along to learn how.


To block ads on your entire home network, all you need is a DNS filter like Pi-hole running on a low-power computer, like a Raspberry Pi. Then, simply change the DNS settings on your router to send future queries to the Pi-hole computer instead of the default setting.


Preface: How does Raspberry Pi ad-blocking work?

RyFi WiFi icon next to ethernet cable

You’re probably already familiar with browser-based extensions that allow you to block ads from websites. However, that’s not always a viable strategy — most Android web browsers, including Chrome, don’t support extensions. The same applies to smart televisions, game consoles, and other non-browser apps. Luckily, you can block ads across your entire network using a DNS-level filter or sinkhole.

DNS stands for Domain Name System. Its job is to convert human-readable domain names (like to an IP address that computers can recognize. By default, your router forwards all DNS queries to your internet provider’s servers.

However, we can also change some settings and route all DNS requests to a different destination — such as the Pi-hole ad-blocking filter we’ll install in this guide. Then, whenever a device on your network tries to contact an advertising-related domain, our custom DNS server will block it. Other non-advertising domains, meanwhile, will continue to be passed through to an upstream DNS server like Google or Cloudflare.

Pi-hole uses DNS filtering to selectively block ads and malicious domains across your entire home network.

The advantages of this approach are clear: you don’t have to install ad-blocking software on each and every device in your household. Moreover, it only needs to be set up once. Filtering DNS is also extremely resource-efficient since the process happens on a separate, dedicated device. If all of that sounds good to you, here’s how to install Pi-hole on a Raspberry Pi to block ads across your entire network.

Gather hardware and install Raspberry Pi OS

For this guide, you’ll need a computer that you can leave running throughout the day. Since DNS queries are extremely lightweight, the Raspberry Pi family is the perfect choice for this purpose. These devices consume very little power and you can even get away with the lowest-end Raspberry Pi Zero W (~$10) or an older full-sized Pi 3 (~$25-35). You can also repurpose an old laptop or desktop for this purpose — just ensure that you don’t pick powerful, power-hungry parts. Here’s everything you’ll need:

  1. A Raspberry Pi or similar low-power computer
  2. Power adapter
  3. MicroSD card (8GB or higher)
  4. (Optional) An Ethernet cable to directly connect the Raspberry Pi to your router.

Once you have the hardware ready, it’s time to install an operating system to the microSD card. Start by visiting this link on a desktop computer or laptop and downloading the Raspberry Pi Imager tool. Then, insert the microSD card into your computer.

Next, install and open the tool. Select Raspberry Pi OS (Raspbian) as your operating system, and the microSD card from the list of drives.

pi hole adblock Step 1
Calvin Wankhede / Android Authority

Press Ctrl + Shift + X simultaneously to bring up the advanced settings menu (pictured below). Click on Enable SSH and enter a password. If you’d like to use a wireless connection on the Pi, you should also enter your Wi-Fi credentials here.

pi hole adblock step 2
Calvin Wankhede / Android Authority

Close the advanced settings menu and hit the Write button. Acknowledge the warning and proceed. At this point, the tool will automatically download a copy of the Raspberry Pi OS and write it to your microSD card.

pi hole adblock step 3
Calvin Wankhede / Android Authority

Once complete, pull the microSD card from the computer and insert it into the Pi. Power up the board and wait for it to boot — it may take a few minutes. If you didn’t enter your Wi-Fi details earlier, don’t forget to connect the Pi to your router via an Ethernet cable.

Install Pi-hole on the Raspberry Pi

With the Raspberry Pi up and running, all we need to do now is install Pi-hole and configure your router to redirect DNS queries to it instead. Before that, though, we must figure out the Pi’s IP address on our local network. An easy way to do this is with a network scanning app like Fing. In my case, the IP address was (pictured below), but it might look completely different for you.

pi adblock step 16
Calvin Wankhede / Android Authority

With that, we now have enough information to remotely connect to the Raspberry Pi. Remember the SSH setting we turned on in the previous section? That will allow us to execute commands on the Pi from a different computer or smartphone. For this tutorial, we’ll use PuTTY on Windows, but the general steps are the same even if you use a different SSH client like Termius on Android or iOS.

How to install Pi-hole on a Raspberry Pi:

Open your preferred SSH client, enter your Raspberry Pi’s IP address from the previous step, and click Connect or Open.

pi adblock step 4
Calvin Wankhede / Android Authority

Accept the security prompt, if one appears.

pi hole adblock step 5
Calvin Wankhede / Android Authority

When prompted to login, enter pi for the username. Finally, use the password you set in the previous section.

pi hole adblock step 6
Calvin Wankhede / Android Authority

We can now install Pi-hole. Simply copy the following command and paste it into the SSH client. Then, press enter to execute it.

curl -sSL | bash

pi hole adblock step 7
Calvin Wankhede / Android Authority

Eventually, you’ll be presented with a one-time setup process for Pi-hole. Follow the instructions on-screen — you can use the default settings throughout.

At the end, you’ll be greeted with an installation summary screen. Here, make a note of your IPv4 address — we’ll configure our router to use it in the next section.

pi hole adblock step 11
Calvin Wankhede / Android Authority

If you’d like to manage your Pi-hole later, don’t forget to also write down the web interface address and password.

pi hole adblock step 12
Calvin Wankhede / Android Authority

You may now close the SSH session.

Configure your router to use Pi-hole

Mi Router 4A gigabit edition top down
Dhruv Bhutani / Android Authority

At this point, you should have a successful Pi-hole installation from the previous sections. In this final section, we’ll configure our router to send all future DNS queries to the Pi-hole. This can be a bit tricky, since the exact steps vary depending on your router’s brand and model. However, most major brands have support pages detailing how to configure DNS settings, like this one for TP-Link or this page from NETGEAR.

pi adblock step 13
Calvin Wankhede / Android Authority

As you can see in the screenshot above, simply change your router’s DNS server entries to our Pi’s IP address from earlier. This will ensure that all queries are sent to our Pi-hole, which will filter advertising-related domains for us.

While we’re at it, you should also set a static IP for your Raspberry Pi. This will ensure that the router doesn’t assign your Pi’s current IP address to a different device. If that happens, your DNS queries will fail to resolve and it will seem as if you have no internet connection. Once again, consult your router manufacturer’s support pages for step-by-step instructions, like this page from NETGEAR.

If you cannot access your router’s administrative panel for some reason, you can also change DNS settings on each device manually. Once again, this can vary depending on your device’s operating system and version. On Windows 11, you’ll find it under Settings > Network & Internet > Wi-Fi > Manage known networks > Your home network. Change both DNS entries to your Pi’s IP address, as shown in the screenshot below.

pi adblock step 14
Calvin Wankhede / Android Authority

To change your Android device’s default DNS servers, head into Settings > Network & Internet > Wi-Fi. Then, long-press the network’s name, tap Modify network, and Show advanced options. Finally, change IP settings to Static and enter the IP address from earlier.


Pi-hole references a database of known domains to block advertising-related websites at the DNS level. On the other hand, ad-blocking extensions manually filter out advertising-related code after you load a webpage. Both approaches work well, but extensions might do a better job in certain complex instances, like YouTube ads.

A Pi-hole is a free piece of software that can block ads across your entire Wi-Fi network after a one-time setup.

No, you can install Pi-hole on just about any computer. The Raspberry Pi is one of the least power-consuming options out there.

No, a Pi-hole has nothing to do with a VPN and you don’t need to install any apps. Simply change your DNS settings, either on your router or on individual devices.

You might like