http://jpmens.net/2010/10/04/dynamically-add-zones-to-bind-with-rndc-addzone/
The BIND name server (version 9.7.2-P2) has an experimental feature allowing administrators to dynamically add and remove zones at run-time, without having to edit named.conf
and reload/reconfigure the name server. Beware though: the documentation explicitly states that this feature is currently experimental. In order for this to work, the server’s options
or view
must contain the directive
You use the rndc
command to add or delete a zone to a view. For example, to add a master zone called example.aa from the file master/example.aa
(relative to the name server’s directory) to a view called myview, I issue the following command.
The zone is added to the running name server, and it is added to a configuration file. The filename is a hash of the view name with extension .nzf
. (Which might stand for new zone file?) The file’s content is
Upon restarting named, the server automatically attempts to load this file. It appears that namedhashes view names and stabs to see if it finds a hash.nzf
and loads that if it finds it. Dynamically added zones can also be deleted with the delzone command:
addzone zone [class [view]] configuration Add a zone while the server is running. This command requires the allow-new-zones option to be set to yes. The configuration string specified on the command line is the zone configuration text that would ordinarily be placed in named.conf. The configuration is saved in a file called hash.nzf, where hash is a cryptographic hash generated from the name of the view. When named is restarted, the file will be loaded into the view configuration, so that zones that were added can persist after a restart. This sample addzone command would add the zone example.com to the default view: $rndc addzone example.com '{ type master; file "example.com.db"; };' (Note the brackets and semi-colon around the zone configuration text.) See also rndc delzone. delzone zone [class [view]] Delete a zone while the server is running. Only zones that were originally added via rndc addzone can be deleted in this manner. See also rndc addzone