SuperAPI AI 工具集

unbound

通用与其它

查看项目

更新于 10-15 23:48

技能介绍

用途:围绕 Unbound 递归 DNS 解析器提供配置、DNSSEC 验证、root hints 维护、性能调优、Pi-hole 集成与排障的操作参考。

身份与环境:服务单元 unbound.service;配置位于 /etc/unbound/unbound.conf 与 /etc/unbound/unbound.conf.d/;root hints 位于 /usr/share/dns/root.hints 或 /var/lib/unbound/root.hints;日志用 journalctl -u unbound 查看;运行用户为 unbound,启动后降权。

安装:apt install unbound 或 dnf install unbound。控制工具为 unbound-control,需先执行 sudo unbound-control-setup 完成密钥配置。

主要命令:检查配置 sudo unbound-checkconf;重载配置 sudo systemctl reload unbound 或 sudo unbound-control reload;重启 sudo systemctl restart unbound;清空缓存 sudo unbound-control flush_zone .;测试解析 dig @127.0.0.1 google.com;测试 DNSSEC 用 dig @127.0.0.1 dnssec.works(应解析)与 dig @127.0.0.1 fail.dnssec.works(应返回 SERVFAIL);查看统计 sudo unbound-control stats_noreset;更新 root hints:sudo curl -o /var/lib/unbound/root.hints https://www.internic.net/domain/named.cache。

端口与集成:默认监听 53/udp+tcp;与 Pi-hole 配合时通常监听 127.0.0.1 的 5335 端口,Pi-hole 占用 53。用 ss -ulnp | grep unbound 验证。

健康检查:systemctl is-active unbound 为 active;unbound-checkconf 无错误;dig 测试成功;fail.dnssec.works 返回 SERVFAIL 说明 DNSSEC 生效。

常见问题:端口 53 冲突多因 systemd-resolved 或其他 DNS 服务,需停用冲突服务;有效域名 SERVFAIL 多因 DNSSEC 验证失败或上游问题,可先用 dig @8.8.8.8 确认上游,再检查 root hints;Pi-hole 报 access denied 需添加 access-control: 127.0.0.1/32 allow 或对应 IP;解析慢可更新 root hints 并预热缓存;重载失败多为语法错误,用 unbound-checkconf 定位。

限制与注意:默认仅允许本机访问,远程客户端需用 access-control 显式放行子网;默认仅监听 localhost,全网解析需设置 interface: 0.0.0.0;DNSSEC 开启后对配置损坏的域名会直接 SERVFAIL,这是预期行为,可用 unbound-host 诊断;默认缓存较小,可增大 msg-cache-size 与 rrset-cache-size(rrset 约为 msg 的两倍)。root hints 建议定期更新。资料未提供更详细的收费、平台或性能指标。