Self updating ad blocking with AdGuard Home

Fully automated network-wide DNS ad blocking for free.

AdGuard Home dashboard screenshot

We all use ad blockers in our browsers, but what about the other devices on our network, such as smartphones and televisions?

That is where a Pi-hole or AdGuard Home comes in, as a replacement for the network’s DNS. When an app, website, or device requests an advertisement, the DNS examines the request against a known list of advertisers and trackers and, if it matches, pretends the ad or tracker does not exist. It is not waterproof but performs admirably.

I don’t want to babysit a DNS on my network, so I run a Raspberry Pi with Ubuntu Core and AdGuard Home as a snap. Ubuntu Core is designed for embedded IoT devices and depends on snap packages, but it’s the automatic updates that are valuable to us. Because snaps update automatically, as the core OS does, and AdGuard automatically updates its block lists, we have a hands-off network-wide ad and tracking blocker!

Ubuntu Core

First, you will need an SD card with Ubuntu Core installed. The Raspberry Pi Imager makes this a piece of cake. Select “Other general-purpose OS” → “Ubuntu” → “Ubuntu Core” in the Raspberry Pi Imager. Specify the SD card as the storage device and write the image to it.

While the image is being written on the card, create an Ubuntu One account with an SSH key; you will need it when the Raspberry boots.

Insert the written SD card into the Raspberry Pi and follow the on-screen instructions.. Although you can connect the Pi to your Wi-Fi network, an Ethernet cable will provide a faster and more reliable connection. Not a luxury, since it will take charge of all DNS requests.

AdGuard Home

After configuring Ubuntu Core, SSH into the Raspberry and install the AdGuard Home snap. During installation, AdGuard will take issue with the Ubuntu DNSStubListener, so deactivate it while in command line mode.

sudo snap install adguard-home
sudo mkdir -p /etc/systemd/resolved.conf.d
sudo vi /etc/systemd/resolved.conf.d/adguardhome.conf

If the adguardhome.conf file and directories do not already exist, create them.

↑ Add this to the adguardhome.conf resolved configuration

Restart systemd-resolved, the service that provides network name resolution.

sudo systemctl reload-or-restart systemd-resolved

On your computer’s browser, navigate to “http://ip_of_your_pi:3000” and complete the AdGuard configuration steps.


Your router will have a DNS IP setting. On UniFi networks, go to “Settings” → “Networks” → edit the selected network → “DHCP” → “DHCP Service Management” → “DHCP DNS Server”. Replace that address with the IP address of the Raspberry. You can usually find the IP address in your router’s settings and on the Raspberry’s screen. The Raspberry is now responsible to translate domain names in IP addresses. When the browser asks for an ad or tacker it simply responds with “does not exist”. Simple but effective.

Once configured, browse around as usual and watch the AdGuard dashboard come to life.

Adding ad blocking capabilities to your browser makes it even better; the more layers of protection, the better, like an onion.

mDNS (optional)

You still need to use the Raspberry’s IP address to access the AdGuard dashboard. Not too bad, but we can do better: mDNS (also known as zeroconf, Bonjour or Avahi). Simply add the avahi snap to the Raspberry Pi and set the hostname to something that makes sense.

sudo hostnamectl set-hostname 'adguard'
sudo snap install avahi

You can now access the AdGuard web dashboard via http://adguard.local/ from your LAN.