Skip to content

ferrous-dns.toml Reference

Complete annotated reference for every option in ferrous-dns.toml. For deployment-ready starting points, see the Configuration Overview.


Loading the Config File

ferrous-dns --config path/to/ferrous-dns.toml

Or via environment variable:

FERROUS_CONFIG=path/to/ferrous-dns.toml ferrous-dns

All sections are optional

Every section and every key has a built-in default. You only need to include what you want to override.

Invalid values stop startup

The file is parsed and validated once, at startup (and again on a reload or an API save), and a bad value is reported with the key it came from instead of surfacing later as a crashed background task. Rejected values include: a bind address that is not an IP literal, a trusted_proxies entry that is not a CIDR or address, a server_secret that is neither empty nor 64 hex digits, an unknown block_mode, a local_dns_server that is not an IP address or IP:port, cache_shard_amount / cache_inflight_shards that are not a power of two of at least 2, cache_min_ttl above cache_max_ttl, and 0 for any interval, timeout, TTL or capacity whose zero would panic, spin or silently disable a component: query_timeout, cache_max_entries, cache_compaction_interval, cache_eviction_sample_size, health_check.interval / timeout, rate_limit.queries_per_second / burst_size / stale_entry_ttl_secs, the tunneling and DGA stale_entry_ttl_secs, nxdomain_hijack.probe_interval_secs / probe_timeout_ms / hijack_ip_ttl_secs, response_ip_filter.refresh_interval_secs / ip_ttl_secs, query_log_channel_capacity / query_log_max_batch_size / query_log_flush_interval_ms, client_channel_capacity, the three *_pool_max_connections, write_busy_timeout_secs, read_acquire_timeout_secs, wal_checkpoint_interval_secs, session_ttl_hours, remember_me_days, login_rate_limit_window_secs and mfa_challenge_ttl_secs. Zeros that have a documented meaning (cache_min_ttl, slip_ratio, the *_max_connections_per_ip limits, wal_autocheckpoint, sqlite_mmap_size_mb, read_busy_timeout_secs, login_rate_limit_attempts, block_ttl, queries_log_stored) stay allowed. Values too large to use are rejected too: a session_ttl_hours, remember_me_days or mfa_challenge_ttl_secs whose expiry, counted from now, lies past the year 9999 (session timestamps are stored with a four-digit year), and a query_timeout that overflows when converted to milliseconds.

Values earlier releases ran with load with a warning

Some of those values started on earlier releases, because the setting was unused or broke only the component it sized. So that an upgrade never takes the network's DNS down, the config file loads with each of them rewritten and a WARN log line naming the key, the value and what is used instead. The API still rejects every one of them.

Value in the file Loads as
A hostname in dot_bind_address / doq_bind_address / doh_bind_address while that listener is off (DoH counts as off without doh_port) Ignored: the listener inherits bind_address if you turn it on
A server_secret that is not 64 hex digits while [dns.dns_cookies] enabled = false Ignored: an ephemeral secret
An unknown cache_eviction_strategy, such as "hit-rate" "hit_rate"
A local_dns_server that is not an IP address or IP:port, such as "router.lan:53" Unset: nothing is forwarded to the router
0 for query_timeout, cache_max_entries, cache_eviction_sample_size, health_check.timeout, the three rate_limit values above, the tunneling and DGA stale_entry_ttl_secs, nxdomain_hijack.probe_timeout_ms / hijack_ip_ttl_secs, the two response_ip_filter values, query_log_max_batch_size, session_ttl_hours, remember_me_days, login_rate_limit_window_secs, or mfa_challenge_ttl_secs of 0 or less The default
A query_timeout that overflows in milliseconds, or a session_ttl_hours / remember_me_days / mfa_challenge_ttl_secs whose expiry lies past the year 9999 but can still be computed The default
0 for cache_compaction_interval with the cache or cache_optimistic_refresh off, or for nxdomain_hijack.probe_interval_secs with that detector off; an invalid cache_shard_amount / cache_inflight_shards, or cache_min_ttl above cache_max_ttl, with the cache off The default (cache_min_ttl: 0)

Everything else in the list above still stops startup, as it did before: earlier releases failed to start or crashed with it. A settings save from the dashboard or the API writes the values in use back to the file, so the rewritten cache_eviction_strategy, local_dns_server and any rewritten number it saves replace the originals there.

Saves are atomic

Dashboard and API saves write a synced temp file next to the config and rename it over the original, so a crash leaves either the old or the new file. A symlinked config is followed and its target rewritten, and the new file keeps the old one's mode, owner and group. When the file cannot be replaced — a Docker single-file bind mount, a directory the server cannot write, or an owner or group the server cannot give the new file — it is rewritten in place instead.


Quick Reference

Section Purpose Detail
[server] Ports, bind address, Pi-hole compat, PROXY Protocol Server config
[server.web_tls] HTTPS for the web dashboard and REST API Server config
[server.encrypted_dns] DoT, DoH, and DoQ server-side listeners Encrypted DNS
[auth] Session authentication for dashboard and API Security
[auth.admin] Admin username and password hash Security
[auth.webauthn] Passkey / WebAuthn relying-party settings Two-Factor Auth
[dns] Upstream fallback, timeouts, DNSSEC, privacy controls DNS & Upstreams
[[dns.pools]] Named upstream server pools with strategy and priority Upstream Management
[dns.health_check] Probes to detect and evict unhealthy upstreams Upstream Management
[dns] cache keys L1/L2 cache, eviction, and optimistic refresh Cache configuration
[dns.rate_limit] Token bucket rate limiter per client subnet Rate Limiting
[dns.tunneling_detection] Two-phase DNS tunneling detector Malware Detection
[dns.dga_detection] Domain Generation Algorithm detector Malware Detection
[dns.nxdomain_hijack] ISP NXDOMAIN hijack detection and reversal Malware Detection
[dns.response_ip_filter] Block responses resolving to known C2 IPs Malware Detection
[[dns.local_records]] Static A/AAAA records with auto-PTR DNS & Upstreams
[dns.dns_cookies] DNS Cookies anti-spoofing (RFC 7873) Security
[blocking] Ad and malware blocking via blocklists Blocking & Filtering
[dns64] NAT64 AAAA synthesis for IPv6-only clients (RFC 6147) DNS64
[logging] Log level —
[database] SQLite persistence, query log pipeline, connection pools Database configuration

[server]

Controls which ports and interfaces Ferrous DNS listens on, and enables optional compatibility and protocol features.

ferrous-dns.toml
[server]
dns_port                 = 53
web_port                 = 8080
bind_address             = "auto"
pihole_compat            = false
proxy_protocol_enabled   = false
metrics_enabled          = false
trusted_proxies          = ["127.0.0.0/8", "::1/128"]
Option Type Default Description
dns_port int 53 UDP and TCP port for DNS queries
web_port int 8080 HTTP/HTTPS port for the dashboard and REST API
bind_address str "auto" Default address every listener binds to; "auto" and "[::]" are dual-stack (IPv4 + IPv6), "0.0.0.0" is all IPv4 interfaces only. "auto" falls back to "0.0.0.0" on a kernel without IPv6. See Dual-stack
web_bind_address str (unset) Address the dashboard and REST API bind to; unset, they use bind_address. See Dashboard on its own address
pihole_compat bool false Expose Pi-hole v6 compatible API at /api/*; the Ferrous DNS native API stays at /ferrous/api/v1/*
proxy_protocol_enabled bool false Enable PROXY Protocol v2 on TCP DNS and DoT listeners
metrics_enabled bool false Serve an unauthenticated Prometheus text-exposition endpoint at /metrics on the web port
cors_allowed_origins list ["*"] Browser origins allowed to call the REST API via CORS; * allows any origin, without credentials. See CORS
trusted_proxies list ["127.0.0.0/8", "::1/128"] Reverse proxies (CIDRs or addresses) whose X-Forwarded-For / X-Real-IP name the DoH client and the address a dashboard login records; any other request is attributed to its socket peer. Setting it replaces the default. See DoH client identity

PROXY Protocol

Only enable proxy_protocol_enabled when a trusted load balancer always sits in front of Ferrous DNS. Without a load balancer, all TCP DNS connections will be rejected because the server expects a PROXY Protocol header on every connection.

See Server configuration.


[server.web_tls]

Enables HTTPS for the web dashboard and REST API. When enabled = true, HTTPS is served on web_port with automatic redirect from plain HTTP. If the cert or key files are absent at startup, the server logs a warning and falls back to plain HTTP.

ferrous-dns.toml
[server.web_tls]
enabled       = false
tls_cert_path = "/data/cert.pem"
tls_key_path  = "/data/key.pem"
Option Type Default Description
enabled bool false Enable HTTPS for the web server
tls_cert_path str "/data/cert.pem" Path to the PEM-encoded TLS certificate
tls_key_path str "/data/key.pem" Path to the PEM-encoded TLS private key

Docker paths

When running in Docker, tls_cert_path and tls_key_path must point to paths accessible from inside the container. Mount the certificate directory as a volume.


[server.encrypted_dns]

Enables DNS-over-TLS (DoT), DNS-over-HTTPS (DoH), and DNS-over-QUIC (DoQ) server-side listeners. This section is commented out by default. The certificate is used by DoT and DoQ only; if the cert or key files are missing at startup, those two are skipped with a warning while DoH and plain DNS continue normally. DoH is plain HTTP meant for a TLS-terminating reverse proxy.

ferrous-dns.toml
[server.encrypted_dns]
dot_enabled   = false
dot_port      = 853
doh_enabled   = false
# doh_port    = 443           # omit to co-host DoH on web_port
doq_enabled   = false
doq_port      = 853           # UDP port; no collision with dot_port (TCP)
tls_cert_path = "/data/cert.pem"
tls_key_path  = "/data/key.pem"
Option Type Default Description
dot_enabled bool false Enable DNS-over-TLS listener
dot_port int 853 TCP port for DoT (RFC 7858 standard: 853)
dot_bind_address str — Address for the DoT listener; inherits bind_address when omitted
doh_enabled bool false Enable the /dns-query and /dns-query/<ClientID> DoH endpoints
doh_port int — Dedicated plain-HTTP port for DoH (behind a reverse proxy); omit to co-host on web_port
doh_bind_address str — Address for the dedicated DoH listener; ignored when doh_port is omitted, since /dns-query then binds wherever the dashboard does (web_bind_address, else bind_address)
doh_allow_unregistered_ids bool false When false, requests to /dns-query/<ClientID> with an unregistered ID return 400 Bad Request; when true, valid unregistered IDs are accepted for Query Log attribution and fall back to the client IP's group rules
doq_enabled bool false Enable the DNS-over-QUIC listener
doq_port int 853 UDP port for DoQ (RFC 9250 standard: 853)
doq_bind_address str — Address for the DoQ listener; inherits bind_address when omitted
tls_cert_path str "/data/cert.pem" Path to the PEM-encoded TLS certificate for DoT and DoQ
tls_key_path str "/data/key.pem" Path to the PEM-encoded TLS private key for DoT and DoQ

See Encrypted DNS.


[auth]

Authentication settings for the dashboard and REST API. When enabled = false, all endpoints are publicly accessible without credentials.

ferrous-dns.toml
[auth]
enabled                      = true
session_ttl_hours            = 24
remember_me_days             = 30
login_rate_limit_attempts    = 5
login_rate_limit_window_secs = 900
totp_issuer                  = "Ferrous DNS"
mfa_challenge_ttl_secs       = 300
Option Type Default Description
enabled bool true Enable or disable authentication globally
session_ttl_hours int 24 Default session lifetime in hours (without "Remember Me")
remember_me_days int 30 Extended session lifetime in days with "Remember Me"
login_rate_limit_attempts int 5 Max failed login attempts before lockout
login_rate_limit_window_secs int 900 Lockout window duration in seconds (15 min)
totp_issuer str "Ferrous DNS" Issuer label shown by authenticator apps next to the TOTP account
mfa_challenge_ttl_secs int 300 Lifetime of a pending second-factor / passkey ceremony, in seconds (5 min)

See Two-Factor Authentication for the TOTP and passkey enrollment flows.


[auth.admin]

Admin credentials. The password_hash field stores an Argon2id hash. When left empty, Ferrous DNS presents a setup wizard on first access.

ferrous-dns.toml
[auth.admin]
username      = "admin"
password_hash = ""
Option Type Default Description
username str "admin" Admin username
password_hash str "" Argon2id hash; empty string triggers the setup wizard on first run

Setting the password

Set the admin password via the web setup wizard on first run — the Argon2id hash is written back to the config file automatically. To reset a forgotten password, clear this field (password_hash = "") and restart; the setup wizard runs again on next access.

See Security.


[auth.webauthn]

WebAuthn relying-party settings for passkeys. Passkeys stay inert until both rp_id and rp_origin are set — TOTP works regardless. WebAuthn requires a secure context: rp_origin must be HTTPS (or http://localhost), and rp_id must be a registrable domain the origin belongs to. A server reached by bare IP over plain HTTP cannot use passkeys, and those users rely on TOTP instead.

ferrous-dns.toml
[auth.webauthn]
rp_id     = "dns.example.com"
rp_origin = "https://dns.example.com"
Option Type Default Description
rp_id str "" Relying-party ID — the effective/registrable domain (e.g. dns.example.com, or localhost for local testing)
rp_origin str "" Full relying-party origin URL (e.g. https://dns.example.com, or http://localhost:PORT); must match how the browser reaches the dashboard

rp_origin must match the browser's address bar

Passkey registration and login fail if the origin the browser uses does not exactly match rp_origin. Use the same scheme, host, and port the user types to reach the dashboard.

See Two-Factor Authentication.


[dns]

Core DNS resolver options: upstream fallback, timeouts, DNSSEC validation, local domain handling, and privacy controls. Cache options also live under [dns] and are documented in the Cache keys section below.

ferrous-dns.toml
[dns]
upstream_servers  = []
query_timeout     = 3
default_strategy  = "Parallel"
dnssec_mode       = "Permissive"
block_private_ptr = true
block_non_fqdn    = true
malware_detection_enabled    = true
rebinding_protection_enabled = true
local_domain      = "lan"
local_dns_server  = "10.0.0.1:53"
mdns_enabled      = false
qname_case_randomization = false
Option Type Default Description
upstream_servers list [] Fallback upstream servers used when no pool matches; supports all URI schemes
query_timeout int 3 Seconds to wait for an upstream response before trying the next server
default_strategy str "Parallel" Default resolution strategy for upstream_servers: "Parallel" or "Sequential"
dnssec_mode str "Permissive" DNSSEC enforcement: "Off" (no validation), "Permissive" (validate + tag, no SERVFAIL), "Strict" (SERVFAIL on Bogus or Indeterminate). The legacy dnssec_enabled bool is still accepted (true → Permissive, false → Off)
block_private_ptr bool true Block PTR lookups for private/RFC-1918 IP ranges, except reverse zones a conditional pool answers
block_non_fqdn bool false Block queries for non-fully-qualified domain names
malware_detection_enabled bool true Master switch for malware detection: when false, none of tunneling, DGA, rebinding, NXDomain hijack or response IP detection runs, whatever its own enabled says
rebinding_protection_enabled bool true Block responses where a public domain resolves to a private/RFC-1918 IP (DNS rebinding protection); also needs malware_detection_enabled
local_domain str "lan" Local domain: short hostnames are qualified with it, and names under it are answered by local records or local_dns_server, never the upstream pools; a conditional pool for the same names takes precedence
local_dns_server str "10.0.0.1:53" Router or DHCP server used for PTR lookups, client hostname resolution and names under local_domain: IP:port, or a bare IP for port 53. A hostname is ignored with a warning, leaving local forwarding off
mdns_enabled bool false Enable the passive mDNS/Bonjour listener (UDP 5353 multicast), which names clients after the host name their device announces; requires host networking in Docker
qname_case_randomization bool false Randomize QNAME letter case on upstream queries of every record type (draft-vixie-dns-0x20) for extra anti-spoofing entropy; off because some upstreams do not preserve case

See DNS & Upstreams.


[[dns.pools]]

Named upstream server pools. Multiple pools are selected by priority order; the pool with the lowest priority value is tried first. Each pool specifies its own resolution strategy independently of default_strategy.

ferrous-dns.toml
[[dns.pools]]
name     = "cloudflare"
strategy = "Parallel"
priority = 1
servers  = [
    "https://cloudflare-dns.com/dns-query",
    "https://1.1.1.1/dns-query",
]

[[dns.pools]]
name     = "google"
strategy = "Failover"
priority = 2
servers  = [
    "tls://8.8.8.8:853",
    "tls://8.8.4.4:853",
]

# A conditional pool: only names under these domains, and nothing else.
[[dns.pools]]
name     = "gov"
strategy = "Failover"
servers  = ["udp://195.208.4.1:53"]
domains  = ["ru", "рф"]
Option Type Default Description
name str — Pool identifier used in logs and the dashboard
strategy str "Parallel" Resolution strategy: "Parallel", "Balanced", or "Failover"
priority int 1 Pool priority; lower value = higher priority
servers list [] List of upstream server URIs
domains list [] Domains the pool answers, with every name under them; such a pool is skipped for every other name. Empty for a default pool, and at least one pool must be one — see Conditional Forwarding
groups list [] Client group ids the domains are routed for; empty routes them for every client. Requires domains
internal bool false Unsigned internal zone: answers skip DNSSEC validation and rebinding protection. Requires domains

Supported URI schemes

udp://8.8.8.8:53                          Plain UDP
tcp://8.8.8.8:53                          Plain TCP
tls://1.1.1.1:853                         DNS-over-TLS
https://cloudflare-dns.com/dns-query      DNS-over-HTTPS
doq://dns.adguard-dns.com:853             DNS-over-QUIC
h3://dns.google/dns-query                 HTTP/3

Hostnames and IP addresses both work, and a bare 8.8.8.8:53 is plain UDP. udp://, tcp://, tls:// and doq:// need a port; https:// and h3:// default to 443. IPv6 goes in brackets: doq://[2a10:50c0::ad1:ff]:853. AdGuard's quic://host is written doq://host:853.

See Upstream Management.


[dns.health_check]

Periodic probes that detect and remove unhealthy upstream servers from the active pool. A server is marked unhealthy after failure_threshold consecutive failed probes, and restored after success_threshold consecutive successes.

ferrous-dns.toml
[dns.health_check]
interval           = 30
timeout            = 2000
failure_threshold  = 3
success_threshold  = 2
Option Type Default Description
interval int 30 Seconds between probes per server
timeout int 2000 Milliseconds to wait for a probe response
failure_threshold int 3 Consecutive failures before marking a server unhealthy
success_threshold int 2 Consecutive successes required to restore a server to healthy status

Cache keys under [dns]

These keys live directly under [dns] (not a sub-table). They configure the L1/L2 in-memory DNS cache, eviction strategy, and optimistic background refresh.

Basic cache options

ferrous-dns.toml
[dns]
cache_enabled                    = true
cache_ttl                        = 7200
cache_min_ttl                    = 300
cache_max_ttl                    = 86400
cache_max_entries                = 200000
cache_eviction_strategy          = "hit_rate"
cache_compaction_interval        = 600
cache_batch_eviction_percentage  = 0.1
# cache_shard_amount             = 512
# cache_inflight_shards          = 64
Option Type Default Description
cache_enabled bool true Enable the DNS response cache
cache_ttl int 7200 Default TTL in seconds when an upstream record carries none
cache_min_ttl int 300 Minimum TTL; records with lower TTLs are clamped to this value
cache_max_ttl int 86400 Maximum TTL; records with higher TTLs are clamped
cache_max_entries int 200000 Maximum number of entries in the L2 cache
cache_eviction_strategy str "hit_rate" Eviction policy: "hit_rate", "lfu", "lfu-k" or "lru" (case-insensitive). Any other value in the file runs as "hit_rate" with a warning; the API rejects it
cache_compaction_interval int 600 Seconds a renewal that failed waits for its next try; expired entries leave the cache by themselves
cache_batch_eviction_percentage float 0.1 Headroom an eviction pass makes below cache_max_entries (0.1 = a pass leaves the cache at 90% of capacity)
cache_shard_amount int auto L2 cache shard count; auto = 4 x CPU cores rounded up to next power of 2
cache_inflight_shards int auto In-flight coalescing map shard count; auto = 2 x CPU cores, rounded to power of 2 (min 8, max 128)

Optimistic refresh

Background refresh renews popular entries before they expire, keeping the cache hit rate high without cold misses.

ferrous-dns.toml
[dns]
cache_optimistic_refresh  = true
cache_refresh_threshold   = 0.75
cache_min_hit_rate        = 2.0
cache_min_frequency       = 10
cache_access_window_secs  = 43200
Option Type Default Description
cache_optimistic_refresh bool true Enable background refresh for popular entries
cache_refresh_threshold float 0.75 Renew an entry when this fraction of its TTL has elapsed, or 60 s before it expires if that comes first (the 60 s lead never pulls it before half the TTL)
cache_min_hit_rate float 2.0 Hits per minute below which an entry ranks cold: renewed after hot entries when many fall due at once, never skipped
cache_min_frequency int 10 Lifetime hits below which an entry ranks cold, as above
cache_access_window_secs int 43200 Access window in seconds for refresh eligibility (43200 = 12 hours)

LFU-K eviction parameters

Used when cache_eviction_strategy is "lfu-k".

ferrous-dns.toml
[dns]
cache_min_lfuk_score     = 1.5
Option Type Default Description
cache_min_lfuk_score float 1.5 Minimum LFU-K score threshold for eviction candidates

See Cache configuration.


[dns.rate_limit]

Token bucket rate limiter applied per client subnet. Protects against query floods without impacting normal traffic. Separate budgets are enforced for NXDOMAIN-heavy clients.

ferrous-dns.toml
[dns.rate_limit]
enabled                    = true
queries_per_second         = 1000
burst_size                 = 500
ipv4_prefix_len            = 24
ipv6_prefix_len            = 48
whitelist                  = []
nxdomain_per_second        = 50
slip_ratio                 = 2
dry_run                    = false
tcp_max_connections_per_ip = 30
dot_max_connections_per_ip = 15
doq_max_connections_per_ip = 15
stale_entry_ttl_secs       = 300

The budgets apply per subnet, once for UDP and once for the stream transports (TCP, DoT, DoH, DoQ).

Option Type Default Description
enabled bool true Enable the rate limiter
queries_per_second int 1000 Sustained query budget per client subnet
burst_size int 500 Maximum burst above the sustained rate
ipv4_prefix_len int 24 Group IPv4 clients by this prefix length (e.g. /24 subnet)
ipv6_prefix_len int 48 Group IPv6 clients by this prefix length (e.g. /48 subnet)
whitelist list [] CIDRs exempt from rate limiting
nxdomain_per_second int 50 Stricter per-subnet budget charged for NXDOMAIN answers; only an NXDOMAIN answer over it is limited, never the subnet's other queries. local_dns_server and internal pool answers are not charged. 0 = no NXDOMAIN budget
slip_ratio int 2 1 in N rate-limited UDP responses sends TC=1 to force a TCP retry; stream transports are refused instead
dry_run bool false Log rate limit events without enforcing them
tcp_max_connections_per_ip int 30 Maximum concurrent TCP DNS connections per client IP
dot_max_connections_per_ip int 15 Maximum concurrent DoT connections per client IP
doq_max_connections_per_ip int 15 Maximum concurrent DoQ connections per client IP
stale_entry_ttl_secs int 300 Seconds of inactivity before a token bucket entry is evicted

See Rate Limiting.


[dns.tunneling_detection]

Two-phase DNS tunneling detector. Phase 1 runs on the hot path in O(1) time, checking FQDN length, label length, and NULL query type. Phase 2 runs statistical analysis in the background (Shannon entropy, query rate, unique subdomains, record type proportions).

Also in the dashboard, and range-checked

This section, [dns.dga_detection], [dns.nxdomain_hijack], [dns.response_ip_filter] and the malware_detection_enabled and rebinding_* keys of [dns] are also edited in Settings → Malware Detection. Saving there rewrites them in this file; like every key here, they take effect after a restart.

The API rejects a value outside the range given in the tables below. A file loaded at startup is more forgiving, so an older file still starts: a threshold above its maximum loads as the maximum (the signal could not fire there either), a zero, negative or nan one loads as the default, and an invalid feed URL is dropped, each with a warning naming the key.

No exemption lists here

Earlier releases read domain_whitelist and client_whitelist in this section and in [dns.dga_detection], and rebinding_allowlist in [dns]. A file that still has them loads with a warning naming each list and its entries, and the next save from the dashboard removes them. A domain is now exempted by an allow in DNS Filter, and a client by a group with Malware Detection off: see Exemptions.

ferrous-dns.toml
[dns.tunneling_detection]
enabled                      = true
action                       = "block"
max_fqdn_length              = 120
max_label_length             = 50
block_null_queries           = true
entropy_threshold            = 3.8
query_rate_per_apex          = 50
unique_subdomain_threshold   = 30
txt_proportion_threshold     = 0.05
nxdomain_ratio_threshold     = 0.20
confidence_threshold         = 0.7
stale_entry_ttl_secs         = 300
Option Type Default Description
enabled bool true Enable tunneling detection
action str "block" Action on detection: "alert" (log only) or "block" (answer with the [blocking] block_mode). A file with "throttle", which older releases ran as "alert", loads as "alert" with a warning
max_fqdn_length int 120 Phase 1: FQDNs longer than this are blocked immediately. 1–253
max_label_length int 50 Phase 1: labels longer than this are blocked immediately. 1–63
block_null_queries bool true Phase 1: block NULL (type 10) queries
entropy_threshold float 3.8 Phase 2: Shannon entropy in bits/char above which a domain is flagged. Above 0, at most 8
query_rate_per_apex int 50 Phase 2: queries per minute per client+apex pair above which a domain is flagged. At least 1
unique_subdomain_threshold int 30 Phase 2: unique subdomains per minute before flagging. At least 1
txt_proportion_threshold float 0.05 Phase 2: TXT query proportion above 5% triggers a flag. Above 0, at most 1
nxdomain_ratio_threshold float 0.20 Phase 2: NXDOMAIN ratio above 20% triggers a flag. Above 0, at most 1
confidence_threshold float 0.7 Phase 2: minimum combined confidence score required to act. Above 0, at most 1
stale_entry_ttl_secs int 300 Seconds of inactivity before a tracking entry is evicted. At least 1

See Malware Detection.


[dns.dga_detection]

Detects Domain Generation Algorithm domains used by malware families such as Conficker, Mirai, and Emotet. Phase 1 runs weighted mini-scoring on the hot path (entropy, consonant ratio, digit ratio, length). Phase 2 runs n-gram language model scoring in the background.

ferrous-dns.toml
[dns.dga_detection]
enabled                       = true
action                        = "block"
hot_path_confidence_threshold = 0.40
sld_entropy_threshold         = 3.5
sld_max_length                = 24
consonant_ratio_threshold     = 0.75
digit_ratio_threshold         = 0.3
ngram_score_threshold         = 0.6
dga_rate_per_client           = 10
confidence_threshold          = 0.65
stale_entry_ttl_secs          = 300
Option Type Default Description
enabled bool true Enable DGA detection
action str "block" Action on detection: "alert" (log only) or "block" (answer with the [blocking] block_mode)
hot_path_confidence_threshold float 0.40 Phase 1: hot-path score threshold; typically requires 2 or more signals. Above 0, at most 1
sld_entropy_threshold float 3.5 Shannon entropy of the second-level domain. Above 0, at most 8
sld_max_length int 24 Maximum SLD character length before the domain is considered suspicious. 1–63
consonant_ratio_threshold float 0.75 Consonant fraction of the SLD above which the domain is flagged. Above 0, at most 1
digit_ratio_threshold float 0.3 Digit fraction of the SLD above which the domain is flagged. Above 0, at most 1
ngram_score_threshold float 0.6 Phase 2: n-gram language model score threshold. Above 0, at most 1
dga_rate_per_client int 10 DGA-flagged queries per minute per client before action is escalated. At least 1
confidence_threshold float 0.65 Phase 2: minimum combined confidence score required to act. Above 0, at most 1
stale_entry_ttl_secs int 300 Seconds of inactivity before a tracking entry is evicted. At least 1

See Malware Detection.


[dns.nxdomain_hijack]

Detects ISPs that intercept NXDOMAIN responses and substitute advertising IP addresses. Background probes test each upstream with random .invalid domains (RFC 6761). Discovered hijack IPs are recorded, and any hot-path response containing them is converted back to a proper NXDOMAIN.

ferrous-dns.toml
[dns.nxdomain_hijack]
enabled              = true
action               = "block"
probe_interval_secs  = 300
probe_timeout_ms     = 5000
probes_per_round     = 3
hijack_ip_ttl_secs   = 3600
Option Type Default Description
enabled bool true Enable NXDOMAIN hijack detection
action str "block" "alert" to log only; "block" to convert hijacked responses back to NXDOMAIN
probe_interval_secs int 300 Seconds between probe rounds per upstream server. At least 1
probe_timeout_ms int 5000 Milliseconds to wait for a probe response. At least 1
probes_per_round int 3 Number of probe queries sent per upstream per round. 1–255; a file with 0, which never probed, loads with the detector off
hijack_ip_ttl_secs int 3600 Seconds before an unconfirmed hijack IP entry is evicted. At least 1

See Malware Detection.


[dns.response_ip_filter]

Blocks DNS responses that resolve to known command-and-control server IP addresses. Downloads IP threat feeds and checks every DNS response. Disabled by default — opt-in.

ferrous-dns.toml
[dns.response_ip_filter]
enabled                 = false
action                  = "block"
ip_list_urls            = []
refresh_interval_secs   = 86400
ip_ttl_secs             = 604800
Option Type Default Description
enabled bool false Enable response IP filtering (opt-in). Needs at least one URL in ip_list_urls: the API rejects it without one, and a file load turns it off with a warning
action str "block" "alert" to log only; "block" to answer with the [blocking] block_mode
ip_list_urls list [] Feed URLs starting with http:// or https://; one IP per line, # comments are supported. A feed over 64 MiB is skipped with a warning
refresh_interval_secs int 86400 Seconds between feed refreshes (24 hours). At least 1
ip_ttl_secs int 604800 Seconds before an IP entry expires if not re-confirmed by a feed refresh (7 days). At least 1

Example feeds

https://feodotracker.abuse.ch/downloads/ipblocklist.txt
https://sslbl.abuse.ch/blacklist/sslipblacklist.txt

See Malware Detection.


[[dns.local_records]]

Static A or AAAA records served directly from the cache, bypassing upstream entirely. An automatic PTR record is generated for every non-wildcard record.

ferrous-dns.toml
[[dns.local_records]]
hostname    = "nas"
domain      = "local"
ip          = "192.168.1.50"
record_type = "A"
ttl         = 300

[[dns.local_records]]
hostname    = "printer"
domain      = "local"
ip          = "192.168.1.51"
record_type = "A"
ttl         = 300
Option Type Default Description
hostname str — Hostname without the domain suffix
domain str — Domain suffix (e.g. "local", "lan")
ip str — IP address literal: IPv4 for A, IPv6 for AAAA
record_type str — Record type: "A" or "AAAA" (case-insensitive)
ttl int 300 TTL in seconds

A record with an unparseable ip, an unknown record_type, or an address of the wrong family for its type is skipped when the file is loaded, with a warning naming it; the other records still load.

See DNS & Upstreams.


[blocking]

DNS-based ad and malware blocking using downloaded blocklists. Blocklists, and per-domain blocks and allows, are managed through the dashboard or the REST API, not in this file.

ferrous-dns.toml
[blocking]
enabled        = true
block_mode     = "null_ip"
block_ttl      = 60
# sinkhole_ipv4 = "192.168.1.2"
# sinkhole_ipv6 = "fd00::2"
Option Type Default Description
enabled bool true Enable DNS blocking globally
block_mode string "null_ip" How blocked domains are answered: null_ip (cacheable 0.0.0.0/::, recommended), nxdomain, nodata, or refused (legacy, non-cacheable)
block_ttl int 60 TTL in seconds clients/resolvers cache a blocked answer; also drives the synthetic SOA minimum for nxdomain/nodata
sinkhole_ipv4 string (unset) Custom A target for null_ip blocks (e.g. a LAN block-page server); unset returns 0.0.0.0. See Custom Sinkhole IP
sinkhole_ipv6 string (unset) Custom AAAA target for null_ip blocks; unset returns ::

Restart required

block_mode, block_ttl, sinkhole_ipv4, and sinkhole_ipv6 are applied at startup; changing them needs a server restart. See Block Response Mode for what each mode returns.

See Blocking & Filtering.


[dns64]

NAT64 AAAA synthesis (RFC 6147). Synthesizes AAAA records for IPv4-only domains so IPv6-only clients can reach them through a NAT64 gateway. Requires a NAT64 gateway on the network — without one, IPv6-only clients break. Applied at startup; changes need a restart.

ferrous-dns.toml
[dns64]
enabled = false
prefix  = "64:ff9b::/96"
Option Type Default Description
enabled bool false Enable DNS64 AAAA synthesis; only turn on with a NAT64 gateway present. May be omitted (off)
prefix str "64:ff9b::/96" NAT64 prefix; only /96 is supported (well-known prefix per RFC 6052)

See DNS64.


[dns.dns_cookies]

DNS Cookies (RFC 7873) anti-spoofing. The server echoes an HMAC-SHA256 server cookie on every response so clients can verify they are talking to the same server, mitigating UDP spoofing and amplification abuse. Enabled by default.

ferrous-dns.toml
[dns.dns_cookies]
enabled              = true
server_secret        = ""
secret_rotation_secs = 3600
require_valid_cookie = false
Option Type Default Description
enabled bool true Enable DNS Cookies. When false no response carries a COOKIE option
server_secret str "" (ephemeral) 64-char hex (32 bytes) secret so cookies survive restarts; generate with openssl rand -hex 32. Empty uses an ephemeral secret regenerated on each restart. Any other value stops startup while cookies are enabled, and is ignored with a warning while they are off
secret_rotation_secs int 3600 Length of a rotation window: each window signs cookies with its own key, and the previous window's is still accepted. 0 = no rotation; otherwise at least 60 (a shorter window loads as 0, with a warning)
require_valid_cookie bool false Strict mode: a UDP query without a valid cookie gets BADCOOKIE (with a fresh cookie) or REFUSED, with EDE 18; TCP, DoT, DoH and DoQ are not checked. Only enable when every UDP client supports RFC 7873

A COOKIE option whose length RFC 7873 does not allow (anything but 8 or 16–40 bytes) is answered with FORMERR, whatever these settings say.

Do not commit a shared server_secret

Leave server_secret empty (ephemeral) or generate a unique value per deployment. A fixed secret baked into an image means every install shares the same cookie key, defeating the anti-spoofing guarantee.

Nested under [dns]

A top-level [dns_cookies] table is silently ignored — the section must be [dns.dns_cookies].

See Security.


[logging]

ferrous-dns.toml
[logging]
level = "info"
Option Type Default Description
level str "info" Log verbosity: "error", "warn", "info", "debug", or "trace"

debug and trace levels

debug and trace are verbose and should only be used for troubleshooting. They emit hot-path events on every DNS query and may measurably impact throughput on high-load deployments.


[database]

SQLite persistence for query logs, client records, blocklists, groups, and settings. The write pipeline is fully async so disk I/O never blocks the DNS hot path.

Basic options

ferrous-dns.toml
[database]
path                      = "ferrous-dns.db"
log_queries               = true
queries_log_stored        = 30
client_tracking_interval  = 60
Option Type Default Description
path str "ferrous-dns.db" Path to the SQLite database file. The last download of each blocklist is kept in a lists directory beside it
log_queries bool true Store every DNS query for analytics and the query log dashboard
queries_log_stored int 30 Days to retain query log entries. Cleanup runs every 4 hours, the first time 10 minutes after startup, in 1000-row batches paced so other writers are not blocked; 0 deletes every entry at each run
client_tracking_interval int 60 Minimum seconds between consecutive last-seen writes for the same client IP

Query-log write pipeline

ferrous-dns.toml
[database]
query_log_channel_capacity  = 10000
query_log_max_batch_size    = 500
query_log_flush_interval_ms = 100
query_log_sample_rate       = 1
client_channel_capacity     = 4096
Option Type Default Description
query_log_channel_capacity int 10000 Async channel buffer size in entries
query_log_max_batch_size int 500 Maximum entries per INSERT transaction
query_log_flush_interval_ms int 100 Milliseconds between flush cycles
query_log_sample_rate int 1 Log 1 out of every N queries; 1 = log all, 10 = log 1 in 10
client_channel_capacity int 4096 Async channel buffer size for client last-seen updates

Connection pools

ferrous-dns.toml
[database]
write_pool_max_connections       = 2
read_pool_max_connections        = 4
query_log_pool_max_connections   = 2
write_busy_timeout_secs          = 30
read_busy_timeout_secs           = 15
read_acquire_timeout_secs        = 15
Option Type Default Description
write_pool_max_connections int 2 Maximum connections in the write pool
read_pool_max_connections int 4 Maximum connections in the read pool
query_log_pool_max_connections int 2 Maximum connections in the query-log write pool
write_busy_timeout_secs int 30 Seconds to wait for the write lock before returning an error
read_busy_timeout_secs int 15 Seconds to wait for a read connection before returning an error
read_acquire_timeout_secs int 15 Seconds to wait to acquire a connection from the read pool

SQLite tuning

ferrous-dns.toml
[database]
wal_autocheckpoint             = 0
wal_checkpoint_interval_secs   = 120
sqlite_cache_size_kb           = 16384
sqlite_mmap_size_mb            = 64
Option Type Default Description
wal_autocheckpoint int 0 SQLite WAL autocheckpoint threshold in pages; 0 disables automatic checkpointing (a background job manages it instead)
wal_checkpoint_interval_secs int 120 Seconds between WAL checkpoint runs by the background job: a PASSIVE pass, then a TRUNCATE once the WAL has grown past 64 MiB
sqlite_cache_size_kb int 16384 SQLite page cache size in KB (default: 16 MB)
sqlite_mmap_size_mb int 64 Memory-mapped I/O size in MB; 0 disables mmap

See Database configuration.