Upstream Management¶
Ferrous DNS gives you full control over how DNS queries are forwarded to the internet — which servers to use, how to balance load between them, what to do when one fails, and how to monitor their health.
Upstream URL Formats¶
All upstream servers are specified as URLs. Every major DNS transport protocol is supported, and every one of them takes a hostname or an IP address — you never need to use bare IP addresses:
| Protocol | Format | Example | Port |
|---|---|---|---|
| Plain UDP | udp://host:port | udp://8.8.8.8:53 | required, usually 53 |
| Plain TCP | tcp://host:port | tcp://8.8.8.8:53 | required, usually 53 |
| DNS-over-HTTPS (DoH) | https://host[:port]/path | https://cloudflare-dns.com/dns-query | optional, defaults to 443 |
| DNS-over-TLS (DoT) | tls://host:port | tls://dns.google:853 | required, usually 853 |
| DNS-over-QUIC (DoQ) | doq://host:port | doq://dns.adguard-dns.com:853 | required, usually 853 |
| HTTP/3 | h3://host[:port]/path | h3://dns.google/dns-query | optional, defaults to 443 |
A bare IP:PORT with no scheme, such as 8.8.8.8:53, is plain UDP. An IPv6 address goes in brackets, as in any URL: doq://[2a10:50c0::ad1:ff]:853, https://[2606:4700:4700::1111]/dns-query.
An address Ferrous DNS cannot read is rejected at startup, by the configuration API, and by the Settings page before it saves, with a message that says how to fix it — for example missing port — DNS-over-QUIC usually uses 853, e.g. doq://dns.adguard-dns.com:853.
Hostname or IP address?¶
Both work. For the encrypted protocols (DoT, DoQ, DoH, HTTP/3), prefer the hostname:
- It is the name the server's TLS certificate is checked against, and it is sent as SNI during the handshake. With an IP address, the certificate must list that IP.
- Some providers identify your account or device by the hostname you connect to, such as AdGuard DNS private servers (
doq://<device-id>.d.adguard-dns.com:853). An IP address loses that.
Coming from AdGuard¶
AdGuard Home and the AdGuard DNS dashboard write DNS-over-QUIC as quic://host, usually without a port. Ferrous DNS uses doq:// and needs the port:
| AdGuard shows | Write in Ferrous DNS |
|---|---|
quic://dns.adguard-dns.com | doq://dns.adguard-dns.com:853 |
quic://<device-id>.d.adguard-dns.com | doq://<device-id>.d.adguard-dns.com:853 |
tls://dns.adguard-dns.com | tls://dns.adguard-dns.com:853 |
https://dns.adguard-dns.com/dns-query | unchanged |
How hostnames are resolved¶
servers = [
"doq://dns.adguard-dns.com:853", # looked up at startup, when pools are saved, and again when its TTL runs out
"https://dns.google/dns-query",
]
Ferrous DNS looks upstream hostnames up when it starts and whenever the pools are saved, and uses up to four addresses per family:
local_dns_server, when set: your router is asked for the A and AAAA records, with the same anti-spoofing checks as every query sent to it.- The system resolver (the host's
/etc/resolv.conf/ OS resolver), whenlocal_dns_serveris unset, does not answer within two seconds, or has no address for the name.
The router comes first so that upstream hostnames keep resolving on a machine that uses Ferrous DNS as its own resolver. There, the system lookup can never succeed: nothing answers it while Ferrous DNS starts, and afterwards Ferrous DNS has no resolved upstream to ask. One consequence: when the router answers, an /etc/hosts entry for an upstream hostname is not consulted.
Each hostname is looked up again when its answer's TTL runs out, held between 60 seconds and one hour. An answer from the system resolver, which reports no TTL, is kept for five minutes. When the addresses changed, the new ones replace the old in every pool that lists the server, and the log shows Upstream hostname now resolves to new addresses; otherwise nothing changes, and the server keeps its health state. A provider that moves to new IPs is therefore followed without a restart.
An address this host has no route to is never dialed. This is typically an AAAA address in a Docker container without IPv6. The health check notices before it sends anything and takes the address out of rotation at once. The dashboard shows it as No route, with a notice on the Upstream card, and the log has No route from this host to the server; left out until it has one. The server's status comes from its other addresses, so it reads Healthy, not Partial. Every health check looks again, and the address rejoins as soon as the host has a route to it.
If the lookup fails
The log shows Failed to resolve upstream hostname, retrying in the background. Ferrous DNS looks it up again at the health-check interval, doubling the wait up to five minutes while it keeps failing, with no restart needed. A server that resolved before keeps the addresses it had meanwhile. One that never resolved has none: udp://, tcp://, tls:// and doq:// servers fail every query with has no IP address yet, which Settings > System Status shows for that server, and https:// and h3:// also try the system resolver when a query needs them. See Troubleshooting.
Upstream Pools¶
Pools are named groups of upstream servers with a shared resolution strategy and priority. You can define as many pools as you need.
[[dns.pools]]
name = "primary"
strategy = "Parallel"
priority = 1
servers = [
"doq://dns.adguard-dns.com:853",
"https://cloudflare-dns.com/dns-query",
"https://dns.google/dns-query",
]
[[dns.pools]]
name = "fallback"
strategy = "Failover"
priority = 2
servers = [
"udp://8.8.8.8:53",
"udp://1.1.1.1:53",
]
| Field | Description |
|---|---|
name | Unique identifier for the pool |
strategy | How queries are distributed across servers in this pool |
priority | Lower number = higher priority. The highest-priority pool with at least one healthy server is always used |
servers | List of upstream server URLs |
domains | Domains the pool answers, with every name under them: a conditional pool, skipped for every other name. See Conditional Forwarding |
groups | Client group ids a conditional pool's domains are routed for; empty for every client |
internal | A conditional pool for an unsigned internal zone: no DNSSEC validation, no rebinding protection, and its NXDOMAINs never spend the NXDOMAIN budget or count toward tunneling detection |
Pool Routing¶
When a query arrives, Ferrous DNS first checks the conditional pools. If one answers the name, for the client's group or for every client, only that pool is asked. If it cannot answer, the client gets SERVFAIL; the name is never retried on another pool.
Every other name goes to the default pools, those without domains. Ferrous DNS selects the pool with:
- The lowest priority number (highest priority)
- At least one healthy upstream in rotation
If all servers in pool 1 are down, queries automatically fall through to pool 2 — no configuration changes required.
Query arrives
│
▼
Pool 1 (priority=1) — any healthy server? → YES → use pool 1
→ NO ↓
Pool 2 (priority=2) — any healthy server? → YES → use pool 2
→ NO ↓
upstream_servers fallback (if configured)
A server that answers with an error code (SERVFAIL, REFUSED, NOTIMP, FORMERR) has declined the query, so it counts as a failed attempt, like a timeout. Every strategy moves on to its next server, and a pool whose servers all decline falls through to the next pool. Such a reply is never cached and never replaces a cached answer during a refresh. When every server in every pool answered SERVFAIL, a renewal ahead of expiry is retried once, halfway through the life the cached entry has left, since that is usually transient. NXDOMAIN and NODATA are answers, so they are returned as they are and trigger no failover.
Resolution Strategies¶
Each pool has an independent strategy that controls how its servers are used.
Parallel — Lowest Cache-Miss Latency¶
Queries all servers simultaneously and returns the first successful response. Slower responses are discarded.
[[dns.pools]]
name = "parallel-pool"
strategy = "Parallel"
priority = 1
servers = [
"doq://dns.adguard-dns.com:853",
"https://cloudflare-dns.com/dns-query",
"https://dns.google/dns-query",
]
How it works:
Query "example.com"
│
├──► Server A ──► responds in 8ms ← returned to client
├──► Server B ──► responds in 12ms ← discarded
└──► Server C ──► responds in 15ms ← discarded
Client gets the answer in 8ms (fastest server wins)
Best for: Production environments where cache-miss latency matters. The cost is extra upstream traffic — each query hits all servers simultaneously.
Tip
Use 2–4 servers per Parallel pool. More than 4 adds diminishing returns while increasing upstream load.
Balanced — Even Load Distribution¶
Distributes queries in round-robin across all healthy servers. If a server fails a health check, it is temporarily removed from the rotation and restored automatically when it recovers.
[[dns.pools]]
name = "balanced-pool"
strategy = "Balanced"
priority = 1
servers = [
"https://cloudflare-dns.com/dns-query",
"https://dns.google/dns-query",
"https://dns.quad9.net/dns-query",
"tls://1.1.1.1:853",
]
How it works:
Query 1 → Server A
Query 2 → Server B
Query 3 → Server C
Query 4 → Server A (Server D is down — skipped)
Query 5 → Server B
...
Best for: High-volume deployments where you want to spread load across multiple providers without hammering all of them on every query.
Failover — Primary/Backup¶
Uses the first server in the list as the primary. Falls over to the next server only if the primary fails. Returns to the primary as soon as it recovers.
[[dns.pools]]
name = "failover-pool"
strategy = "Failover"
priority = 1
servers = [
"doq://dns.adguard-dns.com:853", # primary — always used when healthy
"https://cloudflare-dns.com/dns-query", # first fallback
"udp://8.8.8.8:53", # last resort
]
How it works:
Normal state: all queries → Server A (primary)
Server A fails: all queries → Server B (first fallback)
Server A recovers: all queries → Server A (back to primary)
Best for: Scenarios where you have a preferred upstream (e.g. your ISP's DNS, a NextDNS profile, or an internal resolver) and want a backup only when it's unavailable.
Combining Strategies¶
You can use different strategies in different pools. A common setup:
# Pool 1: Parallel encrypted upstreams for speed
[[dns.pools]]
name = "encrypted"
strategy = "Parallel"
priority = 1
servers = [
"doq://dns.adguard-dns.com:853",
"https://cloudflare-dns.com/dns-query",
"https://dns.google/dns-query",
]
# Pool 2: Failover to plain UDP if encrypted upstreams are unreachable
[[dns.pools]]
name = "plain-fallback"
strategy = "Failover"
priority = 2
servers = [
"udp://8.8.8.8:53",
"udp://1.1.1.1:53",
]
With this setup, all queries go through encrypted DoQ/DoH when available. If all three encrypted servers are simultaneously unreachable (network issue, firewall block), queries automatically fall back to plain UDP — so DNS never fully breaks.
Health Checks¶
Ferrous DNS continuously monitors every upstream server. Unhealthy servers are removed from rotation and restored automatically when they recover.
[dns.health_check]
interval = 30 # seconds between probes per server
timeout = 2000 # milliseconds to wait for a probe response
failure_threshold = 3 # consecutive failures before marking unhealthy
success_threshold = 2 # consecutive successes to restore a server
| Option | Default | Description |
|---|---|---|
interval | 30 | Seconds between health probes per server |
timeout | 2000 | Milliseconds to wait for a probe response |
failure_threshold | 3 | Consecutive failures before marking a server unhealthy |
success_threshold | 2 | Consecutive successes required to restore a server to rotation |
Health check flow:
Server A: probe every 30s
3 consecutive failures → marked UNHEALTHY → removed from rotation
↓
Health probes continue
↓
2 consecutive successes → marked HEALTHY → restored to rotation
The health checker runs independently of query traffic, so a flaky server is detected and removed without clients ever seeing a failed response — the pool routes around it transparently.
If every server in every pool is marked unhealthy at once, Ferrous DNS fails open and queries them anyway, in pool priority order, until a probe marks one healthy again. The checker can lag reality — a network change after boot, or probes that fail while real queries would succeed — and refusing every query would turn a stale verdict into a total outage. Entering and leaving this state is logged once each (No upstream server is marked healthy; querying all servers anyway).
An answer that came back truncated over UDP and was retried over TCP is attributed to the configured server with a (tcp retry) suffix, e.g. udp://9.9.9.9:53 (tcp retry), in the query log and upstream statistics.
The current state of every pool and server is shown on the dashboard under Settings > System Status:

Global Fallback Upstreams¶
upstream_servers is a flat list used when no pool matches or as a global fallback. It uses default_strategy for resolution.
For most deployments, pools with explicit priorities are preferable to a flat upstream_servers list — they give you more control over failover behavior.
Query Timeout¶
If an upstream does not respond within query_timeout seconds, the query is considered failed for that server and the next server in the strategy is tried (for Failover) or the response is returned from whichever server answered first (for Parallel and Balanced).
Recommended Configurations¶
Home / Small Office¶
Fast encrypted DNS with a plain UDP safety net:
[dns]
query_timeout = 3
dnssec_mode = "Permissive"
default_strategy = "Parallel"
[[dns.pools]]
name = "secure"
strategy = "Parallel"
priority = 1
servers = [
"doq://dns.adguard-dns.com:853",
"https://cloudflare-dns.com/dns-query",
"https://dns.google/dns-query",
]
[[dns.pools]]
name = "fallback"
strategy = "Failover"
priority = 2
servers = [
"udp://8.8.8.8:53",
"udp://1.1.1.1:53",
]
[dns.health_check]
interval = 30
timeout = 2000
failure_threshold = 3
success_threshold = 2
High-Throughput / Enterprise¶
Balanced load across multiple providers with automatic failover:
[dns]
query_timeout = 2
dnssec_mode = "Permissive"
default_strategy = "Balanced"
[[dns.pools]]
name = "primary"
strategy = "Balanced"
priority = 1
servers = [
"doq://dns.adguard-dns.com:853",
"https://cloudflare-dns.com/dns-query",
"https://dns.google/dns-query",
"https://dns.quad9.net/dns-query",
"tls://1.1.1.1:853",
"tls://8.8.8.8:853",
]
[[dns.pools]]
name = "emergency"
strategy = "Failover"
priority = 2
servers = [
"udp://8.8.8.8:53",
"udp://1.1.1.1:53",
"udp://9.9.9.9:53",
]
[dns.health_check]
interval = 15
timeout = 1000
failure_threshold = 2
success_threshold = 1
Internal Network (Split DNS)¶
Route internal domains to the internal resolver, everything else to DoH:
[dns]
query_timeout = 3
[[dns.pools]]
name = "public"
strategy = "Parallel"
priority = 1
servers = [
"https://cloudflare-dns.com/dns-query",
"https://dns.google/dns-query",
]
[[dns.pools]]
name = "corp"
strategy = "Failover"
servers = ["udp://10.0.0.10:53", "udp://10.0.0.11:53"] # internal AD/DNS servers
domains = ["corp", "10.in-addr.arpa"]
internal = true
Queries for corp, every name under it, and reverse lookups in 10.0.0.0/8 go to the internal servers; everything else uses the public pool.
When each office has its own DNS server for the same corporate domain, give each office's client group its own pool. Each group gets its own office's answers, cached apart from the other offices':
[[dns.pools]]
name = "office-a"
strategy = "Failover"
servers = ["udp://10.1.0.10:53"]
domains = ["corp"]
groups = [2] # the "Office A" client group
internal = true
[[dns.pools]]
name = "office-b"
strategy = "Failover"
servers = ["udp://10.2.0.10:53"]
domains = ["corp"]
groups = [3] # the "Office B" client group
internal = true
Public Resolver Reference¶
For a complete list of public resolvers with DoH, DoT, and DoQ URLs, see Encrypted DNS — Public Resolver Reference.