DNS over TLS (DoT) is a security protocol that encrypts DNS queries, providing enhanced privacy and security. This guide will walk you through setting up AdGuard Home to serve DNS over TLS using your custom domain, secured with a Let’s Encrypt certificate. We’ll use Cloudflare for DNS management and integrate Home Assistant for automation. By the end, your Android devices will be able to use secure DNS queries to your AdGuard Home server. We will be focusing on Android devices but iOS devices can use it as well!
Before starting, ensure you have:
To enable DNS over TLS, you’ll need to set up the necessary DNS records in Cloudflare.
A
record with the following details:dns
Your server's public IP address
(this will be updated automatically by the HomeAssistant Cloudflare integration, don’t worry!)Auto
DNS only (unproxied)
.CNAME
record:*.dns
dns.yourdomain.com
Auto
DNS only (unproxied)
.These records ensure that both dns.yourdomain.com
and any subdomains will direct traffic to your AdGuard Home instance.
This is useful to be able to create clientname.dns.yourdomain.com
to identify different clients by different hostnames.
Home Assistant can automate updating your Cloudflare DNS records if your server’s IP address changes.
To interact with Cloudflare API we need two different tokens:
To generate those:
Zone:Zone:Read
and Zone:DNS:Edit
for Token 1Zone:DNS:Edit
for Token 2dns.yourdomain.com
A record whenever your IP changes.Note: it seems that it doesn’t run automatically as soon as it’s setup, so either you enter your current IP address in previous step, or you run the integration to update it for you using the service cloudflare.update_records
.
After that, it will run automatically every hour to update your IP.
Next, secure your domain with a Let’s Encrypt SSL certificate to enable DNS over TLS.
dns.yourdomain.com
and *.dns.yourdomain.com
.dns
.alias: Start Let's Encrypt Add-on at Midnightdescription: Start the Let's Encrypt add-on every day at midnightmode: singletriggers:- at: "00:00:00"trigger: timeactions:- data:addon: core_letsencryptaction: hassio.addon_start
With the SSL certificate ready, you can now configure AdGuard Home to support DNS over TLS.
dns.yourdomain.com
.Your AdGuard Home server is now configured to serve DNS over TLS.
Different Android devices might have slightly different steps to setup DNS over TLS, but generally to use your new DNS over TLS setup on Android devices follow these steps:
dns.yourdomain.com
or clientname.dns.yourdomain.com
(if you want to use client names, go to Settings > Client Settings on AdGuard and add needed clients)Your Android device will now use DNS over TLS with your AdGuard Home server, ensuring encrypted DNS queries. If your device says that your DNS over TLS server doesn’t exist, please check everything is configured above, or wait a bit of time to allow the DNS system to propate your configuration.
By following these steps, you’ve successfully configured AdGuard Home to provide DNS over TLS, secured with a Let’s Encrypt certificate and managed through Cloudflare. Your Android devices are now equipped to handle encrypted DNS queries, enhancing your privacy and security. This setup not only secures your DNS traffic but also allows for easy management and automation using Home Assistant.
Feel free to adjust the steps to fit your environment, and enjoy a more secure internet experience on your Android devices.