Troubleshooting¶
Common issues and solutions when running Ferrous DNS.
Port 53 Already in Use¶
Symptom¶
Cause¶
On most Linux distributions, systemd-resolved occupies port 53.
Solution¶
Then update /etc/resolv.conf to point to your router or a public resolver:
sudo rm /etc/resolv.conf
echo "nameserver 192.168.1.1" | sudo tee /etc/resolv.conf # your router, or e.g. 1.1.1.1
Don't point this machine at Ferrous DNS itself
With nameserver 127.0.0.1, this machine resolves through Ferrous DNS, which is not answering yet while it starts, so the hostnames in your upstream URLs cannot be looked up. If you do want that, set local_dns_server to your router so Ferrous DNS asks it for those names instead.
Edit /etc/systemd/resolved.conf:
Then restart:
DNS Queries Not Being Resolved¶
Check 1: Is the server running?¶
Check 2: Can you reach the DNS port?¶
If this times out, check firewall rules:
# Check if port 53 is open
sudo ss -tulnp | grep :53
# Open port 53 (if using ufw)
sudo ufw allow 53/udp
sudo ufw allow 53/tcp
# If mDNS device discovery is enabled (mdns_enabled), also allow UDP 5353
sudo ufw allow 5353/udp
Check 3: Are upstream servers reachable?¶
Check the dashboard at Settings > System Status > Upstream Health. If all upstreams show "Unhealthy" (queries are still sent to them — the resolver fails open — but each may wait out the full timeout):
- Verify your upstream URLs are correct in
ferrous-dns.toml - Check network connectivity from the server:
dig @8.8.8.8 example.com - If using DoH/DoT/DoQ upstreams, ensure outbound ports 443/853 are open
- If only upstreams written as hostnames are unhealthy, see An Upstream Hostname Never Comes Up
- Rows marked No route are addresses this host cannot reach at all, usually IPv6 addresses on a host or Docker container without IPv6. They are left out on purpose and do not make their server Partial. A server written as an IPv6 address reads Unhealthy there: enable IPv6 for the container, or use the server's IPv4 address
An Upstream Hostname Never Comes Up¶
Symptom¶
An upstream written with a hostname, such as doq://dns.adguard-dns.com:853, stays unhealthy and never answers, while the same server written as an IP address works. The startup log has Failed to resolve upstream hostname, retrying in the background … hostname=dns.adguard-dns.com (… keeping unresolved and retrying in the background before 0.9.25), and each query sent to it fails with QUIC upstream dns.adguard-dns.com:853 has no IP address yet (QUIC transport requires resolved address in 0.9.18 and earlier), which Settings > System Status also shows for that server.
Cause¶
Ferrous DNS could not look the hostname up. It asks local_dns_server first when one is set, then the host's system resolver. The most common reason is a host whose /etc/resolv.conf points at Ferrous DNS itself, with no local_dns_server set: while Ferrous DNS starts, nothing answers that lookup, and afterwards Ferrous DNS has no resolved upstream to ask.
Solution¶
- Set Local DNS server to your router in Settings > DNS Settings (
local_dns_serverin[dns]) and restart. Upstream hostnames are then asked to the router first - Or point the host's own resolver at your router or a public resolver instead of Ferrous DNS
- Check the lookup works on the host:
getent hosts dns.adguard-dns.com - A lookup that failed is retried automatically, from the health-check interval up to every five minutes. The log shows
Upstream hostname now resolves to new addresseswhen it succeeds. Saving the pools in Settings > DNS Advanced > Upstream DNS Pools retries at once
An Upstream URL Is Rejected¶
Saving pools shows Invalid server '…', or the server refuses to start with it. The message ends with how to fix the address; the common ones:
| Message | Fix |
|---|---|
'quic://' is not a supported scheme | Write DNS-over-QUIC as doq://host:853 — AdGuard shows it as quic:// |
missing port | Add the port: :853 for tls:// and doq://, :53 for udp:// and tcp:// |
add a scheme | Only IP:PORT may omit the scheme; write a hostname as udp://host:53 |
IPv6 addresses must be in brackets | https://[2606:4700:4700::1111]/dns-query |
See Upstream URL Formats.
A Domain Is Blocked and You Want It Allowed¶
Symptom¶
A domain you need answers with 0.0.0.0 (or NXDOMAIN, depending on block_mode), and it is not on any blocklist you added.
Cause¶
Find the real reason before changing anything. Open Queries, locate the domain, and read its block source:
| Block source | What matched |
|---|---|
blocklist | A downloaded blocklist, or a domain you blocked by hand |
managed_domain / regex_filter | A rule in DNS Filter |
cname_cloaking | The answer's CNAME chain goes through a name a blocklist or a DNS Filter rule blocks (CNAME cloaking) |
schedule | A time-based BlockAll window for the client's group |
dns_tunneling, dga_detection, dns_rebinding, nxdomain_hijack, response_ip_filter | One of the five malware detection engines — a heuristic, so this is where false positives live |
non_fqdn / private_ptr | Never forward non-FQDN queries or Never forward reverse lookups for private IP ranges in Settings (block_non_fqdn / block_private_ptr) |
dns_cookie | Strict DNS Cookies (require_valid_cookie) refused a UDP query without a valid server cookie. The client got BADCOOKIE or REFUSED, not a block answer |
Solution¶
Click Allow next to the domain in the query log, or add it under DNS Filter > Managed Domains with the allow action. A rule applies to one group: the query log button writes it into the group of the client on that row, and in DNS Filter you pick the group, which must be the blocked client's.
That single step covers every row in the table above except non_fqdn / private_ptr, which only turning the setting off lifts, and dns_cookie: an RFC 7873 client retries with the server cookie that came with BADCOOKIE, and one without cookie support needs require_valid_cookie = false or a stream transport. An explicit allow is the highest-priority verdict in the pipeline: it overrules downloaded blocklists, schedule windows, blocked services, and all five detection engines. It applies from the next query — no restart.
The group_id in the request below is the client's group, as GET /ferrous/api/v1/queries reports it on the row (1 is the default group, Protected):
curl -X POST http://localhost:8080/ferrous/api/v1/managed-domains \
-H 'Content-Type: application/json' \
-d '{"name":"needed by build agent","domain":"cdn.example.com","action":"allow","group_id":2}'
To stop the malware detectors from judging one client at all, such as a monitoring server, put it in a group with Malware Detection off instead: see Exempt clients.
Pausing blocking will not do it
Disabling blocking releases downloaded blocklists only. A domain blocked by a rule you wrote by hand stays blocked — remove the rule instead. See What a manual rule outranks.
Blocklist Not Updating¶
Symptom¶
Last Sync on the Blocklists page does not change after you click the refresh icon, or a list you added blocks nothing.
Cause¶
A failed download does not fail the sync. The index is rebuilt without that download: the list keeps the copy it last downloaded, or stays empty if it never downloaded, and Last Sync keeps its old value. The reason is in the log:
| Log line | Meaning |
|---|---|
Fetched blocklist source url=… | The download worked |
HTTP 404 for <url> | The URL is wrong, or the list has moved |
timed out after Ns | The server stopped sending for 30 seconds, or the download ran past 5 minutes |
Solution¶
Correct the URL, or check that the server can reach the list's host. If the container restarts during a sync, the list is too large for the device's memory. See Check blocklist size.
Dashboard Not Loading¶
Check the web port¶
If no response:
- Verify
web_portinferrous-dns.toml(default:8080) - Check
web_bind_address: on loopback, the dashboard answers only on the host itself - Check if the port is open:
sudo ss -tulnp | grep :8080 - Check Docker port mappings if running in a container
Blank page or JavaScript errors¶
- Clear browser cache and reload
- Check the browser console (F12) for errors
- Verify you are not using a very old browser — the dashboard requires ES2020 support
DoT / DoH Not Working¶
Check TLS certificates¶
# Verify cert file exists and is valid
openssl x509 -in /path/to/cert.pem -text -noout
# Check key matches cert
openssl x509 -in cert.pem -modulus -noout | md5sum
openssl rsa -in key.pem -modulus -noout | md5sum
# Both should output the same hash
Check the server logs¶
# Docker
docker logs ferrous-dns 2>&1 | grep -i tls
# Binary
./ferrous-dns --config ferrous-dns.toml --log-level debug 2>&1 | grep -i tls
If you see TLS cert file not found — DoT disabled (or DoQ, or Web HTTPS), verify the file paths in:
Self-signed certificate rejected¶
Browsers reject DoH to servers with self-signed certificates. Options:
- Use a Let's Encrypt certificate
- Import the self-signed CA into your OS trust store
- For DoT on Android/iOS, self-signed certificates are generally accepted
High Memory Usage¶
Check blocklist size¶
With large blocklists enabled, the block index can outgrow the DNS cache, and a sync briefly holds about twice as much. The measured sizes are in large lists and memory. On a device with 1 GB of RAM, use the mini or medium variant of HaGeZi's Threat Intelligence list rather than the full one.
Check cache size¶
Apart from the block index, the DNS cache is the largest in-memory structure. Reduce it if memory is constrained:
Check SQLite memory-mapped I/O¶
[database]
sqlite_mmap_size_mb = 32 # reduce from 64 for low-memory systems
sqlite_cache_size_kb = 8192 # reduce from 16384
Raspberry Pi / low-memory devices¶
Use the RPi-optimized profile from the cache configuration:
The Database File Keeps Growing¶
Symptom¶
The database file stays as large as it ever was after queries_log_stored is lowered, or keeps growing. The startup log may show:
WARN ferrous_dns_infrastructure::database: The database file holds free space it cannot give back, ...
Cause¶
A database created before incremental auto-vacuum keeps the pages that the query-log cleanup frees. Before v0.10.0, the cleanup also ran for the first time 4 hours after startup, so a server restarted more often than that never deleted anything.
Solution¶
Stop the server and run it once with --compact-database; see Disk Space. From then on, every cleanup gives the freed space back.
Database Locked / SQLITE_BUSY¶
Symptom¶
Cause¶
SQLite WAL mode allows concurrent reads but serializes writes. Under very high query logging load, the write lock can be contended. On v0.9.20 and earlier, the query-log cleanup also deleted a large backlog in 5000-row batches only 50 ms apart, and every dashboard request wrote its session. On slow storage that kept the lock busy for minutes, for example after queries_log_stored was lowered. The cleanup now deletes 1000 rows at a time and then pauses at least as long as each batch took. Session checks no longer write on every request.
Solution¶
Increase the busy timeout:
Or reduce write pressure by sampling queries:
[database]
query_log_sample_rate = 10 # log 1 in 10 queries instead of all
query_log_max_batch_size = 5000 # larger batches = fewer transactions
Startup Fails With "pool timed out while waiting for an open connection"¶
Symptom¶
The server stops during startup, and with Docker the container restarts into the same error:
INFO ferrous_dns::bootstrap::database: Initializing database: sqlite:ferrous-dns.db
ERROR ferrous_dns::bootstrap::database: Failed to initialize write pool: pool timed out while waiting for an open connection
The error comes exactly write_busy_timeout_secs after Initializing database.
Cause¶
The database has a large -wal file, left behind by a process that was killed instead of stopped. Before SQLite can open the database, it reads the whole WAL. On v0.9.20 and earlier:
- that read happened inside the write pool's connection timeout, so a WAL that took longer failed every start;
- each restart began the read again from scratch;
- the server did not handle
docker stop, so every stop, upgrade or reboot left a WAL behind.
Current releases read the WAL on a connection with no timeout, copy it back into the database and truncate it. A large WAL only makes that start slower, and the log reports its size. On SIGTERM the server closes the database, which removes the WAL. While it runs, any WAL past 64 MiB is truncated.
Solution¶
Do not delete the -wal file. It holds committed changes that are not in the .db file yet. Deleting it loses them and can corrupt the database.
On v0.9.20 and earlier, stop the server and copy the WAL back by hand. This takes a while on slow storage:
docker stop ferrous-dns
sqlite3 /path/to/data/ferrous-dns.db 'PRAGMA wal_checkpoint(TRUNCATE);'
docker start ferrous-dns
If the -wal file was already deleted, check the database with sqlite3 ferrous-dns.db 'PRAGMA quick_check;'.
PROXY Protocol Rejecting Connections¶
Symptom¶
All TCP DNS and DoT connections fail after enabling PROXY Protocol.
Cause¶
When proxy_protocol_enabled = true, the server expects every TCP connection to start with a PROXY Protocol v2 header. Direct client connections (without a load balancer) do not include this header.
Solution¶
Only enable PROXY Protocol when a compatible load balancer (HAProxy, AWS NLB, nginx stream module) is always in front:
UDP DNS is not affected — PROXY Protocol only applies to TCP and DoT listeners.
Docker Container Restart Loop on Startup¶
Symptom¶
The container never finishes booting and docker logs repeats:
No config found at /data/config/ferrous-dns.toml — copying default...
cp: can't create '/data/config/ferrous-dns.toml/ferrous-dns.toml': Permission denied
Cause¶
The doubled path is the tell: /data/config/ferrous-dns.toml is a directory, so cp wrote into it. Docker creates the source of a bind mount as a root-owned directory whenever the host path does not exist yet, so a mount like -v ./ferrous-dns.toml:/data/config/ferrous-dns.toml pointing at a file you never created produces a directory the container cannot write — it runs as uid 1000. The entrypoint exits, and restart: always turns that into a loop.
Solution¶
Stop the container, remove the directory Docker created, and drop the bind mount — the image bootstraps its own default config into the /data volume:
docker compose down # or: docker rm -f ferrous-dns
rm -rf ./ferrous-dns.toml # the directory Docker created, not a real config
To keep the config on the host instead, create the file and give it to uid 1000 before starting the container:
curl -fsSL -o ferrous-dns.toml \
https://raw.githubusercontent.com/ferrous-networking/ferrous-dns/main/ferrous-dns.toml
chown 1000:1000 ferrous-dns.toml
The same applies to a config that is owned by another user: the mount must be writable by uid 1000 (and not :ro), or the setup wizard, POST /config and backup restore cannot persist changes.
Docker Container Reports Unhealthy¶
Symptom¶
docker ps shows the container as (unhealthy), and an autoheal tool may keep restarting it.
Cause¶
The health check calls GET /ferrous/api/v1/health through ferrous-dns --healthcheck. It fails when the web server does not answer on the port the probe expects, or when the server answers 503 because its DNS listener is down. During a start, the web port opens only once the blocklists are compiled, at most 30 s later; the image gives a first start two minutes before failures count.
Solution¶
Read what the last probes printed:
503 Service Unavailablewith"status":"unavailable": the DNS port could not be bound. Look forDNS server errorindocker logs ferrous-dns, and see Port 53 Already in Use.error sending requestorConnection refused: nothing answers on the web port the probe uses. The probe takes the port and bind address from the config file and theFERROUS_*variables. Flags given in a composecommand:do not reach it, so set them there instead.
Docker Networking Issues¶
Host network mode (recommended)¶
Host mode gives Ferrous DNS direct access to the network, enabling accurate client IP detection.
Bridge mode¶
If you must use bridge mode, map the ports explicitly:
Client IP detection in bridge mode
In bridge mode, all queries appear to come from the Docker gateway IP (usually 172.17.0.1). Client-specific features (groups, per-client policies) will not work correctly. Use host network mode for accurate client detection.
mDNS device discovery requires host mode
The mDNS listener (mdns_enabled) relies on multicast (224.0.0.251:5353), which does not traverse Docker bridge port mapping — adding "5353:5353/udp" to ports: will not deliver announcements. Use network_mode: host for mDNS to work.
Increasing Log Verbosity¶
For debugging, increase the log level:
Or with the command-line flag, which overrides the file:
Warning
debug and trace levels produce significant log volume under load. Use only for troubleshooting, then revert to info.