Skip to content

Instantly share code, notes, and snippets.

@sheecegardezi
Created April 8, 2026 11:57
Show Gist options
  • Select an option

  • Save sheecegardezi/a5a78cd0a17d03bcbba653a68324d2ae to your computer and use it in GitHub Desktop.

Select an option

Save sheecegardezi/a5a78cd0a17d03bcbba653a68324d2ae to your computer and use it in GitHub Desktop.
Quad9 DNS setup on Ubuntu with DNS-over-TLS

Quad9 DNS Setup on Ubuntu (systemd-resolved)

DNS Servers

  • Primary: 9.9.9.9
  • Secondary: 149.112.112.112
  • IPv6: 2620:fe::fe / 2620:fe::9

Setup

1. Edit resolved.conf

sudo nano /etc/systemd/resolved.conf

Set under [Resolve]:

[Resolve]
DNS=9.9.9.9 149.112.112.112
FallbackDNS=
DNSOverTLS=yes

2. Restart the service

sudo systemctl restart systemd-resolved

3. Set per-link DNS (for active interface)

sudo resolvectl dns enp132s0 9.9.9.9 149.112.112.112

Replace enp132s0 with your interface name (ip link show to list).

Verify

resolvectl status
dig +short txt proto.on.quad9.net

Why Quad9?

  • Free, privacy-focused DNS
  • Blocks known malicious domains
  • Supports DNS-over-TLS (encrypted)
  • No personal data logging
  • https://quad9.net
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment