Linux教程网

使用knot搭建DNS域名服务

服务安装

我的环境是 ubuntu,通过 apt 直接安装

1
$ apt install knot knot-dnsutils

启动 knot 服务

1
$ systemctl start knot

配置服务

默认配置文件是 /etc/knot/knot.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
server:
listen: 0.0.0.0@53
listen: ::@53
log:
- target: syslog
any: info
template:
- id: default
storage: "/var/lib/knot"
file: "%s.zone"
zone:
- domain: linux.com
file: "linux.com.zone"

几个配置项的解释说明:

  • /var/lib/knot 存储域名 zone 文件
  • linux.com 解析域名
  • linux.com.zone 域名 zone 文件

下边是域名 zone 文件的示例配置

1
2
3
4
5
6
7
;; Zone dump (Knot DNS 2.7.8)
linux.com. 3600 SOA ns1.linux.com. admin.linux.com. 2021020415 60 60 1800 60
linux.com. 3600 NS ns1.linux.com.
linux.com. 3600 NS ns2.linux.com.
41.linux.com. 600 A 172.16.61.62
42.linux.com. 600 A 172.16.61.162
v6.linux.com. 600 AAAA 9000::6172

执行 reload 命令重新加载配置

1
$ systemctl reload knot

专题:

本文发表于 2024-09-18,最后修改于 2025-01-24。

本站永久域名「 golinuxblog.com 」,也可搜索「 Linux教程网 」找到我。


上一篇 « 使用火焰图来分析性能问题 下一篇 » Linux系统性能分析利器lsof

推荐阅读

Big Image