Pi-Hole - A Self Hosted DNS Ad Blocking Solution

Ads, ads everywhere ads! If you are sick and tired of seeing ads while browsing the internet on your devices from home, look no further than Pi-Hole to make them all disappear! 🥧

Pi-Hole - A Self Hosted DNS Ad Blocking Solution

We live in a digital age where ads are in our face everywhere we look. Now you can make them all disappear with the self hosted Pi-Hole ad blocker. Well, most of them.

Click for the Pi-Hole Index

What is Pi-Hole?

Pi-Hole is a Linux network-level advertisement and Internet tracker blocking application which acts as a DNS sinkhole (hence the name Pi-Hole) and optionally a local DNS server, intended for use on a private network.

Pi-Hole is an amazing tool I use to block ads on my network. It has a sleek design and dashboard that shows you all the stats about the ads being blocked based on the websites you visit everyday.

Install Pi-Hole using Docker Compose

I use the official Pi-Hole Docker image with Docker Compose as seen below.

version: "3"

# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/
services:
  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    # For DHCP it is recommended to remove these ports and instead add: network_mode: "host"
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "67:67/udp" # Only required if you are using Pi-hole as your DHCP server
      - "80:80/tcp"
    environment:
      TZ: 'America/Chicago'
      WEBPASSWORD: 'W@rrior1982'
    # Volumes store your data between container upgrades
    volumes:
      - '/docker/pihole/etc-pihole:/etc/pihole'
      - '/docker/pihole/etc-dnsmasq.d:/etc/dnsmasq.d'    
    #   https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
    cap_add:
      - NET_ADMIN # Recommended but not required (DHCP needs NET_ADMIN)      
    restart: unless-stopped

I did change the time zone and volume mount locations as you should to meet your needs. Visit this page for more detailed instructions on installing Pi-Hole with Docker. Once installed, visit your Pi-Hole machine ip /admin page and log in.

What's awesome about Pi-Hole, is it's open source with a massive community of contributors. This means there are some great contributions such as adlists.

Pi-Hole Adlists (Block Lists)

Pi-Hole adlists are the brains of the operation. These lists consist of domains, IP addresses and other websites you want to block from accessing your network both in and outbound. You can choose to block adult websites as an example and a lot more. But we are here for the ad blocking so let's focus on that today.

By default, Pi-Hole comes with a great adslist already implemented, so you could just use that list and see if it suits your needs. If not, there are plenty at your disposal to test and see if they meet your requirements. Just be careful, some lists may block things such as JavaScript on social media sites like Facebook causing issues with your loved ones. 😆

There are so many adslists you can use that are created by contributors. I've tried many but settled on the oisd list that was recommended to me by a good friend. I did have to tweak it a little bit beause I found it was blocking images in emails.

Choose where to use Pi-Hole

Pi-Hole can be used on a per device basis or at the router level. You can add the IP of the Pi-Hole server to the DNS server settings of any device.

Devices show up as "Clients" in the Pi-Hole dashboard. Here you can see how many requests are being blocked by the domains on your adslist based on the device you are using the Pi-Hole DNS server on.

If you want to track all of your devices, you have to add the Pi-Hole IP to every device rather than only your router.

It's best to host Pi-Hole in an environment where it can be online 24/7. If your Pi-Hole host machine goes down, your connection will also go down unless you are using a backup or alternate DNS server. Make sure the Pi-Hole host is issued a static IP that will not change on the network. This will also cause connection issues if the Pi-Hole host IP changes.

👋
Like what you see? Consider subscribing to the Noted newsletter! You can always unsubscribe at any time. We also have Discord!

Final Notes and Thoughts

One of the biggest roadblocks is getting ads blocked on YouTube. There are some lists that claim they do just that, but I have yet to see it work for me.

There is so much more to Pi-Hole and I plan to cover some of those features in future articles. Next, I will go over using Pi-Hole as a local DNS server!

We sponsor Pi-Hole! You can too if you'd like. Head over to the Pi-Hole Github repo and check them out!