Building My Own Private DNS with AdGuard Home
“Why rely on someone else’s DNS when you can break your own?” — Me, before setting up AdGuard Home.
🧠 Why Bother with a Private DNS?
In the vast realm of IT, DNS (Domain Name System) is like the unsung hero—translating human-friendly domain names into IP addresses. It’s the phonebook of the internet. But trusting third-party DNS providers? That’s like letting someone else decide who you can and can’t call.
So, I thought, “Why not build my own DNS server?” Enter AdGuard Home—a network-wide software for blocking ads and tracking. It’s like Pi-hole’s cousin but with a slicker interface and some extra features.
🛠️ Setting Up AdGuard Home: My Way or the Highway
1. Creating the LXC Container
Using Proxmox, I spun up a bare-metal LXC container. For the OS, I chose Ubuntu 24.04.2 LTS—because staying updated is the name of the game.
Container Specs:
- RAM: 1GB
- CPU Cores: Unlimited (but at least 1 is recommended)
- Swap Memory: 512MB
- Disk Size: 8GB
After the OS installation, it’s always a good idea to update the system:
1
sudo apt update && sudo apt upgrade -y
2. Installing AdGuard Home
For easier installation you can use Proxmox Helper Script. But, I opted for the manual route—for the thrill and the learning experience.
Steps:
- Navigate to the AdGuard Home GitHub Repository.
- Scroll down to the “Getting Started” section.
- Use the automated installation script:
1
curl -s -S -L https://raw.githubusercontent.com/AdguardTeam/AdGuardHome/master/scripts/install.sh | sh -s -- -v
This script downloads and installs AdGuard Home. Once done, the web interface is accessible at:
1
http://<your-server-ip>:3000
Replace <your-server-ip> with the actual IP address of your LXC container.
🛑 Avoiding Port 53 Conflicts
Ubuntu’s systemd-resolved may already be using port 53, which AdGuard needs. To fix this:
- Open the resolved configuration file:
1
sudo nano /etc/systemd/resolved.conf
- Uncomment and set the following:
1
DNSStubListener=no
- Restart the
systemd-resolvedservice:
1
sudo systemctl restart systemd-resolved
- Verify if anything else is using port 53:
1
sudo lsof -i :53
3. Initial Configuration
Upon accessing the web interface, you’ll be greeted with a setup wizard. It will guide you through:
- Setting up admin credentials.
- Choosing the interfaces AdGuard Home should listen to.
- Configuring DNS settings.
The process is straightforward, and the UI is intuitive.
🧩 Troubleshooting Tips
Issue: AdGuard Home won’t start
Fix: Port 53 might already be in use. Run:
1
sudo lsof -i :53
Then stop any conflicting service like systemd-resolved.
Issue: Can’t access the web interface
Fix: Double-check the container’s IP and ensure port 3000 is open.
Issue: DNS not resolving
Fix: Check if AdGuard Home is running and correctly bound to the expected interfaces under Settings > DNS settings.
🔐 Optional: Enable Encryption with Let’s Encrypt SSL (DNS-over-HTTPS)
If you want to securely serve DNS traffic over HTTPS (DoH) or TLS, you’ll need a valid SSL certificate. Here’s how I used certbot to get a free Let’s Encrypt certificate and integrate it with AdGuard Home.
📋 Prerequisites
- A domain name (e.g.,
dns.yourdomain.com) - A DNS provider with proper DNS records pointing to your server.
- Your LXC container must be reachable from the internet on ports 80/443 during certificate issuance.
🧰 Step-by-Step: Installing certbot and Issuing a Certificate
- Install certbot
1 2
sudo apt update sudo apt install certbot
- Issue a Certificate Replace
dns.yourdomain.comwith your actual domain:1
sudo certbot certonly --standalone -d dns.yourdomain.com
This will automatically handle the certificate issuance process.
Locate the Certificate Certbot stores certificates in
/etc/letsencrypt/live/<your-domain>/. Replace<your-domain>with your actual domain name.- Configure AdGuard Home to Use SSL Create a directory for your AdGuard certs (if not already):
1
sudo mkdir -p /opt/adguardhome/ssl
Copy the certificate and key to the AdGuard directory:
1 2
sudo cp /etc/letsencrypt/live/dns.yourdomain.com/fullchain.pem /opt/adguardhome/ssl/cert.pem sudo cp /etc/letsencrypt/live/dns.yourdomain.com/privkey.pem /opt/adguardhome/ssl/private.key
- Update AdGuard Home Settings
- Open the AdGuard Home web interface.
- Go to Settings → Encryption.
- Enter your domain (e.g.,
dns.yourdomain.com). - Set paths:
- Private Key:
/opt/adguardhome/ssl/private.key - Certificate:
/opt/adguardhome/ssl/cert.pem
- Private Key:
- Save and restart AdGuard Home if needed.
🔁 Automating Renewal
Certbot automatically sets up a cron job for renewal. To manually test it:
1
sudo certbot renew --dry-run
🧷 Bonus: Restrict External Access (Optional)
If you’re only using DoH locally or in your private network, consider firewall rules to restrict access to ports 443/853 from outside.
🐾 Meet Bandittoh: The Debugging Cat
No setup is complete without unexpected hiccups. Thankfully, my cat, Bandittoh, was there to supervise. Every time I made a mistake, he’d let out a disapproving meow. I swear he’s more of a sysadmin than I am.
And that’s it! Your AdGuard DNS installation is now complete. Enjoy your private DNS server, the satisfaction of self-hosting, and maybe even a debugging cat of your own.
