How to Set Up a Pi Hole to Block Ads and Speed Up Your Internet

With a little time and energy, anyone can build a little computer that kills advertisements and makes browsing more manageable.
Image: Matthew Gault

The internet is a much different place when it’s not full of advertisements. This past week, I zipped around from site to site, watching the images and text load without banners and obnoxious pop-ups. Algorithmically generated ads in podcasts failed to load, the banner ads on my television died, and the smartphones connected to my Wi-Fi went blissfully untracked by advertisers. I accomplished this with a Pi-Hole, a little computer attached to my network that blocks advertisements at the network level. It’s like a firewall just for advertisements, it makes the internet better and easier to use, and it’s cheap and easy to build.


How to Build a Pi-Hole

Chances are, you already use some kind of ad-blocker and it’s probably browser and device based. Every phone has its own app, every browser its own plug-in, and they increasingly don’t work. We’ve all had to turn off our ad-blocking software to access a site we wanted. Pi-Hole lets you block everything at the network level and it works for every single device on that network. When it comes to ad-blockers, Pi-Hole is the nuclear option.

To get started, you’ll need a Raspberry Pi. Raspberry Pi’s are tiny computers that can be used for a variety of DIY projects. Raspberry Pi’s can become 12-Megapixel cameras, a miniature cell phone tower, or a machine that kills advertisements. The base model Raspberry Pi 4 costs just $35 but it doesn’t quite come with everything you need.


Image: Matthew Gault

Blocking ads is hard work that will heat up the tiny computer, so you’ll need heat sinks and a fan. A box to contain the machine isn’t required, but it’s nice. You’ll need a micro HDMI to HDMI cable to connect a monitor, a power cable to keep the PI running, an SD card to load an operating system onto the computer, and a mouse and keyboard for some setup.

Some of this you may have laying around the house and some of it may sound intimidating to construct. I promise it’s easy and if you’re not sure what to buy, Raspberry Pi’s website links to several stores that sell kits to make it easier. I used this starter kit and a mouse and keyboard I already had in the house. Some stores let you buy things like the case, HDMI cable, and heat sinks a la carte.


With the Raspberry Pi and the assorted pieces in front of you, the first thing you’ll want to do is attach the heat sinks. These should be little pieces of metal with adhesive on the back. They’re different sizes and easily matched to the chips on the board they rest on. The largest two are the most important and go on the processor and RAM which sit in the middle of the Raspberry Pi’s board. Press them on firmly but without too much pressure, you don’t want to break the board.

If you have a case and a fan, slide install the Pi into them after you’ve placed the heat sinks. Either way, it’s to hook up the Pi to a monitor and keyboard and install the software. There’s several different operating systems for the Raspberry Pi and most of them work with Pi-Hole. The easiest to install is the Raspbian system. Some of the kits available online come with an SD card preloaded with the operating system. If you need to make your own SD card, follow these simple instructions for installing Raspberian on Pi’s website.

Push the SD card into the Pi’s slot, hook it up to a monitor, attach a mouse and keyboard, and plug the machine into a power outlet. When the Pi boots up for the first time, it will read the SD card and walk you through the installation of the Raspberry Pi. When that’s done, you’ll be dumped onto a desktop similar to a Windows or Mac OS. During setup, the install wizard should get the Pi on to your Wi-Fi. Pi-Hole will work over your wireless network, but it runs a little faster when it’s plugged directly into the router. If you have the space and the ethernet cable, plug the machine directly into your router.


Installing Pi-Hole Software

Installing the Pi-Hole software itself will be the trickiest part of the process.

  • Make sure the Pi is connected to the internet.
  • In the upper left hand corner of your screen, on the toolbar, you’ll see a black window with “>_” on it. Click it.
  • Type “curl -sSL | bash.” This will start the installation.

The Pi-Hole installer will walk you through a setup similar to when you installed the operating system. As much as possible, pick the default options here. If something goes wrong later, it’s easy to troubleshoot Pi-Hole or reinstall the system completely from scratch.

Early in the installation, it will ask you to pick an Upstream DNS Provider. Pi-Hole works by maintaining a list of IP addresses and domains that serve up advertisements and malicious content. When it checks its list and finds a machine on your internet trying to access something on its list, it diverts the traffic to an Upstream DNS Provider of your choosing. There are minor differences between the choices, but anyone should work fine. I used CloudFlare.

After selecting a DNS provider, the Pi-Hole will spit out an IP address and ask if you’d like to use your current network settings as its static address. Write these numbers down as you may need them later, but click yes. Installation will continue, occasionally prompting you to click yes. When in doubt, go with whatever the default setting is.


Image: Matthew Gault

Once the installation is complete, Pi-Hole will give you an IPv4, IPv6, website address, and a password. The website and password are what you’ll use to login to your Pi-Hole through a web browser and mage it. The IPv4 and IPv6 are numbers you may need to use to configure your router.

Once installation is finished, you can unplug the monitor, keyboard, and mouse from the Pi-Hole. The machine will run as long as it’s still plugged into a power source. Restart a machine on your network, pull up an ad-heavy website, and see if anything has changed. If you’re still not sure, pull up this page and see if it’s laced with ads.

If it’s still not working, you need to change the IP address of your router so it uses the Pi-Hole as a DNS server. This is easy to do if you know the IP address of your router, but varies from machine to machine. The easiest thing to do may be to find the name of your router and google it along with “change DNS server settings.” Once inside your router’s settings, change the primary and secondary DNS server to the IP addresses you wrote down earlier. Save the settings, reboot any computer on the network, and the Pi-Hole should be up and running.


Image: Matthew Gault

Once it’s running, going to pi.hole/admin will give you access to its online dashboard. From here, you can see just how much traffic the Pi-Hole is blocking and manage exceptions. If a site isn’t working properly, you can always add it to a whitelist in your settings to let it through. You can even tell the Pi-Hole to allow certain devices to bypass its service.

The results have been dramatic for me. Not only is surfing the internet now largely ad free, it’s also sped up everything I do online. During a day of heavy use, the Pi-Hole blocks around 25 percent of all traffic requests on my network. When I downloaded something, I’d never hit my speed cap. Now I always do. It’s not a huge boost, but it is noticeable.