Pi-Hole

Originally Posted 11/12/24

image of the Pi-Hole logo, which looks like a hollow red diamond, with green leaves coming out of the top

What is Pi-Hole?

Pi-Hole is a piece of software, typically run on a Raspberry Pi, that will block ads and trackers from your home network.

What is a Raspberry Pi?

A Raspberry Pi is a small, cheap ($50 being the cheapest one I see at the moment), computer. It can do anything a regular computer can do, although it may be a bit slow given it doesn't have the best specs given the price. It's often used by programmers or enthusiasts who want to run some sort of home server or project that doesn't require a lot of computing power.

Why would I want to use a Pi-Hole?

The main reason is to eliminate most ads on your network. Advertisements on the internet are something I largely don't notice anymore, because I've been using browser based ad blockers basically since I've been using the internet, and I'm primarily on a computer. For me, the biggest thing I like about it is just seeing how many trackers it has blocked, as well as I do notice in some mobile games ads just won't work anymore. As of the time of writing, nearly 30% of all the traffic on my home network is being blocked by Pi-Hole.

My girlfriend notices it a lot in pretty much any app she uses on her phone she has mentioned. If you're a parent, you could block certain sites on your home network entirely (I almost did this to TikTok by accident).

I do want to point out, that the Pi-Hole does have its limitations. For example, it does not block YouTube ads. YouTube (Google) has long been at work trying to make ad blockers unable to block ads, and yeah Pi Hole does not seem to work against YouTube ads (at least, with the setup I have).

How do I set the Pi-Hole Up?

The process is pretty straight forward. I'll be explaining how to get it setup on a Raspberry Pi, as that's the only way I've ever done it. This tutorial will start assuming you've already gotten your Raspberry Pi setup with Raspberry Pi OS, as well as have it plugged into the Internet and setup somewhere. For this to work the best, make sure to use an ethernet cord to connect the Raspberry Pi to your network.

  1. Give your Raspberry Pi a static IP address
    • This will be very different depending on what Router you have and how it's setup. The best thing would be to Google the make and model of your Router with "set static IP address" or something after it. In general though:
    1. Find your routers IP address by opening "Command Prompt" on a Windows computer, or "Terminal" on a MAC computer
    2. In the window that comes up, type "ipconfig" in Command Prompt, or "route get default" in Terminal, and press enter
    3. In Command Prompt, you're looking for "Default Gateway". In Terminal, it should just say "Gateway"
    4. The most common number that will be showing will be 192.168.1.1, however this might be different depending on your network settings.
    5. Open a web browser, and in the address bar, type the default gateway number (in the example above, 192.168.1.1). This should bring you to a login page for your router.
    6. The login credentials for routers depend on the make and model, often with them having a default login you can Google. Sometimes the login info will be on the bottom of the router. Once you find this info, sign into it.
    7. Once in your Router, you'll need to set a Static IP address for your Raspberry Pi. This differs from Router to Router, and the easiest thing would be to Google how to do that for your particular router.
      • For my specific Linksys router, it's under "Connectivity" -> "Local Network" -> "DHCP Reservations"
      • DHCP settings would be generally a good place to check for setting this reservation. You'll need the Raspberry Pi's IP address, which can be found by opening the terminal on the Raspberry pi, and typing the command "ifconfig". There should be a listing next to "inet". Apparently it may also tell you the IP address if you mouse over the internet symbol in the top right of the Rasperry Pi desktop taskbar.
    • The reason we give the Raspberry Pi a static IP address is because IP Addresses by default change every so often. Setting a static IP address tells the router to not change a particular devices IP address. This is important for the Pi Hole, as we'll be directing traffic to it and we want to make sure it can always be found by the same IP address.
  2. Open up the terminal on your Raspberry Pi, and install Pi-Hole
  3. .
    • That link provides a one line installation of:
    • According to their website, their installer should walk you through setting up the Pi-Hole. It's been a while since I've done it myself, but I don't remember this part being too difficult. Feel free to reach out if you have issues.
  4. Once Pi-Hole has been installed, make sure you're able to log into it and setup any settings ahead of time. To do this, just type your Raspberry Pi's IP address into the address bar in a web browser, with /admin after it. So, if it has an IP address of 192.168.1.28, you would type in 192.168.1.28/admin. Some settings I'd suggest looking at are below
    • Adlists - These are lists of known ad urls that the Pi Hole will block. I largely use any of the green links found on this website. You just copy and paste the links to each list in the "Address" field under "Adlists" on the Pihole, and click "add". Sometimes these lists change over time if people maintain them, so from time to time you should go to Tools -> Update Gravity. This will recheck the lists in your adlist and update your Pi Hole if there have been changes.
    • Upstream DNS Servers - Located under "Settings" and then "DNS". DNS stands for "Domain Name System" and it's how your computer changes a fully qualified domain name (FQDN) like facebook.com into an IP address that the computer can connect to. The whole way Pi Hole works is basically acting as your local networks DNS server, and when it sees something is asking to connect to a FQDN or IP Addres it knows is an ad, it returns the request saying "Sorry, that doesn't exist" (this is my understanding of it). However, your Pi Hole doesn't know everything, and this is where upstream DNS servers come in. When the Pi-Hole is not familiar with something, it'll send the DNS requests to whichever upstream servers you choose. They're all pretty good options, and you can google around the differences between them. I personally use OpenDNS, Quad9, and Cloudflare (and check off all the boxes for the IPv4 and IPv6 for all of them). I also have a custom DNS that points to my VPNs DNS server, that autoblocks certain things. You can see the full list on Mulvad's site here under "IP-addresses and Ports". I personally use the extended.dns.mullvad.net option. I'll also note here I'm not entirely sure if it's recommended you run so many different upstream DNS providers, so you may also want to just play around with the options and see if everything works.
    • DHCP - Located under "Settings" and then "DHCP". DHCP stands for "Dynamic Host Configuration Protocol". The DHCP server is what assigns every device on your network an IP address, as well as changes them every now and then. The settings here are completely optional, and not necessary to run Pi-Hole normally. I personally use the Pi-Hole as my DHCP server because I like to see which devices in particular are using the most amount of network traffic, and that is only possible when Pi-Hole is the DHCP server. If you choose to enable it, you must also disable the DHCP server on your Router (this, again, changes based on router). If you end up using the Pi-Hole as your DHCP server, make sure to reserve a "Static DHCP Lease" for the Raspberry Pi.
  5. With Pi-Hole setup, change your routers DNS to point at your Raspbery Pi
    • This again changes based on Router, but you're looking for a place to input DNS settings on your router. If you've turned off your DHCP server on your Router, this option may not be there (part of how DHCP works is by telling devices where the DNS server is).
  6. That's it! You should see your Raspberry Pi start to detect traffic. If your internet stops working, something has gone wrong!

Wrap Up

After writing that all out, I realize it may seem like a lot. It's one of those things though that's a "set it and forget it" type situation. You should try to update your Pi-Hole very so often, but really once it's going it'll just go. Let me know though if you end up having any issues, or if I missed something here!