[Pdns-users] zoneToCache - File Format

Clint Anderson Clint at ZWebSite.com
Wed Jan 19 16:54:25 UTC 2022

Otto & Walter - Thank you for the replies!


My assumption was that the cache is the most efficient and if it was in the cache, it would return the cached answer and never go looking for an update.  Thank you for the clarification on the zoneToCache functionality, seems I was barking up the wrong tree.

If using the cache is not the way to go, what is the best, most efficient way, to block half a million (500,000) or more domains?  I do not have any experience using RPZ files, but I did read up on it and it seems to be the best way to go.  Trying to load 500,000 domains into a file and running a Lua "preresolve" script seems like it would require more system resources and not be as efficient, but I would love to hear your opinion on it. 

Thank you very much for your time & help!


> Hi All,
> BackGround:
> PowerDNS Recursor v4.6.0
> I have the example from the docs (https://doc.powerdns.com/recursor/lua-config/ztc.html) working perfectly:
> zoneToCache(".", "url", "https://www.internic.net/domain/root.zone", { 
> refreshPeriod = 0 })
> Problem:
> I'd like to load a "BlackList" file (or multiple BlackList files) the same way, but I have no idea what file format the PDNS zoneToCache function is looking for.  In a perfect world, I'd like to be able to take a list of domains like this:
> Domain1.com
> Domain2.com
> Domain3.com
> *.Domain3.com
> Domain4.com
> Sub.Domain4.com
> Sub2.Domain4.com
> And load them via the zoneToCache feature, and have them all point to a specific, common IP Address, like, but I can't seem to figure out how to accomplish this.
> Any thoughts, examples, or suggestions would be greatly appreciated.  Thank you very much for your time & help.

The format is the zone file format see e.g. https://en.wikipedia.org/wiki/Zone_file

But the zone to cache is not for overriding. It is meant to be used for keeping the cache hot. The recursor will replace records your are trying to override with data retrieved from the net in some cases.

To override names there are two mechanisms available: Lua interception [1] and RPZ [2].

[1] https://docs.powerdns.com/recursor/lua-scripting/hooks.html
[2] https://docs.powerdns.com/recursor/lua-config/rpz.html#response-policy-zones-rpz


More information about the Pdns-users mailing list