1、unbound介绍下载安装
打开网址NLnet Labs - Unbound - Download
下载想下载的版本,这里我下载的是unbound-1.10.0。
解压unbound-1.10.0.tar.gz
./configure --prefix=/usr/local/unbound --with-pthreads --with-libevent --with-ssl
make && make install
2、配置文件
根据configue的参数,目录安装在/usr/local/unbound下
随便网上找个了配置文件
server:
verbosity: 1
num-threads: 2 #线程数
interface: 0.0.0.0 #监听地址(一般写本机内网ip)
interface: ::0
port: 53 #端口
so-reuseport: yes #为每个线程的传入查询打开专用侦听套接字。可以更均匀地将传入查询分布到线程
cache-min-ttl: 60 #解析最小缓存时间
cache-max-ttl: 600 #解析最大缓存时间
outgoing-range: 8192
access-control: ::0/0 allow #允许ipv6网段访问
access-control: 0.0.0.0/0 allow #允许所有人访问
prefetch: yes #消息缓存元素在它们到期之前被预取以保持缓存是最新的
do-ip4: yes
do-ip6: yes
do-udp: yes
do-tcp: 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: "zone.conf" #zone.conf文件内容为解析内容,如local-data: "m.baidu.com A 192.168.10.1",也可以使用下面注释的方式配置解析
local-zone: "m.mytest.com" redirect
local-data: "m.mytest.com 600 A 111.222.333.444" #其中600为解析缓存时间
local-zone: "m.youtest.com" redirect
local-data: "m.youtest.com 600 IN CNAME www.baidu.com"
#python:
remote-control: #这个区间为unbound控制设置。配置如下内容可以控制unbound服务,利用unbound-control命令对该服务执行开启、关闭、重启等操作。
control-enable: yes
control-interface: 127.0.0.1
control-port: 8953
server-key-file: "/usr/local/unbound/etc/unbound/unbound_server.key"
server-cert-file: "/usr/local/unbound/etc/unbound/unbound_server.pem"
control-key-file: "/usr/local/unbound/etc/unbound/unbound_control.key"
control-cert-file: "/usr/local/unbound/etc/unbound/unbound_control.pem"
forward-zone: #这个区间为转发设置
name: "."
forward-addr: 8.8.8.8
3、查看启动参数
cd /usr/local/unbound/
./sbin/unbound -h
usage: unbound [options]
start unbound daemon DNS resolver.
-h this help.
-c file config file to read instead of /usr/local/unbound/etc/unbound/unbound.conf
file format is described in unbound.conf(5).
-d do not fork into the background.
-p do not create a pidfile.
-v verbose (more times to increase verbosity).
-V show version number and build options.