Block ads, trackers with AdGuard and Raspberry Pi

Block ads, trackers with AdGuard and Raspberry Pi
Photo: Roméo, Pexels.

More and more Internet-surfers are familiar with Internet tracking (trackers) and Internet advertising (ads). The well-known personalized, intrusive image-filling, advertising banners that crowd out an entire website. To get rid of them quickly, most user frequently switch to an adblocker or private browser session. This could have an effect on performance. Something you would obviously like to avoid.

Since a browser can become slow with many extra add-ons and extensions. Fixing the issue at the source is the most effective and provides a fine and fast user experience. In other words, stop letting unwanted advertising and trackers into the network. This can be solved easily with a mini computer; the Raspberry Pi with AdGuard installed. The Raspberry Pi + AdGuard acts as a recursive DNS resolver, which filters domains. 

This section has a number of subsections: Raspberry Pi, SSH and the AdGuard website.

Raspberry Pi

The Raspberry Pi is easy to install. Insert the included Micro SD Card into the computer and download: Raspberry Pi Imager to manage Raspberry Pi OS.

  • Install the Raspberry Pi Imager.
  • Choose OS and the operating system Raspberry Pi OS (other) and Raspberry Pi OS Lite (32 bit) respectively.
  • Right below select settings (cogwheel) and Set hostname: To your preferred hostname.  
  • Set Enable SSH with Use password authentication and set Username and Password as desired.
  • We recommend using the Pi over LAN which is enabled by default. The non wireless LAN (WLAN) option. A DNS resolver is just a fraction too slow to respond over WLAN for a pleasant user experience. Tested by us previously. Configure wireless LAN should be non selected nor configured. 
  • Set locale settings to a time zone and keyboard as desired in your region and SAVE.
  • Choose the storage and select the booted Micro SD Card.
  • Write
  • (Re)place the Micro SD Card into the Pi and start it.

SSH

  • Login into the SSH console and update your system: sudo apt update && sudo apt upgrade
  • We can now refresh the system with: reboot and move on to AdGuard.

It is relatively easy to connect AdGuard to the Pi.

AdGuard Installation

  • Relogin into the SSH console.
  • cd && wget 'https://static.adguard.com/adguardhome/release/AdGuardHome_linux_armv6.tar.gz'
    Change the current working directory and download the AdGuard program.
  • tar -f AdGuardHome_linux_armv6.tar.gz -x -v
    Unpack the file and set the rights.
  • cd ./AdGuardHome/
  • sudo ./AdGuardHome -s install
    Change the current working directory and start the AdGuard installer. 

AdGuard is now successfully installed and will automatically start on boot.
The script writes the address at which the program is available on final lines. 
Surf to this address via the internet browser.

AdGuard Browser

There are 5 more steps to follow to configure the AdGuard specific settings.

  • Get Started for the 1e step. 
  • We won't change settings at step 2. it is recommendable to Set the static IP address, requested by AdGuard through the router. All static addresses are then managed by and from one -system. For the overview and manageability.                
  • (3.) Setup a Username and Password as desired. 
  • At step 4. Navigate to the router and replace the DNS server with the previously configured static IP address. Managed by the router.
  • Open the dashboard, sign in and select filters.
  • Configure the DNS Blocklists with blocklists as desired.  

AdGuard preferred blocklists 

There are many AdGuard blocklists available. In various scents and colors. A blocklist is personal. It is just what you wish to block. Popular blocklists are listed below. Test it out one by one, before running it in production. Less is more. A list can block too much. Which could result in your favorite 'legitimate' website being blocked, by mistake. It also applies vice versa (False negatives and False positives).

Many more ad and track blocklists are available. Try per list and expand, if needed in case too little unwanted content is blocked. Keep in mind. It remains a.

Cat-and-mouse game

Content creators will do everything they can to serve their advertisers. Whereby certain ads will not be shown on one day. Then a few days later, they've found something to make it show again. Exactly like the cat-and-mouse game. Make sure blocklists are up to date. Update them with some regularity.

Resuming

You probably know by surfing now. Websites are running a lot smoother, clearer and also faster. Without all the ads, nor trackers. Given that, this also contributes positively to your privacy. Is it a win-win-win situation for you. To take it a step further, monitor the guard system as well for up-time and performance analyses. Uptime Kuma is an easy-to-use self-hosted monitoring tool. A desktop computer can also be optimized. After all, you can optimize the entire chain on all its facets. Optimize your desktop computer to enhance performance as well. And switch to the extended stable release of the Chrome or Edge browser. For stability over new functionality. (both wins and quick wins).

AdGuard to simple. More in-depth features and options? Pi-hole has the same purpose as an ad and track blocker. Is tweakable, with more configurable features and options. There are multiple sub-program components, separately installable with multiple options. Completely set up to your own taste and desire.

Some useful link(s)

Raspberry Pi
AdGuard Ad Blocker