Skip to content
Sign inDashboard

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.

  1. Create a drop-in file:

    /etc/systemd/resolved.conf.d/opdns.conf
    [Resolve]
    DNS=23.166.164.53#<device>-<profile-id>.dns.opdns.net
    DNS=23.166.164.35#<device>-<profile-id>.dns.opdns.net
    DNS=2602:81f:6000::53#<device>-<profile-id>.dns.opdns.net
    DNS=2602:81f:6000::35#<device>-<profile-id>.dns.opdns.net
    DNSOverTLS=yes
    Domains=~.

    If your network has no IPv6, leave out the two IPv6 lines. DNSOverTLS=yes is 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.

  2. Restart the service:

    Terminal window
    sudo systemctl restart systemd-resolved
  3. Make sure that programs use the service. /etc/resolv.conf must point to the stub resolver 127.0.0.53:

    Terminal window
    readlink /etc/resolv.conf # ../run/systemd/resolve/stub-resolv.conf
  4. Make sure that the settings are active:

    Terminal window
    resolvectl status
    resolvectl query example.com
  5. Check it works.

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.