Installation¶
Ferrous DNS can be deployed via Docker (recommended), Docker Compose, or built from source.
Linux (amd64/arm64) is the supported platform. There is no native Windows or macOS binary — see Windows (WSL2) and Platform support.
Docker¶
The fastest way to get started:
docker run -d \
--name ferrous-dns \
--restart always \
--network host \
--user 1000:1000 \
-e TZ=America/Sao_Paulo \
-e FERROUS_CONFIG=/data/config/ferrous-dns.toml \
-v ferrous-data:/data/ \
--dns 10.0.0.1 \
--cap-add NET_BIND_SERVICE \
ferrousnetworking/ferrous-dns:latest
No host config file is needed to start: on first run the entrypoint copies the bundled default ferrous-dns.toml into /data/config/ inside the ferrous-data volume. Ports, bind address, database path, and log level are all set inside that file, and can be overridden with the FERROUS_* environment variables below — the Docker image's entrypoint script translates them into the matching CLI flags at startup.
Environment Variables¶
| Variable | Default | Description |
|---|---|---|
FERROUS_CONFIG | — | Path to TOML config file (optional) |
FERROUS_DNS_PORT | 53 | DNS server port |
FERROUS_WEB_PORT | 8080 | Web dashboard port |
FERROUS_BIND_ADDRESS | — | Bind address (server.bind_address; web_bind_address is left as it is). When unset, the config file decides (auto in the bundled one). 0.0.0.0 is ignored: see Docker bind address |
FERROUS_DATABASE | — | SQLite database path. When unset, [database] path applies (/data/ferrous-dns.db) |
FERROUS_LOG_LEVEL | info | Log level: debug, info, warn, error |
Access the dashboard at http://localhost:8080
Network mode
--network host is required so Ferrous DNS can bind to port 53 and detect client IPs/MACs correctly. It is also required for mDNS device discovery (mdns_enabled): multicast on UDP 5353 does not traverse Docker bridge port mapping, so the listener only works in host mode. On macOS, host networking is not available in Docker Desktop — use a Linux VM or Docker Compose with explicit port mappings.
Keeping the config file on the host (optional)¶
Editing ferrous-dns.toml by hand is easier when the file lives on the host rather than inside the volume. Bind-mounting it takes two extra steps, both mandatory:
curl -fsSL -o ferrous-dns.toml \
https://raw.githubusercontent.com/ferrous-networking/ferrous-dns/main/ferrous-dns.toml
chown 1000:1000 ferrous-dns.toml
Only then add the mount:
Create the file before mounting it
Docker creates the source of a bind mount as a root-owned directory when the host path does not exist. Mounting a path you have not created yet therefore puts a directory at /data/config/ferrous-dns.toml, and the container — which runs as uid 1000 — cannot write it, so it exits and --restart always turns that into a restart loop. Keep the mount writable too (no :ro): the first-run setup wizard, POST /config from the dashboard, and backup restore all persist changes back to this file.
Health check¶
The image's HEALTHCHECK runs /entrypoint.sh --healthcheck every 10 seconds. The entrypoint turns the FERROUS_* variables into flags, as it does for the server, and runs ferrous-dns --healthcheck, which calls GET /ferrous/api/v1/health on the web port. The container is healthy once the server answers 200, and unhealthy after three failed probes in a row: the web server not answering, or the DNS listener down. A first start gets two minutes before failures count.
The probe runs beside the server, not through its command line. Set ports and the bind address in the config file or with the FERROUS_* variables: flags passed in a compose command: do not reach the probe, which then checks the wrong port.
Docker Compose¶
Create a docker-compose.yml:
services:
ferrous-dns:
image: ferrousnetworking/ferrous-dns:latest
container_name: ferrous-dns
restart: always
network_mode: host
user: "1000:1000"
environment:
- FERROUS_CONFIG=/data/config/ferrous-dns.toml
- TZ=America/Sao_Paulo
dns:
- 10.0.0.1
cap_add:
- NET_BIND_SERVICE
volumes:
- ferrous-data:/data/
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
volumes:
ferrous-data:
To keep the config on the host, follow Keeping the config file on the host first, then add - ./ferrous-dns.toml:/data/config/ferrous-dns.toml to volumes:. The logging: block caps the container log at three 10 MB files; without it Docker keeps every line the server writes.
Then start it:
Windows (WSL2)¶
There is no native Windows build. Ferrous DNS's UDP hot path relies on Linux-only socket APIs (SO_REUSEPORT for the per-core listeners, IP_PKTINFO / IPV6_PKTINFO for source-address selection, recvmmsg for batched receives), so on Windows it runs inside WSL2 — either the Linux binary directly or the Docker image via Docker Desktop's WSL2 backend.
The catch is networking, not the build: by default WSL2 sits behind NAT with its own IP, so devices on your LAN cannot reach port 53 inside it. netsh interface portproxy does not solve this — it forwards TCP only, and DNS is primarily UDP. Network-wide blocking therefore requires WSL's mirrored networking mode.
1. Requirements¶
- Windows 11 22H2 (build 22621) or newer — mirrored networking does not exist on Windows 10.
- WSL 2.0.9+ (check with
wsl --version) and a distro:wsl --install -d Ubuntu.
2. Put WSL on the LAN¶
Create or edit %UserProfile%\.wslconfig:
Then apply it with wsl --shutdown and reopen your distro. WSL now shares the host's network interfaces, so a socket bound inside WSL is reachable on the Windows machine's LAN IP.
Do not set hostAddressLoopback
That option is experimental and does the opposite of what you want here (it lets WSL reach the host by its LAN IP). It is not needed for inbound access.
3. Allow inbound traffic through the Hyper-V firewall¶
Mirrored mode is still gated by the Hyper-V firewall, which blocks inbound connections by default. In an elevated PowerShell:
$wsl = '{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}'
New-NetFirewallHyperVRule -Name 'FerrousDNS-UDP53' -DisplayName 'Ferrous DNS (DNS/UDP)' `
-VMCreatorId $wsl -Protocol UDP -LocalPorts 53 -Action Allow
New-NetFirewallHyperVRule -Name 'FerrousDNS-TCP53' -DisplayName 'Ferrous DNS (DNS/TCP)' `
-VMCreatorId $wsl -Protocol TCP -LocalPorts 53 -Action Allow
New-NetFirewallHyperVRule -Name 'FerrousDNS-Web' -DisplayName 'Ferrous DNS (dashboard)' `
-VMCreatorId $wsl -Protocol TCP -LocalPorts 8080 -Action Allow
Both UDP and TCP on 53 are needed — clients retry over TCP whenever a response is truncated.
4. Free port 53 inside the distro¶
Ubuntu's WSL image boots with systemd, and systemd-resolved holds a stub listener on 127.0.0.53:53. Disable it and stop WSL from rewriting /etc/resolv.conf:
sudo mkdir -p /etc/systemd/resolved.conf.d
printf '[Resolve]\nDNSStubListener=no\n' | sudo tee /etc/systemd/resolved.conf.d/ferrous.conf
sudo systemctl restart systemd-resolved
printf '[network]\ngenerateResolvConf = false\n' | sudo tee -a /etc/wsl.conf
After wsl --shutdown, write your own /etc/resolv.conf (nameserver 1.1.1.1). Point it at a public resolver, not at Ferrous DNS itself — otherwise package installs inside the distro break whenever the server is stopped.
5. Run the server¶
Native binary — follow Build from Source inside the distro, then grant the port-53 capability so you don't need root:
sudo setcap cap_net_bind_service=+ep ./target/release/ferrous-dns
./target/release/ferrous-dns --config ferrous-dns.toml
Docker Desktop — use explicit port mappings instead of --network host:
docker run -d --name ferrous-dns --restart always \
-p 53:53/udp -p 53:53/tcp -p 8080:8080 \
-e FERROUS_CONFIG=/data/config/ferrous-dns.toml \
-v ferrous-data:/data/ \
ferrousnetworking/ferrous-dns:latest
Docker Desktop 4.34+ does support host networking (opt-in under Settings → Resources → Network), but it is layer-4 only and containers cannot bind a specific host address, so explicit mappings are the predictable path here.
Known limitations under WSL2¶
- mDNS client names (
mdns_enabled) are untested under WSL2 — multicast behaviour differs from a bare-metal Linux host, so announcements may not arrive. - WSL does not start at boot. Register a Scheduled Task that runs
wsl -d Ubuntu -u root /path/to/ferrous-dns ...at logon/startup, or the DNS server disappears after a reboot. - Mirrored mode has open port-binding bugs upstream (wildcard binds and reserved localhost ranges). If a listener fails to bind, try a
wsl --shutdownfirst. - For anything you actually depend on, a Raspberry Pi, a spare Linux box, or a Hyper-V VM on an external (bridged) virtual switch is a less surprising host than WSL2.
Windows 10, or NAT mode
Without mirrored networking, WSL2 can only serve the Windows machine itself (via localhostForwarding). It cannot act as a network-wide DNS server, and no netsh port-forwarding workaround exists for UDP.
Build from Source¶
Prerequisites¶
- Rust 1.80+ (
rustup install stable) - SQLite development libraries
# Arch Linux
pacman -S sqlite
# Ubuntu / Debian
apt install libsqlite3-dev
# macOS
brew install sqlite
Build¶
git clone https://github.com/ferrous-networking/ferrous-dns.git
cd ferrous-dns
# Standard build
cargo build --release
# Optimized for your CPU (recommended for production)
RUSTFLAGS="-C target-cpu=native" cargo build --release
The binary is at ./target/release/ferrous-dns.
Run¶
Configuration¶
Ferrous DNS is configured through a TOML config file, with a few settings also exposed as command-line flags. The ferrous-dns binary itself has no environment variables — it does not read FERROUS_* or RUST_LOG directly. The FERROUS_* variables only exist as a convenience layer in the Docker image's entrypoint script, which converts them into the CLI flags below before launching the binary. With FERROUS_LOG_LEVEL at debug or trace, the entrypoint also prints the command line it runs.
Config file¶
Point the server at a config file with --config/-c:
If --config is omitted, the server looks for a config file in this order:
ferrous-dns.tomlin the current working directory/etc/ferrous-dns/config.toml
If neither exists, built-in defaults are used.
CLI flags¶
These flags override the matching values from the config file:
| Flag | Short | Description |
|---|---|---|
--config <FILE> | -c | Path to the TOML config file |
--dns-port <PORT> | -d | DNS server port (config: server.dns_port) |
--web-port <PORT> | -w | Web dashboard port (config: server.web_port) |
--bind <ADDR> | -b | Bind address, auto or an IP literal (config: server.bind_address; server.web_bind_address is left as it is) |
--database <PATH> | SQLite database path (config: database.path) | |
--log-level <LEVEL> | Log level: debug, info, warn, error (config: logging.level) |
--compact-database is a maintenance command, not an override: with the server stopped, it rewrites the database without its free space and exits. See Disk Space.
--backup-database <PATH> is another: with the server running, it writes a checked copy of the database to PATH, which must not exist yet, and exits. In Docker, run it through the entrypoint so the FERROUS_* variables apply: docker exec ferrous-dns /entrypoint.sh --backup-database /data/backups/ferrous.db. See Backups.
--healthcheck asks the running server's GET /ferrous/api/v1/health and exits: 0 when it answers 200, 1 otherwise. It reads the same config file and flags as the server to find the web server: web_port on web_bind_address, else on bind_address. When that is every address it calls 127.0.0.1, then ::1 if nothing answers there; it never goes through an HTTP_PROXY from the environment. It follows the redirect to HTTPS when web TLS is on, accepting a self-signed certificate. The Docker health check runs it.
Log level
The log level is set by logging.level in the config file (or the --log-level flag). RUST_LOG is not consulted.
Upgrading¶
Stop the server, replace the binary or pull the new image, and start it again with the same config file and database. Read these notes first: this release changes a few behaviours that an existing install can notice. Back up first and keep the previous version at hand: see Backups & Upgrades for the steps and how to roll back.
Config values rewritten at load¶
Some config values that earlier releases started with are now invalid, mostly because they sat on a disabled feature or broke only the component they sized: a hostname in a disabled listener's *_bind_address, a malformed server_secret with cookies off, an unknown cache_eviction_strategy such as "hit-rate", a hostname in local_dns_server, and zeros such as query_timeout = 0. The server still starts with them. Each is replaced by what earlier releases effectively ran with, or by the default, and logged at WARN with the key, the value and what is used instead. Check the first log lines after the upgrade:
Values that made earlier releases fail to start or crash still stop startup. queries_log_stored = 0 keeps its meaning: every run of the cleanup deletes the whole query log. The full list is under Loading the Config File. The dashboard and the API reject all of these values.
Database disk space¶
A database created by an earlier release keeps the space that the query-log cleanup frees, so its file never shrinks. If the first start logs The database file holds free space it cannot give back, stop the server and run it once with --compact-database, as described in Disk Space. The query-log cleanup now runs for the first time 10 minutes after startup, instead of 4 hours.
The top domain and client lists now read hourly aggregates. They start empty: a background job fills them in from the existing log, newest hour first, about a day of history every five minutes. Until it reaches an hour, that hour is read from the log as before, so the lists speed up as the job progresses.
DoH behind a reverse proxy¶
DoH requests now believe X-Forwarded-For and X-Real-IP only from the addresses in [server] trusted_proxies, which by default is loopback only. A reverse proxy on another host or on a Docker bridge network must be listed there. Otherwise every DoH query is attributed to the proxy's address, so per-client groups and rules stop applying to DoH clients. See DoH client identity.
Upstream EDNS options are no longer relayed¶
Answers relayed from an upstream carry Ferrous DNS's own OPT record. The upstream's options, including its Extended DNS Errors (EDE) and NSID, no longer reach clients. See EDNS buffer size and truncation.
Docker health check¶
The image's health check now probes the running server through ferrous-dns --healthcheck instead of running ferrous-dns --version, so a container whose DNS listener could not start reports unhealthy. A compose file that copied the old healthcheck: block keeps running --version: replace its test with ["CMD", "/entrypoint.sh", "--healthcheck"], or delete the block to use the image's. See Health check.
Docker database path¶
The image no longer sets FERROUS_DATABASE. Its old default, /data/db/ferrous.db, was documented but never applied: the database is /data/ferrous-dns.db, from [database] path in the bundled config, and it stays there, so nothing moves. A compose file or docker run that still sets FERROUS_DATABASE=/data/db/ferrous.db keeps working; the entrypoint ignores that value as before and now says so at startup. Remove the line to silence the notice. Any other value still points the server at that path, where it opens an empty database unless you move the file there first: see Database File Location.
Listening on IPv6 by default¶
bind_address accepts "auto", and it is the new default: every listener serves IPv4 and IPv6 clients on one dual-stack socket. A config file that names an address keeps it, "0.0.0.0" included, so an existing install, Docker volume or packaged config listens exactly where it did before. Change the line to bind_address = "auto" to serve IPv6 clients too. Only a server started without any config file moves to IPv4 + IPv6 on its own. See Dual-stack.
Before rolling back to an earlier release, change bind_address = "auto" to an address, such as "[::]" for the same dual-stack listening: earlier releases refuse to start with "auto", and they cannot restore the config section of a backup that says "auto". A fresh install from this release has "auto" in its config file.
Docker bind address¶
The image and the bundled docker-compose.yml no longer set FERROUS_BIND_ADDRESS. Their old default, 0.0.0.0, was never applied: bind_address in the config file decided, and still does. A compose file or docker run that still sets FERROUS_BIND_ADDRESS=0.0.0.0 keeps working the same way, and the entrypoint now says so at startup; remove the line to silence the notice. To keep a container on IPv4 only, set bind_address = "0.0.0.0" in its config file. Any other value is still passed to the server as --bind.
One-time query log rebuild¶
The first start rebuilds the query_log table, and the server answers queries only once that is done. On large databases this takes a while: about 9 seconds for 3 million rows on an NVMe drive, and noticeably longer on a Raspberry Pi SD card. The database file also grows by about 70% until it is compacted. To reclaim the space, stop the server and run it once with --compact-database; see Disk Space.
Malware detection exemption lists removed¶
domain_whitelist and client_whitelist under [dns.tunneling_detection] and [dns.dga_detection], and rebinding_allowlist under [dns], are no longer read. A file that still has them starts, logs one warning per list with its entries, and drops them on the next save from the dashboard:
Recreate each entry the new way. Both apply at once, with no restart. See Exemptions.
- A domain: add it as an allow in DNS Filter → Managed Domains, in the group of the clients it is for. A wildcard rule such as
*.cdn.example.comcovers its subdomains, which the old lists did not. An allow also overrules the blocklists for that group. - A client or subnet: put it in a group (Clients), and switch Malware Detection off for that group in Groups. The group skips all five detectors, not only tunneling and DGA.
The query log's Allow button now writes the rule into the group the query was decided in, instead of always the default group, and its confirmation names the group.
Disabled groups now take effect¶
A group's Enabled switch used to change nothing: the clients of a disabled group still got that group's blocklists and rules. Now they get the rules of the default Protected group instead; see Disabled Groups. So that no client is filtered differently after the upgrade, the first start switches every disabled group back on. To use the new meaning, switch those groups off again on the Groups page. Earlier releases ignore the switch, so rolling back needs no change.
Blocklists in force from the first answer¶
A start opens its ports, DNS and web, only once the blocklists are compiled, so a restart no longer answers blocked names for a moment. It waits at most 30 seconds. The server now keeps the last download of each list in a lists directory beside the database (/data/lists in the image), compiles from it at the next start, and then downloads the lists again in the background. The directory takes about the size of the lists. The first start after the upgrade has no copies yet, so it downloads the lists before it serves. Earlier releases ignore the directory. See Restarts.
Docker image cleanup¶
The image no longer sets RUST_LOG, which the server never read: the entrypoint now prints its command line when FERROUS_LOG_LEVEL is debug or trace. It also stops copying the SQL migrations into /data/migrations. They are built into the binary, so an existing /data/migrations directory in the volume is unused and can be deleted. The bundled docker-compose.yml now caps the container log at three 10 MB files.
API tokens, sessions and TLS paths¶
- An API token's key is shown once, when the token is created.
PUT /api-tokens/{id}no longer returns it, and the server no longer keeps it: existing tokens keep working, because only their hash is checked. The listed prefix of a custom key is now at most a quarter of it, so a short key's prefix gets shorter; a generated key keeps its 8 characters. GET /auth/sessionslists each session under a handle instead of the value of its cookie.DELETE /auth/sessions/{id}takes that handle. Signed-in browsers and Pi-hole integrations stay signed in across the upgrade.- The first start after the upgrade rewrites the database file once, before it serves, so the keys and session ids it replaced leave the file too. It takes about as long as
--compact-databaseand needs free disk space about the size of the database. If the rewrite fails, the server logs a warning and starts anyway; stop it and runferrous-dns --compact-databaseonce. - The address a session shows is the TCP peer of the login. A reverse proxy names the client only when it is in
[server] trusted_proxies, as for DoH; behind a proxy that is not listed, every session shows the proxy's address. tls_cert_pathandtls_key_pathare set inferrous-dns.tomlonly.POST /configrefuses to change them, and a backup import keeps this server's paths. Edit the file to move the certificate.- About 1024 passwordless passkey logins can be pending at once; a
startbeyond that answers429.
Dashboard hardening¶
- Every dashboard and API response now carries a frame policy, so a page on another origin, another subdomain or port included, can no longer show the dashboard in a frame. A dashboard app that embedded it from its own host name shows an empty frame; see Security headers. A reverse proxy that adds
X-Frame-Optionsshould stop: the shipped examples incontrib/reverse-proxyno longer do. - A backup import no longer turns authentication or the login lockout off. A backup with either off leaves it on and says so under the import summary, and the response carries the note in a new
warningslist. Turn authentication off under Settings > Security, or setlogin_rate_limit_attempts = 0inferrous-dns.toml, if you mean to. - A new custom API token key, or a replacement one, needs at least 32 characters and no space or tab at either end; the API answers
400otherwise, so a script that sets shorter keys must change. Keys created before keep working.
Platform support¶
| Platform | Status |
|---|---|
Linux amd64 | Supported — prebuilt binary and Docker image |
Linux arm64 | Supported — prebuilt binary and Docker image (Raspberry Pi 4/5) |
| Windows | Via WSL2 only — no native binary |
| macOS | Docker with a Linux VM; no native binary and no host networking |
Docker images are published for both amd64 and arm64 (Raspberry Pi 4/5, Apple Silicon via Linux VM).