加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

domain-name-system – 自动为多个区域文件设置master

发布时间:2020-12-14 23:04:23 所属栏目:资源 来源:网络整理
导读:现在我正在移动我的主服务器,我花了一些时间来完善和简化它的一些设置,现在它已经到了DNS服务器(在新设置中绑定9.9.5). 我注意到在我的配置中,我有很多以这种方式定义的区域: zone "123.123.123.123.in-addr.arpa" in { type master; file "123.123.123.123
现在我正在移动我的主服务器,我花了一些时间来完善和简化它的一些设置,现在它已经到了DNS服务器(在新设置中绑定9.9.5).

我注意到在我的配置中,我有很多以这种方式定义的区域:

zone "123.123.123.123.in-addr.arpa" in {
        type master;
        file "123.123.123.123";
};

zone "123.123.123.124.in-addr.arpa" in {
        type master;
        file "123.123.123.124";
};

zone "example.com" in {
        type master;
        file "example.com";
};

zone "example.net" in {
        type master;
        file "example.net";
};

// With another ~20 definitions like that

这对我来说似乎效率很低.有没有一种方法可以自动加载找到目录{directory“/ some / folder”}所指定目录的所有文件,并假设每个文件都有主?

解决方法

不,没有办法在named.conf及其包含的文件中执行此操作.必须明确定义每个区域,以及最少的类型和数据源.如果它们包含的记录应该是完全重复的,您可以让多个区域引用同一个文件,但这是唯一的快捷方式.

其他选项可以在全局选项块中设置其默认值(allow-transfer,also-notify等),但您仍然难以定义每个区域和必填字段.

为了完整起见,我会提到BIND的新版本的一个例外,我强烈建议不要这样做.你可以使用新的rndc addzone功能来动态远程创建一个区域,但是它真正做的是创建一个带有散列名称的附加配置文件(即文件名中的随机字符)和一个BIND“知道”的.nzf后缀载入.从可维护性的角度来看,这是非常糟糕的,因为它违反了principle of least surprise/astonishment;主配置文件不引用这些附加配置文件,其他管理员不知道这些文件的内容是否被加载,除非他们熟悉该功能. (而且非常的DNS管理员是因为它的新颖性)

07001

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 and rndc modzone.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读