Blocking & Filtering¶
Ferrous DNS provides multi-layer DNS filtering with support for blocklists, wildcards, regex, CNAME cloaking detection, and safe search enforcement.
How Blocking Works¶
Rules you wrote yourself are resolved first and win outright. Everything else — the global blocking toggle, schedule overrides, downloaded blocklists — is only consulted once no manual rule matches:
Query: ads.doubleclick.net
│
▼
1. Manual rules ──────► allowlist, managed domain, regex filter,
│ or manually added blocked domain?
│ ├─ allow → ALLOW, final
│ └─ deny → BLOCK, final
│ no manual rule
▼
2. Blocking toggle ───► blocking paused? → ALLOW
│ blocking on
▼
3. Schedule override ─► group in a BlockAll / AllowAll window? → apply it
│ no override
▼
4. Quick pre-check ───► definitely not blocked? → skip lookup
│ possible match
▼
5. Exact domain match ─► in a downloaded blocklist? → BLOCK
│ no
▼
6. Wildcard match ────► matches *.ads.com? → BLOCK
│ no
▼
7. Substring / adblock rule ─► matches? → BLOCK
│ no
▼
8. Upstream resolution
│
▼
9. CNAME cloaking ────► CNAME points to blocked domain? → BLOCK
│ clean
▼
Return response
A domain allowed at step 1 also skips the five malware detection engines, which otherwise run around steps 4 and 8, and the CNAME cloaking check at step 9.
Blocklists¶
Adding Blocklists¶
Via dashboard: Blocklists > Add Blocklist (or the REST API).

Not configured via TOML
Individual blocked domains are stored in the SQLite database and managed through the dashboard or REST API. There is no TOML key for them: the custom_blocked array older releases accepted in [blocking] was never read, and a file that still has entries in it loads with a warning.
63 active blocklist sources maximum
Each domain carries a 64-bit mask of the sources that contributed it, and one bit is reserved for manually added entries. If more than 63 blocklist sources are enabled, only the 63 oldest are compiled and the rest are silently skipped — the only signal is a WARN line at startup and after each refresh. Merge or disable lists to stay under the cap; a handful of large lists beats dozens of small ones.
Supported Formats¶
Hosts file (0.0.0.0 or 127.0.0.1 format):
Domain list (one domain per line):
Wildcard (blocks entire subdomain trees):
A *. rule covers every name below the base — video.ads.example.com, a.b.ads.example.com — but not the base itself. Add ads.example.com as its own line to block the apex too.
Adblock (domain and everything under it):
||doubleclick.net^ blocks doubleclick.net and all of its subdomains. @@ exception lines are ignored.
Substring (literal text anywhere in the name):
/.../ in a list is a literal substring, not a regex
Text between slashes is matched literally, so /^ads\d+\.example\.com$/ looks for a name containing the characters ^ads\d+… and matches nothing. For real regular expressions use Regex Filters in the dashboard, which compile per client group with an allow or deny action.
Recommended Blocklists¶
| Name | URL | Size | Focus |
|---|---|---|---|
| Steven Black Unified | https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts | ~120k | Ads + Malware |
| OISD (small) | https://small.oisd.nl/domainswild | ~50k | Balanced |
| OISD (big) | https://big.oisd.nl/domainswild | ~200k | Comprehensive |
| HaGeZi Pro | https://raw.githubusercontent.com/hagezi/dns-blocklists/main/adblock/pro.txt | ~228k | Comprehensive |
| HaGeZi Threat (mini) | https://raw.githubusercontent.com/hagezi/dns-blocklists/main/adblock/tif.mini.txt | ~200k | Security |
| HaGeZi Threat (medium) | https://raw.githubusercontent.com/hagezi/dns-blocklists/main/adblock/tif.medium.txt | ~870k | Security |
| HaGeZi Threat | https://raw.githubusercontent.com/hagezi/dns-blocklists/main/adblock/tif.txt | ~2.3M | Security |
| EasyList | https://easylist.to/easylist/easylist.txt | ~80k | Ads |
Use HaGeZi's Adblock format
HaGeZi publishes each list in several formats. Use the adblock/ files: each entry blocks the domain and all of its subdomains. The wildcard/ files write entries as *.domain, which here blocks subdomains only, so every listed domain itself would still resolve.
Large lists and memory
A sync builds the new index while the old one keeps answering queries, so memory peaks at about twice the steady size. Measured on a 64-bit build with one list enabled:
| List | Loaded | Peak during a sync |
|---|---|---|
| HaGeZi Pro | ~100 MB | ~175 MB |
| HaGeZi Threat (mini) | ~85 MB | ~140 MB |
| HaGeZi Threat (medium) | ~195 MB | ~405 MB |
| HaGeZi Threat | ~510 MB | ~1.1 GB |
On a device with 1 GB of RAM, such as a Raspberry Pi 3, the full Threat list runs out of memory during a sync. Use the mini or medium variant instead.
Allowlist¶
Domains in the allowlist bypass all blocking, even if present in a blocklist.
Manage the allowlist via the dashboard (DNS Filter > Managed Domains) or the REST API — entries are stored in the SQLite database. To add many at once, switch the form to Bulk and paste one domain per line; text after # is a comment. The reply says which lines were added, which were already there and which are invalid, and only the invalid lines stay in the box to fix (Create Domains in Bulk). You can also add a domain directly from the query log with one click, for good or for 15 minutes, 1 hour or 1 day; a temporary allow is deleted when it expires (Allow/Block from Query Log).
Not configured via TOML
Use the dashboard or API to allow-list domains. The whitelist array older releases accepted in [blocking] was never read, and a file that still has entries in it loads with a warning.
What counts as a manual rule¶
Four sources are treated as rules you wrote by hand, and all four sit in the top tier:
| Source | Where | Allow | Deny |
|---|---|---|---|
| Allowlist | DNS Filter > Managed Domains, or one click from the query log | — | |
| Managed domains | DNS Filter > Managed Domains | ||
| Regex filters | DNS Filter > Regex Filters | ||
| Manually blocked domains | one click from the query log | — |
Domains that arrived from a downloaded blocklist source are not manual, and stay subject to the toggle and to schedules.
What a manual rule outranks¶
| A manual rule beats | Meaning |
|---|---|
| The global blocking toggle | Pausing blocking (POST /api/dns/blocking, or the Pi-hole toggle) releases downloaded blocklists but not a domain you denied by hand |
| Schedule overrides | A BlockAll window does not override an allow; an AllowAll window or bypass timer does not release a manual deny |
| Blockable services | A service blocked for the group is overridden by an explicit allow for one of its domains |
| Malware detection | All five detection engines skip an explicitly allowed domain — see below |
| CNAME cloaking | An allow for the queried name lets it resolve through a chain that names a blocked domain, fresh or from the cache |
Clearing a false positive
If a domain you need is being blocked by CNAME cloaking, DNS tunneling, DGA, rebinding, NXDomain hijack or response IP filtering, add it as an allow in Managed Domains, in the group of the clients it is for, or click Allow next to it in the query log, which picks that group for you. It takes effect on the next query — no restart, no TOML edit. See Malware Detection.
CNAME Cloaking Detection¶
Some trackers hide behind first-party CNAME records to bypass simple domain blocklists:
Without CNAME inspection, blocking tracking.third-party-analytics.com would be ineffective because the query is for tracking.yoursite.com.
Ferrous DNS resolves the full CNAME chain and blocks the response if any CNAME in the chain points to a blocked domain. The check runs on every answer, including one served from the cache, for the asking client's group. This is enabled automatically when blocking is active.
To let one first-party name through, allow the name the client queried (tracking.yoursite.com above): an explicit allow lifts the CNAME check for it, and it is what the query log's Allow button adds.
Safe Search Enforcement¶
Force safe search modes on search engines and video platforms to prevent explicit content:
Managed via dashboard: Settings > Safe Search
| Platform | Enforcement Method |
|---|---|
DNS redirect to forcesafesearch.google.com | |
| Bing | DNS redirect to strict.bing.com |
| YouTube | DNS redirect to the moderate or strict restriction endpoint (selectable per group) |
| DuckDuckGo | DNS redirect to safe search endpoint |
| Yandex | DNS redirect to the family search endpoint |
| Brave | DNS redirect to safe search endpoint |
| Ecosia | DNS redirect to safe search endpoint |
Safe Search can be enabled globally or per client group (e.g. only on the "Kids" group).
Blockable Services (1-Click)¶
Pre-defined service categories that can be blocked network-wide or per group:
Advertising - Google Ads, DoubleClick, Facebook Ads, Amazon Ads
Analytics & Tracking - Google Analytics, Mixpanel, Hotjar, Segment, Amplitude
Social Media - Facebook/Instagram, TikTok, Twitter/X, Snapchat, Pinterest
Telemetry - Microsoft telemetry, Apple telemetry, Windows Update telemetry
Adult Content - Adult content domains
Gambling - Online gambling domains
Access via dashboard: Services
See Block Services & Schedules for the full guide with per-group examples, custom services, and time-based scheduling.
Per-Group Blocking¶
Different blocking policies per client group allow fine-grained control:
- Kids devices: strict blocklist + safe search + social media blocked
- Work devices: ad blocking + tracking blocked, social media allowed
- IoT devices: block everything except required cloud endpoints
- Guest network: basic ad blocking only
See Client Management for group setup.
Query Log Actions¶
Every query in the query log has quick-action buttons:
- Block: adds a managed domain with the
denyaction - Allow: adds a managed domain with the
allowaction
Both write the rule into the group the query was decided in, the client's group at the time, and say which group in their confirmation. Clients in other groups are not affected. Changes take effect immediately without a restart.
Blocking Response¶
How a blocked query is answered is controlled by the block_mode setting (dashboard: Settings > DNS > Blocked query response, or the [blocking] config section). The default is Null IP, which returns a cacheable 0.0.0.0/:: answer so clients fail fast and stop re-querying.
| Mode | Response |
|---|---|
null_ip (default) | NOERROR + 0.0.0.0 (A) / :: (AAAA); NODATA for other types |
nxdomain | NXDOMAIN (domain appears not to exist) |
nodata | NOERROR with an empty answer |
refused | REFUSED (legacy, non-cacheable) |
Negative responses include a synthetic SOA so resolvers can negatively cache the block for block_ttl seconds. See Block Response Mode for the full reference and the restart caveat.