动态添加zone addzone

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

    allow-new-zones yes;
    

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.

    rndc addzone example.aa in myview '{type master; file "master/example.aa";};'
    

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

    zone example.aa {type master; file "master/example.aa";};
    

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:

    rndc delzone example.aa
    

       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





  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值