Skip to content
Sign inDashboard

Network access

By default, a node answers your own network and nobody else. A node can become reachable from the internet, for example through a port forward on the router or on a server with a public address. Even then, it is not an open resolver (a DNS server that answers anyone), which attackers use for DNS amplification. It is also not an exposed admin page.

Set the DNS server of a device to the LAN IP address of the node. An unidentified client uses the default profile of the node, including its filtering rules, over both UDP and TCP. It does not need a profile ID in the query. The same default applies to encrypted queries without a profile identity.

The DNS listeners answer these sources, plus all addresses in dns.allow_from:

Range What
10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 private IPv4 networks (RFC 1918)
100.64.0.0/10 shared address space: carrier-grade NAT, Tailscale
127.0.0.0/8, ::1 the machine itself
169.254.0.0/16, fe80::/10 link-local
fc00::/7 IPv6 unique local addresses (ULA)

Any other source gets one of these answers:

  • On plain DNS (port 53, UDP and TCP): REFUSED with Extended DNS Error 18 (Prohibited), before any lookup and without a log record.
  • On DoT, DoH and DoQ: the node closes the connection after the handshake.

Add any other network that you trust in the same way, for example a VPN range, a second site or a public address that you own. Each entry is a CIDR or a single address. 0.0.0.0/0 or ::/0 turns the guard off for that address family. The node then shows a warning on its page and in opdns-node status that it is an open resolver.

dns.public_transports: true lets any source use the encrypted listeners (DoT, DoH, DoQ, DoH3). Plain DNS on port 53 stays guarded. Use it for a node that you use from outside your network on purpose, such as from a phone on mobile data. While it is on, the page shows a warning.

The lan guard row of the page shows whether the guard is on and how many queries it refused in the last hour. Over 100 in an hour puts a warning on the page. The node is then probably reachable from the internet. Examine the port forwarding of your router. The log of the node says the same, at most once a minute, with the source address.

To use encrypted DNS on your LAN, configure a hostname that resolves to the LAN address of the node. Also configure a certificate whose Subject Alternative Name (SAN) contains that hostname. In the example below, replace the address and the paths with the address of your node and the paths of your PEM certificate chain and private key:

/etc/opdns/node.yaml
listen:
udp: ["192.168.1.2:53"]
tcp: ["192.168.1.2:53"]
dot: ["192.168.1.2:853"]
doh: ["192.168.1.2:443"]
dns_domain: dns.home.arpa
tls_cert: /etc/opdns/tls/dns.home.arpa.crt
tls_key: /etc/opdns/tls/dns.home.arpa.key

The node must be able to read the certificate chain and the private key. After you change listener addresses or dns_domain, restart the node. When a renewed certificate is written to the same paths, the node reloads it automatically. These binds serve only the chosen LAN address. If you need IPv6, add your LAN IPv6 address, and its allowed source prefix as described above. The configuration reference gives all listen keys and how the node validates the configuration.

Configure a DoT client with the server hostname dns.home.arpa, port 853, and the address of the node. For DoH, use https://dns.home.arpa/dns-query (port 443). To use the default profile of the node, neither needs a profile ID in the hostname or URL. Clients must trust the CA that issued the certificate, and must verify dns.home.arpa against its SAN. If you use a local CA, install it on the client. Clients can connect to the IP of the node while they verify dns.home.arpa. To use the IP as the TLS server name or HTTPS URL host, the certificate must have a matching IP SAN. Do not turn off certificate verification to make the client connect.

These DNS TLS settings are separate from the local page’s web.hosts allowlist below.

The page on port 8053, /api/status, /healthz, /metrics (when turned on) and the standalone local API have their own allowlist. It has the same defaults, plus the entries in web.allow_from. Other sources get 403.

They also examine the Host header. This stops a web page that you visit from reaching the node through DNS rebinding. They accept an IP address, localhost, the name of the node and the host name of the machine (each also with .local), and the names in web.hosts. Any other name gets 421 Misdirected Request. If you open the page by a name of your own, such as dns.home.arpa, add that name:

/etc/opdns/node.yaml
web:
hosts: [dns.home.arpa]

By default, anyone on your network can open the page. To ask for a password, hash one and put the hash in the configuration:

Terminal window
opdns-node hash-password # reads one line from standard input: the password, 8 characters or more
/etc/opdns/node.yaml
web:
password_hash: "$argon2id$v=19$m=65536,t=3,p=2$..."

The page, /api/status and /metrics then ask for the password (HTTP Basic: any user name, that password). /healthz stays open for health checks. The standalone local API keeps its own bearer token. Each source gets five password attempts a minute. The node answers more attempts with 429. A reload (systemctl reload opdns-node) applies a new hash without a restart. config check and --print-config print the hash as <redacted>. The page is plain HTTP. The password keeps other people on your network out, but it crosses the network unencrypted.

/metrics (Prometheus) is on by default, on the port of the page. It is behind the same allowlist and, when set, the password. If you set a password, a Prometheus scrape job needs basic_auth with that password (any user name). page.metrics: false (OPDNS_PAGE_METRICS=false) turns it off.

It has the metrics of the resolver and the metrics of the node: link state, log backlog, SQLite size, writer queue, dropped records, relayed queries shed under load (opdns_node_queries_shed_total) and queries refused by the network guard (opdns_node_open_resolver_refused_total). It shows the versions that the node runs to anyone that the allowlist lets in. If that is a problem on your network, set a page password or turn metrics off.

Key Environment variable Default
dns.allow_from OPDNS_DNS_ALLOW_FROM none beyond the ranges above
dns.public_transports OPDNS_DNS_PUBLIC_TRANSPORTS false
web.allow_from OPDNS_WEB_ALLOW_FROM none beyond the ranges above
web.hosts OPDNS_WEB_HOSTS none beyond the names above
web.api_token OPDNS_WEB_API_TOKEN generated into <data_dir>/secrets/api_token
web.password_hash OPDNS_WEB_PASSWORD_HASH none: no password
page.metrics OPDNS_PAGE_METRICS true

dns.allow_from, web.allow_from, web.hosts and web.password_hash take effect on a reload (SIGHUP), without a restart.

Lists in environment variables are comma separated. All keys are in the configuration reference.

Symptom Cause
a device gets REFUSED (EDE 18) from the node Its address is outside the allowed ranges. It is a global IPv6 address, or it is in a network that you did not add to dns.allow_from.
the page answers 403 You opened it from outside the allowed ranges. Add your network to web.allow_from.
the page answers 421 You opened it by a name that the node does not know. Use its IP address, or add the name to web.hosts.
“Refused … queries from non-LAN sources in the last hour” Port 53 is reachable from the internet. Remove the port forward.