Command line (opdns CLI)
opdns is a small DNS forwarder (a program that passes DNS queries on to
a resolver). It answers on 127.0.0.1:53 and [::1]:53. It sends every
query to opdns over encrypted DNS, with your profile id and a device name.
Use it if the system has no encrypted DNS setting of its own (Windows 10,
most Linux without systemd-resolved, routers). Also use it if you want more
than the system setting gives you:
- Every transport, with fallback: DNS-over-HTTPS over HTTP/3, then over HTTP/2, then DNS-over-TLS, then DNS-over-QUIC. If a network blocks one transport, the next one answers. The forwarder tries the faster one again in the background.
- A device name from the host name, or the name that you choose.
- Named LAN devices on a router: each device behind the router appears under its own name in your logs.
- Local names forwarded to your router (
home.arpa, a company domain). - Captive portals in hotels and cafés still show their login page.
- A self-hosted node at home, for when the cloud is out of reach.
If the system already supports encrypted DNS (Android, iOS, macOS, Windows 11, systemd-resolved, the browsers), its own setting needs no extra software. See the other setup guides.
Install
Section titled “Install”Before you start, get your profile id from the Setup page of the dashboard. You also need administrator rights, because the forwarder binds port 53 and sets the resolver of the system.
The binaries are on the
releases page, with the names
opdns_v<version>_<os>_<arch>. Next to them is a SHA256SUMS file that
lists the checksum of every file in the release. In the commands below,
replace <version> with the newest version on that page, without the
leading v (for example 0.1.23 for v0.1.23).
-
Download the binary for your machine (
linux_amd64for x86-64,linux_arm64for 64-bit ARM). Make sure that the checksum is correct, then install it:Terminal window V=<version>; A=linux_amd64curl -fLO https://github.com/operomtl/opdns/releases/download/v$V/opdns_v${V}_$Acurl -fLO https://github.com/operomtl/opdns/releases/download/v$V/SHA256SUMSsha256sum --ignore-missing -c SHA256SUMSsudo install -m 0755 opdns_v${V}_$A /usr/local/bin/opdnssha256summust printOKfor the file. -
Install it as a service for your profile:
Terminal window sudo opdns install --profile <profile-id>This command writes
/etc/opdns/client.yaml. It installs and starts the systemd unitopdns.service. While the service runs, the system uses it. With systemd-resolved, the command adds a drop-in (/etc/systemd/resolved.conf.d/opdns.conf). Without systemd-resolved, it keeps a copy of/etc/resolv.confand then replaces the file. -
Check it works, and see what the forwarder does:
Terminal window opdns status
-
Download the binary, make sure that the checksum is correct, and install it. Use
curlin Terminal, as shown here, not a browser. Then macOS does not block the file as an unsigned download. The binary is for Apple silicon. On an Intel Mac, build it from source as in the Windows tab, withGOOS=darwinand-o opdns.Terminal window V=<version>; A=darwin_arm64curl -fLO https://github.com/operomtl/opdns/releases/download/v$V/opdns_v${V}_$Acurl -fLO https://github.com/operomtl/opdns/releases/download/v$V/SHA256SUMSgrep " opdns_v${V}_$A\$" SHA256SUMS | shasum -a 256 -csudo mkdir -p /usr/local/binsudo install -m 0755 opdns_v${V}_$A /usr/local/bin/opdnsshasummust printOKfor the file. -
Install it as a launchd daemon for your profile:
Terminal window sudo opdns install --profile <profile-id>This command writes
/etc/opdns/client.yamland/Library/LaunchDaemons/io.opdns.client.plist, and starts the daemon. While the daemon runs, it sets the DNS servers of every network service to127.0.0.1and::1(networksetup). When you stop it, it puts back the previous servers. -
Check it works and run
opdns status.
If you also installed the opdns configuration profile, remove it first (System Settings → General → Device Management). The encrypted DNS of the profile has priority over the forwarder.
-
There is no Windows binary yet. Build
opdns.exefrom source on any computer with Go 1.27 or newer. Download the Source code archive of the newest release from the releases page and unpack it. In the unpacked folder, run:Terminal window CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -trimpath -o opdns.exe ./cmd/opdnsThat line is for a Linux or macOS shell. In PowerShell on Windows, run
$env:CGO_ENABLED='0'; go build -trimpath -o opdns.exe ./cmd/opdnsinstead. Copyopdns.exetoC:\Program Files\opdns\opdns.exeon the Windows computer. -
In a PowerShell window with administrator rights, run:
Terminal window & 'C:\Program Files\opdns\opdns.exe' install --profile <profile-id>This command writes
C:\ProgramData\opdns\client.yaml. It installs and starts the Windows service opdns DNS forwarder. While the service runs, it sets the DNS servers of every connected adapter to127.0.0.1and::1(netsh). When you stop it, it puts back DHCP or the addresses that you had. -
Check it works and run
opdns status.
The device name is the first label of the host name (Annas-MacBook.local
becomes annas-macbook). To choose a different name, use --device. Names
follow the rules of the resolver (Your endpoints).
What it sends
Section titled “What it sends”For profile abc123 and device laptop, the forwarder uses, in this
order:
| Transport | Address |
|---|---|
| DNS-over-HTTPS, HTTP/3 then HTTP/2 | https://dns.opdns.net/abc123/laptop |
| DNS-over-TLS (port 853) | laptop-abc123.dns.opdns.net |
| DNS-over-QUIC (port 853) | laptop-abc123.dns.opdns.net |
The forwarder looks up dns.opdns.net one time, through the resolver
that your network gave you (the one in use before activation). It keeps its
connections open between queries. It caches answers for their TTL.
If a transport fails, the forwarder skips it for 15 seconds. Each time the
transport fails again, the forwarder skips it for twice as long, up to
5 minutes. It tests the transport again in the background, on the
unfiltered public path. It never delays one of your queries for this test.
When you move to a different network, the forwarder starts again from the
beginning. To change the order or to leave out transports, use
--transports doh2,dot.
Start, stop, activate
Section titled “Start, stop, activate”| Command | Does |
|---|---|
opdns status |
Shows the service, the transport in use, the state of every transport, the cache and the counters. |
opdns stop / opdns start |
Stops or starts the service. When it stops, it puts back the system resolver. |
opdns deactivate |
Puts back the system resolver. The forwarder continues to run. |
opdns activate |
Points the system resolver at the forwarder again. It refuses if the forwarder does not answer. |
opdns config |
Shows the configuration in use. opdns config set --device tv changes the file. |
opdns run |
Runs in the foreground, for tests or your own init system. |
opdns uninstall |
Stops the service, puts back the system resolver, and removes the service. --purge also removes the configuration file. |
To run the service without a change to the system resolver, install with
--auto-activate=false. Then point programs at 127.0.0.1 yourself.
On a router
Section titled “On a router”On a router or a small server for the full network, listen on the LAN side. Name the devices behind it from the DHCP lease file (dnsmasq, ISC dhcpd, Kea) or by address:
sudo opdns install --profile <profile-id> --device home-router \ --listen 192.168.1.1:53 --listen 127.0.0.1:53 \ --lease-file /tmp/dhcp.leases \ --client 192.168.1.20=kids-tablet \ --forward home.arpa=192.168.1.1 \ --auto-activate=falseThen give out the address of the router as the DNS server. Usually, the
router already does this. Turn off the own resolver of the router on that
address. Each device appears in the logs under its lease name. If a device
also has a --client name, the --client name wins. A device without a
name appears as the device of the router. --forward sends the names of a
domain to a different server in plain DNS. The home.arpa names of the
router never leave your network.
There is no OpenWrt or other router package yet. On an ARM64 router, use
the linux_arm64 binary. For a different architecture, build the binary
from the source code of the release, as in the Windows tab. For example,
use GOOS=linux GOARCH=mipsle for most MT7621 routers. Then start
opdns run from the init system of the router, with the same flags.
opdns install supports only systemd, launchd and Windows.
Captive portals
Section titled “Captive portals”A captive portal is a sign-in page that a network shows before it lets
you on. If no transport answers, the forwarder looks for a captive portal
on the network. If it finds one, it asks the resolver of the network, in
plain DNS, for two kinds of names. The first are the names that your system
uses to find portals (the names of Apple, Android, Windows, Firefox and
NetworkManager). The second is the host of the portal. Then the login page
appears. The forwarder resolves nothing else until you are signed in. Then
it goes back to encrypted DNS within seconds. To turn this off, use
--captive-portal=false.
A self-hosted node at home
Section titled “A self-hosted node at home”If you have a self-hosted node, the forwarder can use it when the cloud is out of reach:
sudo opdns config set --node 192.168.1.2 --node-server-name node.home.arpaThe forwarder tries the node after every cloud transport, over
DNS-over-TLS (or plain DNS with --node-transport dns). The certificate of
the node must be valid for the server name. For a private certificate, add
its root with --ca-file.
The configuration file
Section titled “The configuration file”/etc/opdns/client.yaml (C:\ProgramData\opdns\client.yaml) holds the
same keys as the flags. Every flag also has an OPDNS_* environment
variable (opdns --help):
profile: <profile-id>device: laptoptransports: [doh3, doh2, dot, doq]listen: ["127.0.0.1:53", "[::1]:53"]forward: ["home.arpa=192.168.1.1"]clients: ["192.168.1.20=kids-tablet"]lease_files: [/tmp/dhcp.leases]node: { addr: 192.168.1.2, server_name: node.home.arpa }auto_activate: truePrivacy
Section titled “Privacy”The logs of the forwarder never hold the names that you look up or the
addresses of your devices. --log-queries adds one line for each query,
with its name, for debugging on your own machine. The forwarder serves its
status and Prometheus metrics on 127.0.0.1:9853 only. To turn them off,
use --metrics off.