December 5, 2026

DNS over HTTPS vs DNS over TLS: Same Encryption, Different Door

A transparent envelope beside a sealed opaque envelope with wax

An ordinary DNS lookup crosses the network as readable text. A packet capture of one test query showed the name being asked for, nas.lab.test, and the answer, 192.168.1.20, in the clear for anything on the path to read. The same query sent over DNS over TLS produced 17 packets in which the name never appeared. DNS over HTTPS hid it just as well. The encryption is the same in both; the difference is which door the traffic uses, and that difference decides who can see that encrypted DNS is happening at all. Every query below ran against an Unbound 1.19 resolver configured for plain DNS, DoT and DoH, and was made with dig 9.18 and curl.

Video: Christian Lempa on YouTube

Plain DNS shows everything

What the capture saw

tcpdump on the resolver’s port 53 recorded the plain lookup:

IP 127.0.0.1.41303 > 127.0.0.1.53: 27759+ [1au] A? nas.lab.test. (53)
IP 127.0.0.1.53 > 127.0.0.1.41303: 27759* 1/0/1 A 192.168.1.20 (57)

The question and the answer, in two small UDP packets, readable by any device between the computer and its resolver: the Wi-Fi network, the router, the internet provider. Anything on that path can also alter the answer, which is how some public hotspots redirect visitors to login pages.

The privacy problem in one line

Websites moved to HTTPS years ago, so the content of most pages is encrypted. The DNS lookup that comes before each visit usually isn’t. It names the site in plain text.

Brick building with red door and arched windows over water

DNS over TLS: a dedicated encrypted port

How it works

RFC 7858 describes using Transport Layer Security to provide privacy for DNS, eliminating opportunities for eavesdropping and on-path tampering. Servers listen on TCP port 853, and the RFC says connections on that port are reserved purely for encrypted communications.

The test

$ dig +tls +short @127.0.0.1 -p 853 nas.lab.test
192.168.1.20

The capture on port 853 recorded 17 packets for that single lookup: the TCP handshake, the TLS handshake, the encrypted query and answer, and the close. A text search through all of them for “nas” found nothing.

The dedicated port cuts both ways

RFC 7858 notes that a designated port helps avoid interference from middleboxes, network devices that might mangle unfamiliar traffic on other ports. The same property makes DoT easy to recognize. Anything on port 853 is encrypted DNS, so a network administrator can see that it is in use, and a restrictive network can block it with one firewall rule. That is a feature for home and office networks that want to know where their DNS goes, and a weakness for anyone trying to keep using encrypted DNS on a network that would rather they didn’t.

DNS over HTTPS: hiding in web traffic

How it works

RFC 8484 defines a protocol for sending DNS queries and receiving responses over HTTPS. Queries are ordinary DNS messages carried as HTTPS requests with the media type application/dns-message, and for GET requests the message is encoded in base64url in a dns parameter, with padding characters removed. The RFC recommends HTTP/2 as the minimum version.

The test with dig

$ dig +https +short @127.0.0.1 -p 4443 nas.lab.test
192.168.1.20

dig’s full output labeled the server 127.0.0.1#4443 (HTTPS).

The test with curl

Because it is just HTTPS, any HTTP client can do a DoH lookup. A short script built the raw DNS query for nas.lab.test, encoded it as RFC 8484 describes, and asked curl to fetch /dns-query?dns=.... The server replied with HTTP status 200, content type application/dns-message, over HTTP/2, and the last four bytes of the 46-byte answer were 192.168.1.20.

Why use HTTPS at all

The RFC lists two motivations: preventing on-path devices from interfering with DNS, and letting web applications reach DNS through existing browser APIs safely. On port 443, DoH traffic looks like any other encrypted web connection. Blocking it without blocking the web means knowing which servers to block.

Highway traffic with downtown skyline and directional signs

Side by side

The comparison

Plain DNS DNS over TLS DNS over HTTPS
Standard RFC 1035 era RFC 7858 RFC 8484
Port 53 UDP/TCP 853 TCP 443 TCP (usually)
Query visible on path Yes No No
Recognizable as DNS Yes Yes, by port Mostly no
Easy for a network to block n/a Yes Harder
Typical client Operating system Operating system, routers, Android “Private DNS” Browsers, some operating systems

What neither hides

Encrypted DNS hides the question from the network path. It doesn’t hide it from the resolver, which still sees every name looked up, so choosing DoT or DoH means choosing which company or server gets that list instead of the internet provider. The IP addresses of the sites visited also remain visible on the network, and many HTTPS connections still announce the site name in the unencrypted part of the TLS handshake. Encrypted DNS closes one window, not all of them.

Certificates: strict or opportunistic

Encryption without verification

The test resolver used a self-signed certificate. dig connected and got answers anyway, because by default it doesn’t check certificates. Asking it to verify against the system’s trusted certificate authorities produced:

;; TLS peer certificate verification for 127.0.0.1#853 failed: self-signed certificate

Pointing it at the test’s own certificate, with the matching hostname, worked. Encryption without verification protects against someone passively listening, but not against someone pretending to be the resolver.

What the standards say

RFC 8310 defines two usage profiles. Strict privacy requires both an encrypted and an authenticated connection, with a hard failure if that isn’t available. Opportunistic privacy treats plain text as the baseline and lets the client continue even when authentication fails. Many devices that say they “support DoT” default to opportunistic, which means a network that blocks port 853 silently pushes them back to plain DNS.

Checking a real setup

On a device configured for encrypted DNS, the quickest check is whether lookups still work when the resolver’s certificate is wrong or the encrypted port is blocked. If they do, the setting is opportunistic. Android’s “Private DNS” with a hostname entered, and browsers set to a strict or “max protection” mode, fail closed instead.

White router on white table

Which to use at home

Home networks with a local resolver

Households running Pi-hole or a similar local DNS filter want every device to use it. Firefox’s DoH can bypass that, so Mozilla provides a signal. According to Mozilla’s page on the canary domain, networks can make the special domain use-application-dns.net return a negative result, and Firefox will then turn off DoH for users who had it on by default. Mozilla describes this as a limited-time measure until a standard way of signaling DNS filtering is adopted. A common home setup is to let the local resolver forward its upstream queries over DoT or DoH, so the household’s lookups are encrypted once they leave the house, while devices inside still use the local filter.

Linux with systemd-resolved

Many Linux distributions route lookups through systemd-resolved, which speaks DoT itself. The resolved.conf manual page describes the DNSOverTLS= setting:

Value Behavior
yes Every connection to the server is encrypted; if the server lacks DoT or a valid certificate, all lookups fail
opportunistic Tries DoT and falls back if the server doesn’t support it, which the page warns leaves it open to downgrade attacks
no (default) Plain DNS over UDP

The same page explains the address#server_name form for the DNS= line, as in DNS=192.0.2.53#dns.example.net. The name after the # is used to check the server’s certificate and is sent as the TLS server name; without it, the certificate is checked against the IP address instead. Setting DNSOverTLS=yes with a named server is the strict profile from RFC 8310 in two lines of configuration.

Running a resolver

The Unbound server used for these tests offers both protocols from one program. Its configuration manual defines tls-port as the port for DNS over TLS and https-port as the port for DNS over HTTPS, each served only on interfaces explicitly configured with that port. A home server that answers on 853 and 443 lets every device on the network choose whichever its software supports.

Laptops and phones that travel

On untrusted networks, a device-level DoT or DoH setting in strict mode keeps lookups private on hotel and cafe Wi-Fi. DoH is less likely to be blocked; DoT is easier to see and troubleshoot.

The short version

DoT and DoH use the same TLS encryption to protect the same DNS messages. DoT puts it on its own clearly labeled door, port 853, which networks can see, manage and block. DoH sends it through the front door every website uses, which is harder to block and harder to manage. Which one is better depends on whether the person deciding is the one running the network or the one trying to get past it.

Sources

  • RFC 7858, Specification for DNS over Transport Layer Security (TLS), RFC Editor: https://www.rfc-editor.org/rfc/rfc7858.html
  • RFC 8484, DNS Queries over HTTPS (DoH), RFC Editor: https://www.rfc-editor.org/rfc/rfc8484.html
  • RFC 8310, Usage Profiles for DNS over TLS and DNS over DTLS, RFC Editor: https://www.rfc-editor.org/rfc/rfc8310.html
  • resolved.conf(5), Linux manual page: https://man7.org/linux/man-pages/man5/resolved.conf.5.html
  • unbound.conf(5), NLnet Labs Unbound documentation: https://unbound.docs.nlnetlabs.nl/en/latest/manpages/unbound.conf.html
  • Canary domain – use-application-dns.net, Mozilla Support: https://support.mozilla.org/en-US/kb/canary-domain-use-application-dnsnet

920 Posts

Peter Kalafatis writes and edits X9M8. He holds a bachelor's degree from LIU Post and a master's in Media Studies from The New School, with academic work in the philosophy of science, human behavior, AI, and memetics.

View All Posts

Leave a Reply

Your email address will not be published. Required fields are marked *