Home DNSHow to Configure Cloudflare DNS over TLS on Debian 13 Linux

How to Configure Cloudflare DNS over TLS on Debian 13 Linux

By sk
3 views 8 mins read

DNS over TLS (DoT) encrypts DNS queries between your system and a DNS resolver. This helps prevent your ISP and other third parties from easily reading or modifying your DNS requests.

In this guide, we will configure Cloudflare DNS over TLS on Debian 13 using systemd-resolved and NetworkManager.

Privacy note: Cloudflare DNS over TLS encrypts DNS queries between your device and Cloudflare. However, it does not completely hide your internet activity from your ISP. Your ISP may still see the IP addresses you connect to, connection timing, and data usage. For stronger privacy, consider using a reputable VPN or Tor Browser. DNS over TLS improves DNS privacy, but it does not make you anonymous online.

1. Check Your Current DNS Configuration

Before making changes, check whether systemd-resolved is running on your Linux system using command:

systemctl is-active systemd-resolved

If it returns active, continue.

Next, check your current DNS configuration:

resolvectl status

Look for the DNS servers, DNS domains, and DNS-over-TLS status.

For example, you might see:

Protocols: ... -DNSOverTLS ...

The -DNSOverTLS entry indicates that DNS-over-TLS is not enabled for that link.

Also, check your NetworkManager connection profiles:

nmcli -f NAME,TYPE,DEVICE connection show

This command lists your saved network profiles, their connection types, and the devices associated with them.

2. Back Up the systemd-resolved Configuration

This is important. Before editing the systemd-resolved configuration file, create a backup:

sudo cp /etc/systemd/resolved.conf /etc/systemd/resolved.conf.backup

Now open the systemd-resolved configuration file in your preferred editor. Here I use nano editor:

sudo nano /etc/systemd/resolved.conf

3. Configure Cloudflare DNS over TLS

Find the [Resolve] section and configure it as follows:

[Resolve]
DNS=1.1.1.1 1.0.0.1 2606:4700:4700::1111 2606:4700:4700::1001
FallbackDNS=
Domains=~.
DNSOverTLS=yes
DNSSEC=no

Here is what each setting does:

  • DNS= specifies Cloudflare's IPv4 and IPv6 DNS resolver addresses.
  • FallbackDNS= clears the fallback DNS servers configured through this option.
  • Domains=~. routes all DNS domains to the configured global DNS servers.
  • DNSOverTLS=yes requires DNS-over-TLS for DNS queries sent to these servers.
  • DNSSEC=no disables DNSSEC validation in systemd-resolved.

Press CTRL+O followed by CTRL+X to save the file and exit the nano editor.

For those unaware, Cloudflare's public DNS addresses are:

ProtocolPrimary DNSSecondary DNS
IPv41.1.1.11.0.0.1
IPv62606:4700:4700::11112606:4700:4700::1001

4. Configure NetworkManager DNS Settings

Next, configure your NetworkManager connection profiles to use Cloudflare DNS instead of automatically supplied DNS servers.

Important: A Wi-Fi SSID and a NetworkManager connection profile name are not necessarily the same. The commands below use example profile names. Replace them with the exact names shown on your system.

To list your saved network profiles, run:

nmcli -f NAME,TYPE,DEVICE connection show

You can also list nearby Wi-Fi network names (SSIDs) with:

nmcli device wifi list

Use the NetworkManager profile name, not the Wi-Fi SSID or network interface name, in the following commands.

Configure the Wi-Fi connection

For demonstration purpose, we will use the following two Wi-Fi profile names:

  • Home_WiFi_4G
  • Home_WiFi_5G

Configure the first Wi-Fi profile:

sudo nmcli connection modify "Home_WiFi_4G" \
ipv4.ignore-auto-dns yes \
ipv4.dns "1.1.1.1 1.0.0.1" \
ipv6.ignore-auto-dns yes \
ipv6.dns "2606:4700:4700::1111 2606:4700:4700::1001"

Configure the second Wi-Fi profile:

sudo nmcli connection modify "Home_WiFi_5G" \
ipv4.ignore-auto-dns yes \
ipv4.dns "1.1.1.1 1.0.0.1" \
ipv6.ignore-auto-dns yes \
ipv6.dns "2606:4700:4700::1111 2606:4700:4700::1001"

Replace Home_WiFi_4G and Home_WiFi_4G with your own profile name.

These commands prevent NetworkManager from accepting automatically supplied DNS servers for those profiles and set Cloudflare's IPv4 and IPv6 resolvers instead.

Configure the Ethernet connection (optional)

If you also use a wired Ethernet connection, configure its NetworkManager profile.

For example, if your Ethernet profile is named Home_Wired, run:

sudo nmcli connection modify "Home_Wired" \
ipv4.ignore-auto-dns yes \
ipv4.dns "1.1.1.1 1.0.0.1" \
ipv6.ignore-auto-dns yes \
ipv6.dns "2606:4700:4700::1111 2606:4700:4700::1001"

Replace Home_Wired with your actual Ethernet connection profile name.

Note: Home_WiFi_4G, Home_WiFi_5G, and Home_Wired are examples. You only need to configure the profiles you actually use.

5. Restart systemd-resolved and Reconnect

Restart the DNS resolver service:

sudo systemctl restart systemd-resolved

Now reconnect your active network profile so NetworkManager applies the updated DNS settings.

For example, if you are connected through Home_WiFi_4G, run:

sudo nmcli connection down "Home_WiFi_4G"
sudo nmcli connection up "Home_WiFi_4G"

Use the appropriate profile name for your connection.

If you configure another saved profile, you do not need to disconnect your current network just to save its settings. The new settings will apply when you connect using that profile.

6. Verify Cloudflare DNS over TLS

Now check whether Cloudflare DNS and DNS-over-TLS are active:

resolvectl status

You should see output similar to:

Global
Protocols: +LLMNR -mDNS +DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: stub
Current DNS Server: 1.1.1.1
DNS Servers: 1.1.1.1 1.0.0.1 2606:4700:4700::1111 2606:4700:4700::1001
DNS Domain: ~.

Link 3 (wlo1)
Current Scopes: DNS LLMNR/IPv4 LLMNR/IPv6
Protocols: +DefaultRoute +LLMNR -mDNS +DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 1.1.1.1
DNS Servers: 1.1.1.1 1.0.0.1 2606:4700:4700::1111 2606:4700:4700::1001
Default Route: yes

Your interface name and output may differ.

Look for these important entries:

  • +DNSOverTLS indicates DNS-over-TLS is enabled for the resolver or link. The plus (+) sign indicates enabled and the minus (-) sign indicates disabled.
  • 1.1.1.1 and 1.0.0.1 are Cloudflare's IPv4 DNS servers.
  • The two 2606:4700:... addresses are Cloudflare's IPv6 DNS servers.
  • ~. indicates that all DNS domains are routed through the configured global DNS servers.

You can also verify the DNS settings saved in a NetworkManager profile:

nmcli -f connection.id,ipv4.ignore-auto-dns,ipv4.dns,ipv6.ignore-auto-dns,ipv6.dns connection show "Home_WiFi_4G"

Replace the profile name as needed.

Finally, test DNS resolution:

resolvectl query google.com

If the command returns an address, DNS resolution is working.

Sample output from my Debian 13 desktop:

google.com: 2404:6800:4007:835::200e           -- link: wlo1
142.251.222.206 -- link: wlo1

-- Information acquired via protocol DNS in 127.2ms.
-- Data is authenticated: no; Data was acquired via local or encrypted transport: yes
-- Data from: network

You can also test IPv4 and IPv6 connectivity:

curl -4 https://www.google.com
curl -6 https://www.google.com

The IPv6 test will work only if your internet connection supports IPv6.

7. Test for DNS Leaks

After configuring DNS-over-TLS, you can use an online DNS leak test to check which DNS resolvers your browser appears to be using.

For example, you can visit any one of the following web services to verify if DNS-over-TLS is working properly:

Run the test and check the displayed DNS resolver information.

Before configuration, the results may show DNS servers operated by your ISP. After DNS-over-TLS configuration, you should generally see Cloudflare-associated DNS resolvers.

Test for DNS Leaks using Browserleaks DNS Web Service
Test for DNS Leaks using Browserleaks DNS Web Service

The exact IP addresses shown by these websites may vary. Do not confuse the resolver IP addresses displayed in a leak test with the Cloudflare DNS addresses you configure on your system.

Important: A DNS leak test provides useful evidence about the DNS resolvers handling your browser's queries, but it does not prove that every application uses encrypted DNS. Browsers with their own DNS-over-HTTPS settings, for example, may bypass the system resolver.

8. Does DNS over TLS Hide All Internet Activity?

No. Cloudflare DNS over TLS improves DNS privacy, but it does not completely hide your internet activity from your ISP.

Your ISP may still see information such as:

  • Destination IP addresses: The IP addresses your device connects to.
  • Connection timing: When you connect to websites and online services.
  • Data usage: How much data you send and receive.
  • Some website names: Certain connection metadata, such as unencrypted TLS Server Name Indication (SNI), may reveal the hostname.

HTTPS encrypts the contents of your web traffic, including passwords and messages, but it does not necessarily hide the websites you visit.

For stronger privacy, you can consider these options:

  • VPN: Routes your internet traffic through a VPN provider. Your ISP generally sees the VPN connection instead of your individual destination connections. However, you are placing trust in the VPN provider.
  • Tor Browser: Routes browser traffic through multiple relays, making it harder for your ISP to determine which websites you visit. It can be slower and has some limitations.

Remember that each option has different privacy trade-offs.

The key takeaway: DNS over TLS encrypts DNS queries between your system and Cloudflare. It improves DNS privacy, but it does not make you anonymous online.

9. How to Restore the Original DNS Configuration

If you want to undo these changes, you can restore your original systemd-resolved configuration.

First, restore the backup:

sudo cp /etc/systemd/resolved.conf.backup /etc/systemd/resolved.conf

Next, restore automatic DNS settings for the NetworkManager profiles.

For example, if your profiles originally used DHCP-provided DNS servers, run:

sudo nmcli connection modify "Home_WiFi_4G" \
ipv4.ignore-auto-dns no \
ipv4.dns "" \
ipv6.ignore-auto-dns no \
ipv6.dns ""

Repeat for your other profiles:

sudo nmcli connection modify "Home_WiFi_5G" \
ipv4.ignore-auto-dns no \
ipv4.dns "" \
ipv6.ignore-auto-dns no \
ipv6.dns ""
sudo nmcli connection modify "Home_Wired" \
ipv4.ignore-auto-dns no \
ipv4.dns "" \
ipv6.ignore-auto-dns no \
ipv6.dns ""

Note: These commands restore automatic DNS configuration. If you had manually configured custom DNS servers before following this guide, restore those original DNS addresses instead.

Finally, restart the resolver:

sudo systemctl restart systemd-resolved

Reconnect your active network profile and verify the DNS settings:

resolvectl status

Your original DNS configuration should now be restored.

Conclusion

Configuring Cloudflare DNS over TLS on Debian 13 is a straightforward way to improve DNS privacy. By combining systemd-resolved with NetworkManager, you can configure Cloudflare's encrypted DNS resolvers for your Wi-Fi and Ethernet connections.

Remember that DNS-over-TLS protects DNS queries, not all internet traffic. It is a useful privacy improvement, but it should not be mistaken for complete online anonymity.

Recommended Read:

You May Also Like

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More