首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >设置绑定以使用nsupdate (SERVFAIL)

设置绑定以使用nsupdate (SERVFAIL)
EN

Server Fault用户
提问于 2012-08-06 15:29:51
回答 3查看 25.8K关注 0票数 9

我正在尝试使用nsupdate动态更新我的DNS-服务器。

先决条件

我在我的DNS服务器上使用Debian 6,在我的客户端上使用Debian 4.

我使用以下方法创建了一个公钥/私钥对:

代码语言:javascript
复制
dnssec-keygen -C -a HMAC-MD5 -b 512 -n USER sub.example.com.

然后,我编辑了我的named.conf.local,以包含我的公钥和我希望更新的新区域。现在看起来是这样的(注意:我还尝试了允许更新{ any;};但没有成功):

代码语言:javascript
复制
zone "example.com" {
        type master;
        file "/etc/bind/primary/example.com";
        notify yes;
        allow-update { none; };
        allow-query { any; };
};

zone "sub.example.com" {
        type master;
        file "/etc/bind/primary/sub.example.com";
        notify yes;
        allow-update { key "sub.example.com."; };
        allow-query { any; };
};

key sub.example.com. {
        algorithm HMAC-MD5;
        secret "xxxx xxxx";
};

接下来,我将私钥文件(key.private)复制到要更新专区的另一台服务器上。我还在这个服务器上创建了一个文本文件( update ),其中包含了更新信息(注意:我也尝试过玩这些东西。(没有成功):

代码语言:javascript
复制
server example.com
zone sub.example.com
update add sub.example.com. 86400 A 10.10.10.1
show
send

现在,我尝试使用以下方法更新区域:

代码语言:javascript
复制
nsupdate -k key.private -v update

问题

上述命令提供了以下输出:

代码语言:javascript
复制
Outgoing update query:
;; ->>HEADER<<- opcode: UPDATE, status: NOERROR, id:      0
;; flags: ; ZONE: 0, PREREQ: 0, UPDATE: 0, ADDITIONAL: 0
;; ZONE SECTION:
;sub.example.com.       IN  SOA

;; UPDATE SECTION:
sub.example.com.    86400   IN  A   10.10.10.1

update failed: SERVFAIL

当我在远程服务器上发出nsupdate命令时,命名调试级别3提供了以下信息(注意:我混淆了客户机IP):

代码语言:javascript
复制
06-Aug-2012 14:51:33.977 client X.X.X.X#33182: new TCP connection
06-Aug-2012 14:51:33.977 client X.X.X.X#33182: replace
06-Aug-2012 14:51:33.978 clientmgr @0x2ada3c7ee760: createclients
06-Aug-2012 14:51:33.978 clientmgr @0x2ada3c7ee760: recycle
06-Aug-2012 14:51:33.978 client @0x2ada475f1120: accept
06-Aug-2012 14:51:33.978 client X.X.X.X#33182: read
06-Aug-2012 14:51:33.978 client X.X.X.X#33182: TCP request
06-Aug-2012 14:51:33.978 client X.X.X.X#33182: request has valid signature
06-Aug-2012 14:51:33.978 client X.X.X.X#33182: recursion not available
06-Aug-2012 14:51:33.978 client X.X.X.X#33182: update
06-Aug-2012 14:51:33.978 client X.X.X.X#33182: send
06-Aug-2012 14:51:33.978 client X.X.X.X#33182: sendto
06-Aug-2012 14:51:33.979 client X.X.X.X#33182: senddone
06-Aug-2012 14:51:33.979 client X.X.X.X#33182: next
06-Aug-2012 14:51:33.979 client X.X.X.X#33182: endrequest
06-Aug-2012 14:51:33.979 client X.X.X.X#33182: read
06-Aug-2012 14:51:33.986 client X.X.X.X#33182: next
06-Aug-2012 14:51:33.986 client X.X.X.X#33182: request failed: end of file
06-Aug-2012 14:51:33.986 client X.X.X.X#33182: endrequest
06-Aug-2012 14:51:33.986 client X.X.X.X#33182: closetcp

但它什么也做不了。该区域没有更新,也没有更改任何内容。我不确定文件/etc/bind/primary/sub.example.com是否应该存在于第一次更新之前。我尝试了没有文件,一个空文件和一个预先配置的区域文件。但没有成功。

我在网络上发现的稀疏信息指向了关于绑定工作目录的文件和文件夹权限,因此我更改了/etc/bind和/var/cache/bind (这是我的" bind“用户的主目录)的权限。

我不能百分之百确定权限是否正确..。但在我看来很好:

代码语言:javascript
复制
ls -lah /var/cache/bind/
total 224K
drwxrwxr-x  2 bind bind 4.0K Aug  6 03:13 .
drwxr-xr-x 12 root root 4.0K Jul 21 11:27 ..
-rw-r--r--  1 bind bind 211K Aug  6 03:21 named.run

ls -lah /etc/bind/
total 72K
drwxr-sr-x  3 bind bind 4.0K Aug  6 14:41 .
drwxr-xr-x 87 root root 4.0K Jul 30 01:24 ..
-rw-------  1 bind bind  125 Aug  6 02:54 key.public
-rw-------  1 bind bind  156 Aug  6 02:54 key.private
-rw-r--r--  1 bind bind 2.5K Aug  6 03:07 bind.keys
-rw-r--r--  1 bind bind  237 Aug  6 03:07 db.0
-rw-r--r--  1 bind bind  271 Aug  6 03:07 db.127
-rw-r--r--  1 bind bind  237 Aug  6 03:07 db.255
-rw-r--r--  1 bind bind  353 Aug  6 03:07 db.empty
-rw-r--r--  1 bind bind  270 Aug  6 03:07 db.local
-rw-r--r--  1 bind bind 3.0K Aug  6 03:07 db.root
-rw-r--r--  1 bind bind  493 Aug  6 03:32 named.conf
-rw-r--r--  1 bind bind  490 Aug  6 03:07 named.conf.default-zones
-rw-r--r--  1 bind bind 1.2K Aug  6 14:18 named.conf.local
-rw-r--r--  1 bind bind  666 Jul 29 22:51 named.conf.options
drwxr-sr-x  2 bind bind 4.0K Aug  6 03:57 primary/
-rw-r-----  1 root bind   77 Mar 19 02:57 rndc.key
-rw-r--r--  1 bind bind 1.3K Aug  6 03:07 zones.rfc1918

ls -lah /etc/bind/primary/
total 20K
drwxr-sr-x 2 bind bind 4.0K Aug  6 03:57 .
drwxr-sr-x 3 bind bind 4.0K Aug  6 14:41 ..
-rw-r--r-- 1 bind bind  356 Jul 30 00:45 example.com
EN

回答 3

Server Fault用户

发布于 2018-07-13 17:19:21

在更改存储区域文件的位置之前,我遇到了非常类似的问题。

绑定具有写入/var/cache/bind的权限,但您的区域文件存储在/etc/bind/...中。Bind目前没有写入/etc/bind/...中文件的权限,因此您需要更新Bind的权限或将区域文件存储在Bind具有适当权限的目录中。我将介绍将区域文件移动到动态区域(/var/lib/bind/)推荐目录的简单步骤。

  1. 使用mv (可能需要以root方式执行)移动区域文件mv /etc/bind/primary/example.com /var/lib/bind/主要/ mv /etc/bind/primary/sub.example.com /var/lib/bind/primary/
  2. 更新named.conf配置中的文件路径。在您的示例中,这意味着更新/etc/bind/named.conf.local区域"example.com“{ type master;example.com "/var/lib/bind/primary/example.com";//该行更改/为清晰}删除的其他内容;区域"sub.example.com”{类型主;文件"/var/lib/bind/primary/sub.example.com";//该行更改/为清晰度删除的其他内容;
  3. service bind9 restart重新启动绑定
票数 7
EN

Server Fault用户

发布于 2013-09-03 04:25:53

参见nsupdate中的部分。

代码语言:javascript
复制
   With the -k option, nsupdate reads the shared secret from the file
   keyfile. Keyfiles may be in two formats: a single file containing a
   named.conf-format key statement, which may be generated automatically
   by ddns-confgen, or a pair of files whose names are of the format
   K{name}.+157.+{random}.key and K{name}.+157.+{random}.private, which
   can be generated by dnssec-keygen. The -k may also be used to specify a
   SIG(0) key used to authenticate Dynamic DNS update requests. In this
   case, the key specified is not an HMAC-MD5 key.

因此,如果要将其重新格式化为

代码语言:javascript
复制
key sub.example.com. {
        algorithm HMAC-MD5;
        secret "xxxx xxxx";
};

表单并将其留在文件中,它将工作,或者可以选择-k K{name}.+157.+{random}.*

票数 1
EN

Server Fault用户

发布于 2016-05-02 01:33:38

对于dyndns更新,绑定必须能够写入区域使用的文件夹。在我看来,/etc不是存储此类信息的合适位置,查看您的权限等等是bind无法写的。

我建议尝试/var/bind目录,以便bind可以写入它。

票数 1
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/414734

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档