Skip to content
Sign inGet all access
Chapter 6·8 minFree

Modern DNS

Privacy, and the records browsers added.

Every query in this course so far travelled in the clear.

Queries are plaintext

UDP port 53, no encryption. Anyone on the path sees every name you look up.

DNSSEC from chapter 4 does not help — it proves an answer is genuine, not private. A resolver listens on both the plaintext port and the encrypted one:

nc -z -w 3 1.1.1.1 53 2>/dev/null && echo '53 open' || echo '53 closed'
nc -z -w 3 1.1.1.1 853 2>/dev/null && echo '853 open' || echo '853 closed'
Output53 open853 open

DNS over TLS

The same protocol inside TLS, on port 853:

terminal
openssl s_client -brief -connect 1.1.1.1:853 </dev/null 2>&1 \
  | grep -E 'Protocol version|Verification'
OutputProtocol version: TLSv1.3Verification: OK

A dedicated port makes DoT easy to recognise, and easy to block.

DNS over HTTPS

The same queries as HTTP requests on port 443, indistinguishable from other web traffic. A network operator cannot block it without blocking the web.

A DoH query with curl

No DNS tooling at all — a GET request and a JSON reply:

curl -s -H 'accept: application/dns-json' \
  'https://cloudflare-dns.com/dns-query?name=one.one.one.one&type=A' \
  | python3 -c '
import json, sys
d = json.load(sys.stdin)
print("Status:", d["Status"], "AD:", d["AD"])
for a in sorted(d["Answer"], key=lambda x: x["data"]):
    print(a["data"])'
OutputStatus: 0 AD: True1.0.0.11.1.1.1

Status: 0 is NOERROR as a number and AD: True is chapter 4’s flag in JSON. Chapter 5’s failures are numbered too:

curl -s -H 'accept: application/dns-json' \
  'https://cloudflare-dns.com/dns-query?name=nosuch-xyz987.com&type=A' \
  | python3 -c 'import json, sys
print("Status:", json.load(sys.stdin)["Status"])'
OutputStatus: 3

3 is NXDOMAIN. The fields are the same; only the transport changed.

Google serves the same thing at a different URL:

curl -s -H 'accept: application/dns-json' \
  'https://dns.google/resolve?name=example.com&type=A' \
  | python3 -c 'import json, sys
print("Status:", json.load(sys.stdin)["Status"])'
OutputStatus: 0

That is why DoH changed the politics of resolution — any application that can make an HTTPS request can resolve names.

What encryption does not hide

Encrypting the query is less than it sounds:

Leaks How
The address you connect to the connection itself
The hostname SNI, in the TLS handshake
Timing and volume packet sizes and intervals

HTTPS and SVCB records

A newer type carrying connection hints — protocols, port, addresses — fetched before the first connection:

dig @1.1.1.1 +short TYPE65 cloudflare.com | head -1 | cut -c1-20
Output\# 61 00010000010006

Encrypted Client Hello

The remaining leak is SNI — the hostname sent in the clear during the TLS handshake.

ECH encrypts it using a key published in the HTTPS record above — DNS privacy needing a DNS record to work.

ECH needs the DoH query, the HTTPS record and server support together. Missing any one leaves the hostname visible as before.

DNS for load balancing

Several A records at one name, in rotating order:

terminal
dig @1.1.1.1 +short example.com | head -1
Output$ dig @1.1.1.1 +short example.com | head -1104.20.23.154$ dig @1.1.1.1 +short example.com | head -1172.66.147.243

That is round-robin. GeoDNS adds one step: the authoritative server answers differently by where the query came from.