This guide explains how to set up AdGuard Home as a local DNS server to handle internal DNS resolution while using Cloudflare DNS as the upstream provider.
- Docker and Docker Compose installed
- Root or admin access to your machine
- Access to your router's configuration (optional)
- Create a new directory for your AdGuard Home setup:
mkdir adguard-home
cd adguard-home
- Create the following files in your directory:
docker-compose.yml
:
version: '3'
services:
adguardhome:
image: adguard/adguardhome
container_name: adguardhome
ports:
- "53:53/tcp"
- "53:53/udp"
- "3000:3000/tcp"
volumes:
- ./config:/opt/adguardhome/conf
- ./work:/opt/adguardhome/work
config/AdGuardHome.yaml
:
dns:
bind_hosts:
- 0.0.0.0
port: 53
rewrites:
- domain: homepage.vanillax.xyz
answer: 192.168.10.21
- domain: argocd.vanillax.xyz
answer: 192.168.10.21
- domain: intgw.vanillax.xyz
answer: 192.168.10.21
- domain: nginx.vanillax.xyz
answer: 192.168.10.21
- domain: test.vanillax.xyz
answer: 192.168.10.21
- domain: extgw.vanillax.xyz
answer: 192.168.10.22
upstream_dns:
- https://1.1.1.1/dns-query
- https://1.0.0.1/dns-query
- Start AdGuard Home:
docker-compose up -d
- Log into your router's admin interface
- Find the DNS settings (usually under DHCP or Network settings)
- Set the primary DNS server to the IP address of the machine running AdGuard Home
- Save settings and restart the router if required
- Open Network & Internet settings
- Click on "Change adapter options"
- Right-click your network connection → Properties
- Select "Internet Protocol Version 4 (TCP/IPv4)" → Properties
- Select "Use the following DNS server addresses"
- Enter the IP address of your AdGuard Home server
- Click OK to save
- Open System Preferences → Network
- Select your active network connection
- Click "Advanced" → DNS
- Add (+) the IP address of your AdGuard Home server
- Click OK and Apply
Edit /etc/resolv.conf
or use NetworkManager to set your DNS server to the IP address of your AdGuard Home server.
To verify your setup is working:
- Open a terminal/command prompt
- Try pinging an internal domain:
ping homepage.vanillax.xyz
It should resolve to 192.168.10.21
-
Port 53 already in use:
- Check if another DNS service is running:
sudo lsof -i :53
- Disable system resolved on Linux:
sudo systemctl disable systemd-resolved
- Check if another DNS service is running:
-
Can't access web interface:
- Ensure port 3000 is accessible
- Check if AdGuard Home container is running:
docker ps
-
DNS not resolving:
- Verify container is running:
docker-compose ps
- Check container logs:
docker-compose logs
- Ensure firewall allows port 53 TCP/UDP
- Verify container is running:
If you encounter issues:
- Check container logs:
docker-compose logs adguardhome
- Visit AdGuard Home's web interface:
http://[your-server-ip]:3000
- Verify DNS settings on your device/router
- The web interface (port 3000) should not be exposed to the internet
- Consider setting up authentication in AdGuard Home's web interface
- Keep Docker and AdGuard Home updated regularly