Unbound:搭建私有DNS服务教程软件LinuxServer

印迹发布于:2019-4-12 2236

简介

unbound是一个验证、递归和缓存DNS解析器,是一个开源local dns,支持edns-client-subnet(bind不支持edns-client-subnet)。

官网:https://nlnetlabs.nl/projects/unbound/about/

下载:https://nlnetlabs.nl/projects/unbound/download/

安装 

将安装路径设置到/opt/unbound

tar zxvf unbound-1.7.8.tar.gz
cd unbound-1.7.8
./configure --prefix=/opt/unbound
make
make install

创建运行用户

groupadd unbound
useradd -s /sbin/nologin -M unbound
配置文件
vim /opt/unbound/etc/unbound/unbound.conf
server:
verbosity: 1
num-threads: 2 #线程数
interface: 127.0.0.1 #监听地址(一般写本机内网ip)
interface: 192.168.3.10 #监听地址(一般写本机内网ip)
interface: ::0
port: 53 #端口
so-reuseport: yes #为每个线程的传入查询打开专用侦听套接字。可以更均匀地将传入查询分布到线程
cache-min-ttl: 60 #解析最小缓存时间
cache-max-ttl: 600 #解析最大缓存时间
outgoing-range: 8192
access-control: 192.0.0.0/8 allow #访问控制(允许10段ip访问本机)
access-control: 127.0.0.1/8 allow #允许本机访问
access-control: ::0/0 allow #允许ipv6网段访问
prefetch: yes #消息缓存元素在它们到期之前被预取以保持缓存是最新的
do-ip4: yes
do-ip6: yes
do-udp: yes
do-tcp: yes
do-daemonize: yes
so-rcvbuf: 8m
so-sndbuf: 8m
msg-cache-size: 64m #消息缓存的字节数。 默认值为4 MB。
rrset-cache-size: 128m #RRset缓存的字节数。
outgoing-num-tcp: 256 #为每个线程分配的传出TCP缓冲区数
incoming-num-tcp: 1024 #为每个线程分配的传入TCP缓冲区数
include: "/opt/unbound/etc/unbound/zone.conf" #zone.conf文件内容为解析内容,如local-data: "m.baidu.com A 192.168.10.1",也可以使用下面注释的方式配置解析
# local-data: "m.baidu.com 600 A 192.168.10.1" #其中600为解析缓存时间
#python:
remote-control: #这个区间为unbound控制设置。配置如下内容可以控制unbound服务,利用unbound-control命令对该服务执行开启、关闭、重启等操作。
control-enable: yes
control-interface: 127.0.0.1
control-port: 8953
server-key-file: "/opt/unbound/etc/unbound/unbound_server.key"
server-cert-file: "/opt/unbound/etc/unbound/unbound_server.pem"
control-key-file: "/opt/unbound/etc/unbound/unbound_control.key"
control-cert-file: "/opt/unbound/etc/unbound/unbound_control.pem"
forward-zone: #这个区间为转发设置
name: "."
forward-addr: 8.8.8.8

生成密钥

/opt/unbound/sbin/unbound-control-setup

检查配置文件

/opt/unbound/sbin/unbound-checkconf

启动服务

/opt/unbound/sbin/unbound -c /opt/unbound/etc/unbound/unbound.conf


http://www.virplus.com/thread-283.htm

转载请注明:2019-4-12 于 VirPlus 发表

推荐阅读
最新回复 (0)

    ( 登录 ) 后,可以发表评论!

    返回