Linux (systemd-resolved)
Most current distributions (Ubuntu, Fedora, Debian 12 with it enabled, Arch)
resolve names through systemd-resolved, which supports DNS-over-TLS. It
needs an address to connect to and a TLS server name, written
address#name. The name selects your profile and device.
Before you start, get your profile id and choose a device name. The host name of the machine is a good choice. The addresses are the shared addresses of opdns.
-
Create a drop-in file:
/etc/systemd/resolved.conf.d/opdns.conf [Resolve]DNS=23.166.164.53#<device>-<profile-id>.dns.opdns.netDNS=23.166.164.35#<device>-<profile-id>.dns.opdns.netDNS=2602:81f:6000::53#<device>-<profile-id>.dns.opdns.netDNS=2602:81f:6000::35#<device>-<profile-id>.dns.opdns.netDNSOverTLS=yesDomains=~.If your network has no IPv6, leave out the two IPv6 lines.
DNSOverTLS=yesis strict: it never goes back to unencrypted DNS.Domains=~.sends every name to these servers, not to a server from DHCP for one network link. -
Restart the service:
Terminal window sudo systemctl restart systemd-resolved -
Make sure that programs use the service.
/etc/resolv.confmust point to the stub resolver127.0.0.53:Terminal window readlink /etc/resolv.conf # ../run/systemd/resolve/stub-resolv.conf -
Make sure that the settings are active:
Terminal window resolvectl statusresolvectl query example.com
Without systemd-resolved
Section titled “Without systemd-resolved”Any stub resolver that supports DoT with a server name works the same way.
Examples are Stubby, or Unbound with forward-tls-upstream: yes and
forward-addr: 23.166.164.53@853#<device>-<profile-id>.dns.opdns.net. For DoH, use a local forwarder
such as dnscrypt-proxy or https_dns_proxy with the URL
https://dns.opdns.net/<profile-id>/<device>. The opdns CLI does both as a service.
If one transport fails, it uses the other.