我正在寻找有关如何配置 dhcpd 以便它将更新发送到 BIND 的信息。我可以看到对于BIND,我需要设置allow-update选项,但我不知道如何配置dhcpd。
我找到了 dhclient 的示例配置来注册自己,但我只对 dhcpd 进行注册感兴趣。我希望能够在客户端上设置主机名,重新启动它,然后它的主机名将通过 dhcpd 在 BIND 中注册。
有没有人有这方面的信息?
您需要告诉 dhcpd 它需要执行动态 DNS 更新。为此,请将其添加到您的 dhcpd.conf 文件中:
ddns-update-style standard;
ddns-rev-domainname "in-addr.arpa.";
deny client-updates;
do-forward-updates on;
update-optimization off;
update-conflict-detection off;
Run Code Online (Sandbox Code Playgroud)
为了安全起见,您可以在 dhcpd 和 BIND 之间设置密钥验证。密钥文件可以包含在 dhcpd 和 BIND 配置文件中。密钥文件应如下所示:
key "key-name" {
algorithm hmac-sha256; # you can use another algorithm if desired
secret "<secret passphrase here>";
};
Run Code Online (Sandbox Code Playgroud)
您的 BIND 安装可能包含一个“ddns-confgen”工具,可以帮助您生成密钥文件。
然后您可以将 DNS 区域声明添加到您的 dhcpd.conf 文件中。它们指定应将更新发送到哪个 DNS 服务器,以及可选的要使用的密钥:
include "/some/where/ddns-keyfile.key";
zone example.org. { # name of your forward DNS zone
primary 11.22.33.44; # DNS server IP address here
key key-name;
}
zone 1.168.192.in-addr.arpa. { # name of your reverse DNS zone
primary 11.22.33.44; # DNS server IP address here
key key-name;
}
Run Code Online (Sandbox Code Playgroud)
请注意,dhcpd.conf 中需要区域名称中的最后一个点。
在 BIND 配置文件(通常为 named.conf)中,您需要如下内容:
include "/some/where/ddns-keyfile.key";
zone "example.org" { # name of your forward DNS zone
type master;
file "/some/where/db.example.org"; # name of your zone file
update-policy {
grant key-name zonesub A TXT DHCID;
};
};
zone "1.168.192.in-addr.arpa" { # name of your reverse DNS zone
type master;
file "/some/where/db.192.168.1"; # name of your zone file
update-policy {
grant key-name zonesub PTR TXT DHCID;
};
};
Run Code Online (Sandbox Code Playgroud)
“更新优化关闭”设置使 dhcpd 始终为 BIND 发送更新请求,这对测试很有用。一旦您对您的设置工作感到满意,您就可以打开更新优化:这样 dhcpd 只会在 DNS 记录确实需要更改时才发送更新。如果它们已经具有所需的值,则不会发送更新。
如果您的系统同时具有无线和有线连接,并且您偶尔会在两者之间切换,则“更新冲突检测关闭”设置会很有用。这允许具有相同主机名的新记录覆盖旧记录,即使客户端网络接口的 MAC 地址不同。(对于笔记本电脑,无线连接通常更方便,但对于大量下载,我更喜欢有线连接的更好吞吐量。)
| 归档时间: |
|
| 查看次数: |
9261 次 |
| 最近记录: |