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
- 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]
- Choose your stack. Use systemd-resolved if your distribution ships it; otherwise install dnscrypt-proxy with your package manager.
- Edit the resolved configuration. Open
/etc/systemd/resolved.confwith sudo. Under[Resolve]setDNS=<secdns-anycast-ip>andDNSOverTLS=yes. SetDNSSEC=allow-downgradeto avoid breakage on networks that mangle DNS. - Pin the SecDNS hostname. Add
DNS=<secdns-anycast-ip>#dns.secdns.ioso the TLS handshake uses the correct SNI. Remove any lingeringFallbackDNS=entries that point to public resolvers. - Restart systemd-resolved. Run
sudo systemctl restart systemd-resolvedand confirm the new state withresolvectl status. The Current DNS Server line should show the SecDNS IP with+DoT. - Test resolution. Run
dig +short whoami.cloudflare TXT @127.0.0.53or 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.iosuffix on the DNS line. Re-add it and restart. - systemd-resolved is disabled by NetworkManager. Run
nmcli connection modify <name> ipv4.dns "<secdns-ip>"andipv4.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.