Self-hosted node
The self-hosted node, opdns-node, is the same resolver that runs on the
PoPs (server locations) of opdns. It has the same listeners and filtering
engine, in one process. That process supervises its own Unbound, keeps logs
in a SQLite file and serves a small status page. Put the node on a
Raspberry Pi, a home server or a NAS, and point your network at it.
Reasons to run one:
- It keeps working when the internet or opdns is down. Filtering uses the last profile and lists that it received.
- Logs stay at home. The node logs the queries that your devices send to it in its SQLite file and nowhere else.
- Latency is lower for everything on your network.
An enrolled node is connected to your opdns account. A standalone node has no account.
| Enrolled | Standalone | |
|---|---|---|
| Account | required | none |
| Profile | from the dashboard, pushed to the node over its link | in the node’s configuration file |
| Lists | the signed list artifact opdns publishes | the same public artifact |
| Logs | the node’s SQLite, plus the cloud’s logs for the profile if you choose | the node’s SQLite |
| Manage it from | the dashboard (it reads logs and analytics through the link) and a local status page | the configuration file and a local status page |
| When opdns is unreachable | keeps resolving with the last profile and lists | unaffected |
A node that is not enrolled and has no standalone profile does not serve DNS. It prints how to enroll and exits. Both modes are available today. You manage a standalone node through its profile file and a small local API. It has no editing page. See Standalone mode.
In both modes, the node answers only devices on your own network, unless you allow more. See Network access.
A node serves one profile. Per-client profiles (different profiles for different devices on your LAN) are not available yet. The node answers local names from DHCP leases and private PTR records (Local names).
List updates and rollbacks
Section titled “List updates and rollbacks”The node installs a list artifact (the signed file of filter lists) only if
it verifies with a trusted Ed25519 key and matches the announced hash. An
enrolled node runs the version that the cloud announces. A lists changed
notice over the link, or the lists of a profile pull, installs the named
version. It does this even when that version is older than the one in use.
That is how a rollback of a bad list build at opdns reaches your node. An
enrolled node installs only versions that opdns released to every PoP. It
never installs a build that opdns is still testing on a few PoPs.
Every lists changed notice carries the position of the announcement in the list stream of the cloud. It also says whether it is a rollback. The node applies notices in that order. It installs an older version only when the notice says rollback. The node ignores a notice at or below the last position that it applied, because that notice is a replay or arrived out of order.
The node keeps the last announcement in lists_announced.json in the data
directory, so the order survives a restart. The lists of a profile pull
carries no position and never moves the node back. A standalone node never
goes back to an older version without telling you. If polling finds a
latest.json that is older than its current artifact, the node refuses it.
It keeps its current lists and shows the error in opdns-node status.
Updates are small. With each version, opdns publishes signed deltas (the
changes from an earlier version) from the few versions before it. If a
node holds one of those versions, it downloads the delta and rebuilds the
new artifact from it. Before it installs the result, it makes sure that the
result is byte for byte the published artifact (its SHA-256 and its own
signature). A node that is further behind downloads the full artifact, as
before. A node whose delta fails for any reason does the same.
opdns_node_lists_delta_total{result="applied"|"fallback"} and
opdns_node_lists_delta_bytes_saved_total on /metrics show the results.
Deltas work only when the node can read the latest.json next to the
artifact (or at lists.url). If it cannot, the node downloads full
artifacts.
Small hardware: list shards
Section titled “Small hardware: list shards”opdns also cuts every published version into shards. A shard holds the lists of one protection group: ads and trackers, malware and phishing, scams and abuse, newly registered domains, device telemetry, or one of the parental groups. Each shard is a signed artifact of its own.
Set lists.memory_budget_mb (OPDNS_LISTS_MEMORY_BUDGET_MB) to the
memory, in MiB, that the lists can use. The node then loads only the shards
that hold a list your profile can turn on (schedules included). It merges
them into one index instead of loading the full artifact. When the profile
changes, the node fetches the shards that it now needs.
If the profile needs more than the budget, the node loads the shards
anyway, so protection never drops without notice. It also shows a warning
in its log, on the status page (opdns-node status --json shows shards,
need_bytes and over_budget) and on /metrics
(opdns_node_lists_over_budget 1, opdns_node_lists_shard_bytes). The
default value, 0, loads the full artifact.
The index is memory-mapped (the kernel reads the file into memory as needed). The memory that it uses is the size of its file. Under memory pressure, the kernel can page it out like any cache. The table gives the sizes for the current catalog. They are modeled from the size of each source. The full artifact is smaller than all shards together, because each shard sizes its own hash table.
| Shard | Lists | Entries | Size (MiB) |
|---|---|---|---|
ads_trackers |
7 | 304 894 | 9.5 |
malware_phishing |
3 | 2 387 662 | 81.8 |
scams_abuse |
2 | 17 500 | 0.6 |
nrd |
1 | 6 184 206 | 246.2 |
telemetry |
14 | 674 | 0.0 |
affiliate_links |
1 | 17 | 0.0 |
adult |
9 | 989 083 | 34.5 |
gambling |
1 | 572 111 | 18.5 |
social |
18 | 4 941 | 0.2 |
entertainment |
23 | 37 537 | 1.2 |
other |
8 | 79 213 | 2.5 |
| all shards | 10 577 838 | 395.1 |
| Profile | Shards loaded | Entries | List memory (MiB) |
|---|---|---|---|
| New profile (every slider at step 3) | ads_trackers, malware_phishing, scams_abuse | 2 710 056 | 92.0 |
| Every slider at step 4 | ads_trackers, malware_phishing, scams_abuse | 2 710 056 | 92.0 |
| Every slider at step 5 | ads_trackers, malware_phishing, scams_abuse, nrd | 8 894 262 | 338.2 |
A new profile fits on a 512 MB router with room to spare. The newly registered domains list is on the last step of the scams and abuse slider. It is by far the largest shard. On a 512 MB device, keep that slider at step 4 or below, or give the node more memory. The parental groups load only when you turn them on.
Profile signing keys
Section titled “Profile signing keys”An enrolled node makes sure that each profile it receives comes from opdns.
The cloud signs every profile that it sends with Ed25519
(profile_signature over the id, version and content of the profile).
The node trusts the keys that the cloud announces. It learns them at
enrollment, then from every profile response that verifies, so a key
rotation needs nothing from you. The node keeps learned keys in
<data_dir>/profile_keys.json. They are backed up with the node and
removed when you unenroll it. The node also trusts the keys that you pin
with cloud.profile_public_keys (OPDNS_CLOUD_PROFILE_PUBLIC_KEYS, hex).
Pin keys if you do not want trust to depend on what the node learned at
enrollment.
When the node trusts at least one key, it refuses a profile that is
unsigned or has a bad signature. It keeps resolving with its last good
profile. opdns-node status and the local page show the error, and
opdns_node_profile_signature_failures_total counts it. When the cloud
stops announcing a key, the node keeps trusting it until the next pull
confirms the new set of keys.
The node trusts the first key on first use. If an attacker controls the
path at enrollment, the node can learn the wrong key. Pinning prevents
this. If opdns loses its key and replaces it, stop the node and delete
profile_keys.json. Then start the node again, and it learns the new key.
Operator blocks
Section titled “Operator blocks”An enrolled node enforces the same
operator blocks as the servers of opdns.
Operator blocks are blocks that opdns sets for a legal order or for abuse.
The node answers a blocked domain with NXDOMAIN, extended DNS error 15
(Blocked), and the public reason and reference (for example
legal_order ORDER-1). It does this whatever your profile says. It
refuses sources that are blocked for abuse.
The blocks come with every profile pull. They are signed with the profile
signing key, and the node verifies them like the profile. Over the link, a
change reaches the node within seconds. The node keeps the last set in
operator_blocks.json and operator_sources.json in the data directory.
It enforces that set while offline and after a restart. A block stops at
its expiry time, even offline. The local page and
opdns-node status --json show the versions in force.
Your node gets the blocks that apply everywhere and the blocks for the country that it links from. Blocks limited to one PoP of opdns do not reach it. Standalone nodes do not receive operator blocks yet.
Local names
Section titled “Local names”In both modes, the node answers the names of your own network itself. It does not ask the internet.
You set the local domains in local.domains (default home.arpa,
RFC 8375). In these domains, the node answers hosts from local.hosts
(name=address[,address]). It answers a bare label under every local
domain. It also answers host names from the DHCP lease files in
local.lease_files. The node detects the format (dnsmasq, ISC dhcpd or Kea
CSV) and polls the files every local.lease_poll (30 seconds). Static
hosts win over leases. The node reloads local.hosts on SIGHUP.
For reverse lookups of private addresses (RFC 1918, 169.254/16, fc00::/7, fe80::/10), the node gives PTR answers from the same table.
If the node does not know a name or a private address, it answers NXDOMAIN
locally. If local.forward names your router, the node asks the router
instead (conditional forwarding). In both cases, private reverse lookups
never leave your network. The node answers local names after it applies
the policy of the profile, so a rewrite of the
same name still wins over them. The local page shows how many names the
node answers and when it last read the leases.
Local names are on by default, with nothing configured. home.arpa names
that you did not declare get NXDOMAIN, and reverse lookups of private
addresses stay local. Rebinding protection can catch a local domain outside
home.arpa, .lan, .home, .internal and the other local suffixes.
With local.device_names on (the default), the node logs queries from
clients that send no device name under their lease or host name
(Logs on your node).
IPv6 for upstream queries
Section titled “IPv6 for upstream queries”Unbound can ask authoritative servers over IPv4 and IPv6. If Unbound tries
IPv6 first on a host without working IPv6, cold lookups are slow and fail
more often. For this reason, the node tests the host at start and on every
reload (SIGHUP). It asks the kernel for a route to a public IPv6 address,
without sending a packet.
| The host has | Unbound is told |
|---|---|
| no IPv6 route | IPv4 only (do-ip6: no) |
| a route, but only a private or unique-local IPv6 source address | prefer IPv4 (prefer-ip4: yes), as opdns’s PoPs do without a public IPv6 source |
| a public IPv6 source address | both families |
unbound.ipv6 overrides the test. Its values are auto (default), on,
prefer-ip4 and off. When the result changes, the node restarts Unbound.
The local page and /api/status (unbound.ipv6) show the route, the
source address and what Unbound uses. This affects only the queries that
the node itself sends to the internet. It also applies only to a node that
runs its own Unbound, not to one with unbound.spawn: false. Your devices
can still query the node over IPv6.
Local root zone
Section titled “Local root zone”Like every opdns PoP, the node’s Unbound keeps its own copy of the DNS root zone (RFC 8806). This is on by default. Root referrals come from the copy. A lookup that is not cached therefore starts at the servers of the top-level domain, instead of at a root server. This is slightly faster. Also, while the copy is valid, the root servers do not see which top-level domains your network looks up.
- The copy is
<data_dir>/unbound/root.zone(about 2 MB). Unbound refreshes it on the timers of the zone, from the sources indns.root_zone_sources. By default, these are the root servers that allow transfers, by IP address: b, c, d, f, g and k, plus ICANN’s xfr.lax and xfr.cjr, over IPv4 and IPv6. Host names and URLs are refused. - Every copy must match its ZONEMD digest before it is used. While validation is on, its DNSSEC signatures must also be valid.
- A missing, rejected or expired copy never stops resolution. Unbound then
asks the root servers, as any resolver does.
/healthzdoes not depend on the copy. - The status page and
opdns-node statusshow the serial and the age of the copy (unbound.root_zonein/api/status). They show a warning when the copy is two days old. The root zone usually changes about twice a day./metricshasopdns_edge_root_zone_loaded,opdns_edge_root_zone_serialandopdns_edge_root_zone_updated_timestamp_seconds, the same series as the PoPs.
Transfers need outbound TCP port 53 (to the addresses) and HTTPS (to the
URL). Some networks let DNS out to one server only. On such a network, set
dns.root_zone_sources to a local server that serves the root zone by zone
transfer. You can also turn the copy off with dns.root_zone: false. The
environment variables are OPDNS_DNS_ROOT_ZONE and
OPDNS_DNS_ROOT_ZONE_SOURCES. Both keys take effect on restart. See the
configuration reference. A node
with unbound.spawn: false ignores them.
What you need
Section titled “What you need”- Linux on
amd64orarm64with Docker, or the static binary forlinux/amd64,linux/arm64ordarwin/arm64. On Linux, the binary runs as a hardened systemd service (the unit file). - For the binary, Unbound installed on the host. The container includes Unbound.
- No configuration for an enrolled node. The list signing key comes from the cloud.
- Port 53 (UDP and TCP) free on the host, and port 8053 for the status page.
- Memory: the full list artifact uses about 300 MB and is sized for under 1 GB. On a router or a board with 512 MB or 1 GB, set a memory budget, so that the node loads only the lists that its profile uses (Small hardware).
What opdns learns from your node
Section titled “What opdns learns from your node”An enrolled node has one outbound connection to link.opdns.net. Over it,
opdns learns:
- The id of the node.
- Its versions (node, Unbound, profile, lists).
- Uptime and last sync time.
- SQLite file size, oldest record time, and pending and dropped record counts.
- Clock offset and whether Unbound is healthy.
- Connection times and its public IP address.
opdns never learns the queries that the node resolves or the logs that it produces. The only exception is the answers to your own dashboard requests. opdns relays them in transit and does not store them. When such an answer lists destination addresses, opdns adds their countries on the way, because the node has no GeoIP data (Analytics from your node).
From a standalone node, opdns sees the downloads of the public list artifact (IP address and time). It keeps them in operational logs for 14 days.
Privacy of your node gives the details for each mode. The binding text is the privacy policy, section 7. Architecture explains how the link works.
License
Section titled “License”The node is source-available (its source code is public) under the Source First License 1.1. It is free for non-commercial use, such as on your home network. A business that runs it needs a commercial license. See Licensing and the self-hosted license FAQ.
Next: install with Docker or the static binary.