AdGuard Home is a versatile and powerful DNS-level ad blocker that lets you block ads, trackers, and malicious websites across your entire network. Setting it up on a Virtual Private Server (VPS) using Docker ensures high availability, while configuring a TP-Link router ensures seamless DNS integration for all connected devices. Here’s how to do it step-by-step.
Prerequisites
Before diving into the setup, ensure the following:
-
VPS: A running Linux-based VPS (e.g., Ubuntu 20.04 or Debian 11).
-
Docker and Docker Compose: Installed on your VPS.
-
Domain or Static IP: To point your router to the AdGuard DNS.
-
TP-Link Router: Admin access to configure DNS settings.
-
Firewall or Security Group Rules:
Depending on your VPS provider, ensure that the following ports are open in your firewall or security group settings:
- TCP/UDP Port 53: For DNS queries.
- TCP Port 80 and 443: For the web interface and secure connections.
- TCP Port 3000: For accessing the AdGuard Home setup interface.
Use your VPS provider’s dashboard or tools like
ufwto allow these ports:- To allow using
ufw: ufw allow 53/tcp ufw allow 53/udp ufw allow 80/tcp ufw allow 443/tcp ufw allow 3000/tcp
Step 1: Install Docker on Your VPS
-
Run the Official Docker Installation Script:
curl -fsSL https://get.docker.com -o get-docker.sh sh get-docker.sh -
Verify Docker Installation:
docker version docker compose version
Step 2: Deploy AdGuard Home Using Docker
AdGuard Home is an open-source DNS-based ad blocker available on GitHub. We’ll deploy it using Docker.
-
Create a Directory for AdGuard Home:
mkdir -p ~/adguard && cd ~/adguard -
Create a docker-compose.yml File:
Use the following configuration:
version: '3' services: adguard: container_name: adguard image: adguard/adguardhome restart: always network_mode: "host" volumes: - ./data:/opt/adguardhome/work - ./config:/opt/adguardhome/conf ports: - 53:53/tcp - 53:53/udp - 80:80/tcp - 443:443/tcp - 3000:3000/tcp -
Deploy AdGuard Home:
docker-compose up -d -
Access the AdGuard Home Setup Interface:
Open your browser and navigate to
http://<VPS_IP>:3000. Follow the setup wizard to configure AdGuard Home.
Step 3: Configure TP-Link Router
Once AdGuard Home is running, you need to set it as the primary DNS server in your TP-Link router:
-
Log in to Your Router:
Open a browser and go to http://192.168.0.1 or http://192.168.1.1. Enter your admin credentials.
-
Navigate to DNS Settings:
Go to Advanced Settings → Network → WAN or Internet Settings.
-
Set Custom DNS Servers:
- Primary DNS:
<VPS_IP>(your VPS’s IP address) - Secondary DNS:
1.1.1.1(Cloudflare) or any other public DNS for fallback
- Primary DNS:
-
Save Changes:
Apply the settings and reboot the router if necessary.
Step 4: Test the Setup
-
Check DNS Leak:
Visit
dnsleaktest.comto ensure your queries are routed through AdGuard. -
Monitor AdGuard Home Dashboard:
Open the AdGuard Home web interface and verify that queries are being logged.
Step 5: Verify Ad Blocking with Adblock Tester
To confirm that AdGuard Home is effectively blocking ads and trackers, you can use the Adblock Tester tool:
-
Visit Adblock Tester:
Open your browser and go to https://adblock-tester.com.
-
Run the Test:
Click the “Start Test” button on the website. It will analyze your DNS configuration and detect if ads and trackers are being blocked.
-
Review the Results:
- If AdGuard Home is configured correctly, the test should show a high blocking score with most ads and trackers marked as blocked.
- If the test shows a low score, double-check your AdGuard Home configuration and DNS settings on your TP-Link router.
Using Adblock Tester ensures that your setup is functioning as intended and provides an easy way to validate the effectiveness of your ad-blocking system.
Additional Tips
-
Enable HTTPS:
Secure your AdGuard Home with HTTPS by setting up a reverse proxy like Nginx and obtaining a free SSL certificate from Let’s Encrypt.
-
Regular Updates:
Keep your Docker images and system updated to ensure security and stability:
docker-compose pull docker-compose up -d
-
Whitelist Critical Services:
If certain apps or websites are blocked unintentionally, add them to the whitelist in the AdGuard dashboard.
Limitations of AdGuard Home
While AdGuard Home is a powerful DNS-level ad blocker, it has some inherent limitations. DNS-based blocking works by preventing domains associated with ads and trackers from being accessed, but it cannot block all types of advertisements. Here are some examples:
- YouTube and Twitch Ads: These platforms serve ads from the same domains as their content, making them hard to block without interfering with the video streams.
- Sponsored Posts on Social Media: Ads on platforms like Facebook, Twitter, and Instagram often share domains with regular content, rendering DNS-level blocking ineffective.
Future Possibilities
According to the AdGuard Home GitHub page, handling these limitations might require using a content-blocking proxy. This approach, already implemented in standalone AdGuard applications, may be introduced to AdGuard Home in the future. However, even with this feature, there could still be cases requiring advanced configurations or where blocking is not entirely possible.
This limitation is essential to keep in mind while setting up AdGuard Home, as it highlights the trade-offs of DNS-level blocking compared to browser-based or system-wide content blockers.
By hosting AdGuard Home on a VPS, you not only centralize DNS filtering but also enjoy improved performance and reliability. Integrating it with your TP-Link router ensures that all devices on your network benefit from ad-free, secure browsing.