AdGuardHome(AGH) is a DNS server that also serves as a network wide ad blocker. This is usually the first application that I install because it not only blocks ads on entire network but also gives me the insight into the network traffic as you can see in above screenshot. I will be hosting this on my Raspberry Pi server

How it works?

The ads are primarily served by an ad network. These ad networks have specific domain. AGH maintains block lists of domains of these ad networks1. And when it encounters a request for one of these domain it returns a 0.0.0.0 response indicating the website was not found. The browser ends up rendering the page without the ad.

Above figure shows how it can similarly block malicious websites as well. This is the gist of it but if you want to learn more head over to AdGuard knowledge base here

Installation

I am only covering the installation steps briefly here which should be enough but head over to getting started guide if you encounter issues.

  1. Get binary from releases. For Raspberry Pi4 we can download AdGuardHome_linux_arm64.tar.gz
  2. Run the binary and follow the installation steps in the browser
  3. Provide static IP to your Pi from router configuration
  4. Point DNS server in your router config to newly configured AGH server
  5. Install systemd service using AdGuardHome -install to run AGH as service

You are done. Try refreshing the dashboard after browsing couple of websites and you should see the stas.

Final Words

There is an alternative to AGH called PiHole which serves similar purpose but it’s setup is exhaustive and needs Apache, MySQL, PHP to work. Needless to say I will not suggest PiHole. AGH is compact and written in Go. It has a single binary that is very easy to deploy. Here are some other things that you can use AGH for

  1. Create local domain for your home network
  2. Block certain services from their Filters -> Blocked services page
  3. Parental control, safe search and block malicious websites
  4. Apply custom filtering rules
  5. View query logs to analyse any suspcious app activity

Head over to AdGuardHome Github if you want to learn more.


Notes

  1. AGH cannot block YouTube ads because those are directly served from main YouTube domain nowadays. Blocking those would mean blocking access to YouTube. This was not true few years ago.