SecDNS

Set up SecDNS on Linux with systemd-resolved DoT or dnscrypt-proxy

Configure encrypted SecDNS on a Linux desktop or server using systemd-resolved for DoT, or dnscrypt-proxy for DoH, with a per-device profile.

Set up SecDNS on Linux

Most modern Linux distributions ship with systemd-resolved, which supports DNS-over-TLS (DoT) natively. If you prefer DoH, install dnscrypt-proxy and forward queries to the SecDNS DoH endpoint. The whole setup takes 10 to 15 minutes including verification.

What you will need

  • A SecDNS account
  • A Linux machine with sudo access
  • systemd-resolved 247 or newer (DoT) or dnscrypt-proxy 2.1+ (DoH)
  • Your per-device DoH URL https://dns.secdns.io/dns-query/<device-id>

Setup steps

  1. Create a device in SecDNS. Sign in, open Devices and add a new Linux device. Copy both the per-device hostname and the DoH URL. [screenshot placeholder]
  2. Choose your stack. Use systemd-resolved if your distribution ships it; otherwise install dnscrypt-proxy with your package manager.
  3. Edit the resolved configuration. Open /etc/systemd/resolved.conf with sudo. Under [Resolve] set DNS=<secdns-anycast-ip> and DNSOverTLS=yes. Set DNSSEC=allow-downgrade to avoid breakage on networks that mangle DNS.
  4. Pin the SecDNS hostname. Add DNS=<secdns-anycast-ip>#dns.secdns.io so the TLS handshake uses the correct SNI. Remove any lingering FallbackDNS= entries that point to public resolvers.
  5. Restart systemd-resolved. Run sudo systemctl restart systemd-resolved and confirm the new state with resolvectl status. The Current DNS Server line should show the SecDNS IP with +DoT.
  6. Test resolution. Run dig +short whoami.cloudflare TXT @127.0.0.53 or visit https://dnscheck.tools. The resolver hostname should match SecDNS infrastructure.

Verify it works

resolvectl query example.com should succeed and resolvectl statistics should show traffic flowing through DoT. Open https://dnscheck.tools and confirm the resolver hostname matches SecDNS. On the dashboard the device Live Logs view fills within seconds.

Troubleshooting

  • resolvectl reports "no servers found". The SecDNS IP is unreachable on port 853 from this network. Test with nc -vz <secdns-ip> 853. If blocked, switch to DoH via dnscrypt-proxy on port 443.
  • TLS handshake fails. SNI validation failed because you omitted the #dns.secdns.io suffix on the DNS line. Re-add it and restart.
  • systemd-resolved is disabled by NetworkManager. Run nmcli connection modify <name> ipv4.dns "<secdns-ip>" and ipv4.dns-options "trust-ad", then bring the connection back up.
  • /etc/resolv.conf still lists ISP DNS. Some installers point /etc/resolv.conf directly at NetworkManager. Replace it with a symlink: sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf.

Notes

For server fleets, prefer the dnscrypt-proxy stack: it gives you DoH on port 443, which is rarely filtered, plus built-in load balancing across SecDNS anycast endpoints.

On laptops that roam between networks, leave DNSStubListener=yes so applications keep using 127.0.0.53 regardless of the current Wi-Fi. Adding the same SecDNS profile via a NetworkManager dispatcher script keeps DNS pinned even when other connections set their own resolvers. For container hosts, mount /run/systemd/resolve/resolv.conf into the container so workloads share the same upstream without extra plumbing.

Frequently asked questions

Can I use DoH instead of DoT on Linux?

Yes. systemd-resolved only supports DoT, so for DoH install dnscrypt-proxy and point a stanza at https://dns.secdns.io/dns-query/<device-id>. The README on the device detail page contains a ready-to-paste config block.

Does this work on Ubuntu Server in a container?

Containers usually inherit DNS from the host. Configure SecDNS once on the host and the container will use it through /etc/resolv.conf. For Kubernetes use the upstream CoreDNS forwarder pattern.

My distribution does not ship systemd-resolved.

Use dnscrypt-proxy or stubby (DoT) as a local stub resolver and update /etc/resolv.conf to point at 127.0.0.1. Both projects support SecDNS DoH and DoT endpoints respectively.

How can I roll out the same config to many servers?

The SecDNS device detail page exports an Ansible role and a cloud-init snippet. Both pin the SecDNS resolver IP and DoH URL so you can deploy to a fleet in one command.

What about NetworkManager-managed laptops?

NetworkManager on recent distributions hands DNS off to systemd-resolved, so the steps above apply unchanged. If you have disabled systemd-resolved, configure DNS per connection with nmcli.