使用 Unbound 作为局域网 DNS 代理服务器

May 22, 2026 • 预计阅读时间 1 分钟

配置目标:客户端发起 DNS 查询时,避免 Unbound 服务器频繁向上游服务器发起查询请求,直接把缓存结果返回给客户端。

因为大部分服务的 DNS 记录是基本不变的,默认情况下 DNS 的存活时间是 300 秒,超过了这个时间就会重新发起 DNS 解析查询,这样显然浪费了网络资源。

server:
  prefetch: yes
  cache-min-ttl: 300
  serve-expired: yes
  serve-expired-reply-ttl: 300
  serve-expired-ttl: 86400
  serve-expired-ttl-reset: yes

参考资料

unboundDNS
版权声明:如果转发请带上本文链接和注明来源。

lvv.me

iOS/macOS Developer

在 Debian 上完全卸载 exim4