moscardino.net

Make Your Internet Better, Make a Pi-Hole

I haven’t posted anything here in a while, so I thought I’d put up a little something about the greatest, most useful piece of technology that I have ever installed in my house: a Pi-Hole.

What is a Pi-Hole?

Pi-Hole describes itself as “a black hole for internet advertisements”. That’s completely correct, and it’s more amazing than you would first think.

Once installed and configured, on whatever OS and hardware you have around, it blocks ads. Everywhere. Websites, apps, smart TVs, you name it. It’s simple to set up and works wonders.

How does it work?

It’s an amazingly simple idea. You configure your router to use the Pi-Hole its DNS server. The Pi-Hole then intercepts every DNS request that comes across on your network. If the request is for an ad, then it blocks it. Otherwise, it let’s it through so it can resolve at another server.

What this means is that it can catch most ads, and from sources that are normally immune to blockers (notably: in apps).

What do I need?

Really, any computer that can run Linux. There’s also a Docker container available.

What I use, and what is most common, is to run it on a Raspberry Pi. I have many Pi’s laying around, and I’ve run Pi-Hole on two of them. I first ran it on a Pi 3 Model B, but then switched to an original Model B so I could use the newer one as a RetroPie. Pi-Hole doesn’t require a lot of processing power, so the original Pi is plenty.

How do I set it up?

Run this on whatever device you’re going to use:

curl -sSL https://install.pi-hole.net | bash

Obviously, you should know what you’re doing before piping anything to bash, so you should probably read that install script first or use an alternative install method.

Once it’s set up, you need to configure your router to use the Pi-Hole as it’s DNS server. This part is different for each router. It does help to set the Pi-Hole to a static IP address so that you don’t lose DNS if your router restarts and happens to assign it a new address.

You can also set the Pi-Hole to act as a DHCP server, but I don’t. Mostly because I haven’t tried it, yet.

Tips

  • Hard-wire the Raspberry Pi to your router. A Pi-Hole can work over WiFi, but it’s faster to use ethernet.
  • Learn your way around the web interface. Sometimes Pi-Hole can block things that you actually need. I had a lot of issues signing in to various services when setting up a Roku and some tinkering with the web UI allowed me to whitelist the correct domains. It’s also nice to be able to disable the Pi-Hole for a short time if you can’t determine if it’s interfering with anything.
  • Note that not all ads will be blocked. Browser ad-blockers (I like uBlock Origin) are still useful. The most noticeable ads that will survive are ones for YouTube and Hulu, where the ads are served from the same domain as the content.
  • Enjoy.