knot DNS 01 Tips

  • CentOS/RPM packages install
  • Source code install
    • userspace-rcu
    • compile
  • Configure knot.conf
  • Start service
  • Test
  • Reference

https://www.knot-dns.cz
Knot DNS 是一个高性能的开源权威 DNS 服务器,支持所有 DNS 系统的关键特性, 号称第3个支持完全RFC标准的DNS服务器(另外2个为: BIND & NSD), 并已运行在顶级域名.cz服务器提供服务.

注: knot 3.0 支持 XDP (AF_XDP) 高性能模式, 但是需升级内核到 4.18.x(推荐使用 5.x 内核).

CentOS/RPM packages install

#CentOS-7
wget https://copr.fedorainfracloud.org/coprs/g/cznic/knot-dns-latest/repo/epel-7/group_cznic-knot-dns-latest-epel-7.repo -O /etc/yum.repos.d/knot.repo
#CentOS-8
dnf install epel-release -y
dnf update "kernel*" -y
wget  https://copr.fedorainfracloud.org/coprs/g/cznic/knot-dns-latest/repo/epel-8/group_cznic-knot-dns-latest-epel-8.repo  -O /etc/yum.repos.d/knot.repo
dnf install -y userspace-rcu gnutls lmdb libnghttp2  fstrm protobuf-c libmaxminddb libidn2 libidn lmdb-libs
dnf install -y knot knot-utils

Source code install

Knot 利用 userspace-rcu 库(Linux Kernel Read-Copy-Update (RCU) 用户空间实现版本) 技术消耗更多的内存来加速DNS响应:

userspace-rcu

git clone git://git.liburcu.org/userspace-rcu.git
cd userspace-rcu
./bootstrap
./configure --prefix=/opt/knot
make -j31 install

compile

dnf install -y gnutls-devel  userspace-rcu  lmdb-devel  libnghttp2-devel   protobuf-c-compiler  fstrm-devel   protobuf-c-devel  libmaxminddb-devel
wget https://secure.nic.cz/files/knot-dns/knot-3.0.0.tar.xz
tar -Jxvf knot-3.0.0
cd knot-3.0.0
./autogen.sh
./configure --prefix=/opt/knot --enable-xdp=yes --enable-dnstap
make -j31 install

Configure knot.conf

RPM 安装默认配置路径: /etc/knot/knot.conf
Source code 安装配置路径(–prefix=/opt/knot): /opt/knot/etc/knot.conf

listen:
配置DNS IPv4 & IPv6 监控地址&端口, 默认监听端口53, 监听地址IPv4 127.0.0. IPv6 ::1, 修改为监听任意地址:

listen: [ 0.0.0.1@53, ::@53 ]

log:
配置日志记录方式, 默认为输出syslog, 这里修改为stdout并启用调试(debug).

log:- target: stdoutany: debug

template:
配置域名zone存储路径, 支持bind zone配置文件, 默认为${prefix}/var/lib/knot:

template:- id: defaultstorage: "/var/lib/knot"file: "%s.zone"

zone:
配置域名.

zone:- domain: example.com

zone example.com:

$ORIGIN example.com.
$TTL 3600@ SOA dns1.example.com. hostmaster.example.com. (2010111213   ; serial6h      ; refresh1h     ; retry1w       ; expire1d )        ; minimumNS dns1NS  dns2MX  10 maildns1 A   192.0.2.1AAAA   2001:DB8::1dns2 A   192.0.2.2AAAA   2001:DB8::2mail A   192.0.2.3AAAA   2001:DB8::3

knot.conf完整配置:

# This is a sample of a minimal configuration file for Knot DNS.
# See knot.conf(5) or refer to the server documentation.server:rundir: "/var/run/knot"user: knot:knotlisten: [ 0.0.0.1@53, ::@53 ]log:- target: stdoutany: debugdatabase:storage: "/var/lib/knot"remote:
#  - id: slave
#    address: 192.168.1.1@53
#
#  - id: master
#    address: 192.168.2.1@53acl:
#  - id: acl_slave
#    address: 192.168.1.1
#    action: transfer#  - id: acl_master
#    address: 192.168.2.1
#    action: notifytemplate:- id: defaultstorage: "/var/lib/knot"file: "%s.zone"zone:
#    # Master zone- domain: example.com.
#    notify: slave
#    acl: acl_slave#    # Slave zone
#  - domain: example.net
#    master: master
#    acl: acl_master

Start service

RPM install with systectl:

systemctl restart knot
journalctl -xe
...
-- Unit knot.service has begun starting up.
Sep 26 20:58:25 centos8-43 knotc[2996]: Configuration is valid
Sep 26 20:58:36 centos8-43 knotd[2998]: info: Knot DNS 3.0.0 starting
Sep 26 20:58:36 centos8-43 knotd[2998]: info: loaded configuration file '/etc/knot/knot.conf'
Sep 26 20:58:36 centos8-43 knotd[2998]: info: using reuseport for UDP
Sep 26 20:58:36 centos8-43 knotd[2998]: error: failed to increase RLIMIT_MEMLOCK (Operation not permitted)
Sep 26 20:58:36 centos8-43 knotd[2998]: error: failed to configure server sockets (system error)
Sep 26 20:58:36 centos8-43 knotd[2998]: info: loading 1 zones
Sep 26 20:58:36 centos8-43 knotd[2998]: info: [example.com.] zone will be loaded
Sep 26 20:58:36 centos8-43 knotd[2998]: info: starting server
Sep 26 20:58:36 centos8-43 knotd[2998]: info: [example.com.] zone file parsed, serial 2010111213
Sep 26 20:58:36 centos8-43 knotd[2998]: info: [example.com.] loaded, serial none -> 2010111213, 438 bytes
Sep 26 20:58:36 centos8-43 knotd[2998]: info: server started in the foreground, PID 2998
Sep 26 20:58:36 centos8-43 knotd[2998]: info: control, binding to '/var/run/knot/knot.sock'
Sep 26 20:58:36 centos8-43 systemd[1]: Started Knot DNS server.
-- Subject: Unit knot.service has finished start-up
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- Unit knot.service has finished starting up.
...

source code install with knotd :

# /opt/knot/sbin/knotd  -v
2020-09-26T20:57:58-0400 debug: module 'mod-cookies', loaded static
2020-09-26T20:57:58-0400 debug: module 'mod-dnsproxy', loaded static
2020-09-26T20:57:58-0400 debug: module 'mod-geoip', loaded static
2020-09-26T20:57:58-0400 debug: module 'mod-noudp', loaded static
2020-09-26T20:57:58-0400 debug: module 'mod-onlinesign', loaded static
2020-09-26T20:57:58-0400 debug: module 'mod-queryacl', loaded static
2020-09-26T20:57:58-0400 debug: module 'mod-rrl', loaded static
2020-09-26T20:57:58-0400 debug: module 'mod-stats', loaded static
2020-09-26T20:57:58-0400 debug: module 'mod-synthrecord', loaded static
2020-09-26T20:57:58-0400 debug: module 'mod-whoami', loaded static
2020-09-26T20:57:58-0400 info: Knot DNS 3.1.dev starting
2020-09-26T20:57:58-0400 info: loaded configuration file '/opt/knot/etc/knot/knot.conf'
2020-09-26T20:57:58-0400 info: using reuseport for UDP
2020-09-26T20:57:58-0400 info: binding to interface /opt/knot/var/run/knot/0.0.0.0.1@53
2020-09-26T20:57:58-0400 warning: cannot ensure optimal CPU locality for UDP
2020-09-26T20:57:58-0400 info: binding to interface ::@53
2020-09-26T20:57:58-0400 info: changing GID to 985
2020-09-26T20:57:58-0400 info: changing UID to 989
2020-09-26T20:57:58-0400 info: loading 1 zones
2020-09-26T20:57:58-0400 info: [example.com.] zone will be loaded
2020-09-26T20:57:58-0400 info: starting server
2020-09-26T20:57:58-0400 info: [example.com.] zone file parsed, serial 2010111213
2020-09-26T20:57:58-0400 info: [example.com.] loaded, serial none -> 2010111213, 438 bytes
2020-09-26T20:57:58-0400 info: server started in the foreground, PID 2923
2020-09-26T20:57:58-0400 info: control, binding to '/opt/knot/var/run/knot/knot.sock'

Test

[root@centos8-43 ~]# kdig @127.0.0.1 dns1.example.com
;; ->>HEADER<<- opcode: QUERY; status: NOERROR; id: 50048
;; Flags: qr aa rd; QUERY: 1; ANSWER: 1; AUTHORITY: 0; ADDITIONAL: 0;; QUESTION SECTION:
;; dns1.example.com.        IN  A;; ANSWER SECTION:
dns1.example.com.       3600    IN  A   192.0.2.1;; Received 50 B
;; Time 2020-09-26 20:56:20 EDT
;; From 127.0.0.1@53(UDP) in 0.2 ms
[root@centos8-43 ~]# kdig @127.0.0.1 mail.example.com
;; ->>HEADER<<- opcode: QUERY; status: NOERROR; id: 3077
;; Flags: qr aa rd; QUERY: 1; ANSWER: 1; AUTHORITY: 0; ADDITIONAL: 0;; QUESTION SECTION:
;; mail.example.com.        IN  A;; ANSWER SECTION:
mail.example.com.       3600    IN  A   192.0.2.3;; Received 50 B
;; Time 2020-09-26 20:56:28 EDT
;; From 127.0.0.1@53(UDP) in 0.1 ms

Reference

https://lwn.net/Articles/573424/

Knot DNS: A high-performance, authoritative DNS server

Knot DNS official site

knot DNS 01 Tips相关推荐

  1. Knot DNS架构详解3-查询动态定义

    这个系列文章源于网络资料和自己的总结.关于Knot DNS分析的文章网络上不多,由于我的水平有限,错误在所难免.欢迎大家批评指正. 一.什么是查询动态定义 Knot DNS的查询处理流程可以根据配置文 ...

  2. Knot DNS架构详解0-简介

    这个系列文章源于网络资料和自己的总结.关于Knot DNS分析的文章网络上不多,由于我的水平有限,错误在所难免.欢迎大家批评指正. 什么是Knot DNS Knot DNS是一个开源DNS软件,仅提供 ...

  3. Knot DNS架构详解1-概述

    这个系列的文章大多源于网络和自己的总结.关于Knot分析的文章网络不是很多,由于我的水平有限,错误在所难免.欢迎大家批评指正 概述 本篇主要分析Knot架构不涉及具体细节分析.后续会不断完善 Knot ...

  4. DNS CAA 记录及创建方法

    请访问原文链接:https://sysin.cn/blog/dns-caa/,查看最新版.原创作品,转载请保留出处. 作者:gc(at)sysin.org,主页:www.sysin.cn 关于 CAA ...

  5. 运维基础(2)实用工具篇

    欢迎关注微信公众号[厦门微思网络].www.xmws.cn专业IT认证培训19周年 主要课程:思科.华为.红帽.ORACLE.VMware.CISP.PMP等认证培训及考证 统一帐号管理 你还在自己写 ...

  6. openstack 功能_2016年OpenStack的新功能:看一下Newton版本

    openstack 功能 OpenStack的发布周期为六个月,每个发行版都有一个代号,名称以字母的连续字母开头. 10月7日,OpenStack Newton发布了. 让我们看一下OpenStack ...

  7. C程序员必须知道的内存知识【英】

    C程序员必须知道的内存知识[英] 时间 2015-03-08 14:16:11 极客头条原文  http://marek.vavrusa.com/c/memory/2015/02/20/memory/ ...

  8. 免费手机上网的方法,比GPRS网速快很多(好东西与大家分亨)

    S60手机 蓝牙共享PC宽带完全教程 手机 通过GPRS上网早已普及,作为symbian操作系统的S60智能手机 更是不在话下.本教程为你带来的则是手机 利用蓝牙共享到PC宽带上网的方法. 名正才能言 ...

  9. IT运维管理常用工具大全,让你成为真正的高手

    统一帐号管理 你还在自己写脚本批量增加机器的用户名.分组和修改密码或者同步主机的/etc/passwd吗?你还在使用脚本批量对用户设置权限吗? 如果有一台帐号主机能够提供所有服务器的帐号.密码.权限控 ...

  10. Turbo PMAC控制卡步进电机控制

    这里写自定义目录标题 Turbo PMAC控制卡步进电机控制 Turbo PMAC控制卡步进电机控制 PMAC控制卡的步进电机控制程序,用自带的软件所需要的参数以及他的意义. 名称:I7m03 描述: ...

最新文章

  1. 父与子的编程python_父母在人生尚有来处,父母去人生只剩归途!(看一次,哭一次)...
  2. 直接拿来用!最火的iOS开源项目
  3. c语言prime函数怎么用_n!函数用C语言其实可以这样!
  4. OpenCV中VideoWriter输出视频文件为空或6KB解决方法(java)
  5. lvdt 运放全波整流接线方式_常见的几种二极管整流电路解析
  6. android透明activity,Android 简单实现透明Activity
  7. JAVAEE框架之Spring JdbcTemplate
  8. 论文浅尝 | 打通推荐系统与知识图谱: 第一个公开的大规模链接数据集合
  9. 计算机科学与软件工程的区别
  10. OpenShift 4 之运行Istio的BookInfo微服务应用
  11. 使用jQuery获取GridView的数据行的数量
  12. flume和sqoop导数据的区别
  13. powershell免杀思路分析(过某60和某绒)
  14. 手机html在哪个文件里,手机相册在哪个文件夹,教您手机图片存放在哪里
  15. [转]performSelector延时调用导致的内存泄露
  16. js正则贪婪模式_js 正则表达式问题 贪婪与非贪婪
  17. 英语单词记忆方法20种
  18. 转:人生最优策略:你发现自己的天赋了吗?
  19. buaa oo-unit3
  20. 工科生的Java Hello World 透视投影动画 二-----和我一起熟悉Java的数组,列表,类型,和JFrame GUI初步

热门文章

  1. android各版本对应的SDK level(包括android 10)
  2. AS1.3 及其以上预览版新插件-实验版(NDK)
  3. BZOJ3566[SHOI2014] 概率充电器
  4. MongoDB学习(黑马教程)-5-数据库MongoDB的验证
  5. php curl获取404,php使用curl判断网页404(不存在)的方法
  6. 前端页面怎么办啊一条长的信息换行展示_前端入门!不容错过!HTML基本标签知识大盘点...
  7. javamail 解码 base64 html格式邮件_关于JavaMail,我遇上的那些史前巨坑...(建议收藏)
  8. java子弹集合_Java使用线程并发库模拟弹夹装弹以及发射子弹的过程
  9. 开机广播没反映_我州首部反映脱贫攻坚成效的电影《冲锋号》在鹤峰开机
  10. php 判断输入字符串,php 判断(输入框) 字符串函数