简介
Unbound是一个快速精巧的DNS服务器,可以在FreeBSD,OpenBSD,NetBSD,MacOS,Linux和Microsoft Windows上运行。相比bind的配置简单多了。

下载
wget -c https://nlnetlabs.nl/downloads/unbound/unbound-1.9.6.tar.gz
解压编译安装
tar zxvf unbound-1.9.6.tar.gzcd unbound-1.9.6./configure --prefix=/usr/local/unboundmakemake install
创建运行用户
useradd -s /usr/bin/nologin -M unbound
创建密钥

/usr/local/unbound/sbin/unbound-control-setup
默认配置文件路径
在编译的时候制定prefix,就会在安装路径下的etc/unbound目录中,找到配置文件unbound.conf
server:
# 日志级别,默认是1
verbosity: 1
# 线程数
num-threads: 2
# 监听地址
interface: 0.0.0.0
# 监听端口
port: 53
# 允许控制地址
access-control: 127.0.0.0/8 allow
# 运行用户
username: "unbound"
# 日志文件
logfile: "unbound.log"
# 不记录到系统日志
use-syslog: no
# 记录请求
log-queries: yes
# 引入解析额外的解析文件,格式跟下面的格式一样
# include: /usr/local/unbound/etc/unbound/config.d/*.conf
# 解析example.com记录
local-zone: "example.com" redirect
# 解析A记录
local-data: "example.com A 192.0.2.3"
python:
remote-control:
# 允许远程控制
control-enable: yes
# 监听地址
control-interface: 127.0.0.1
# 监听端口
control-port: 8953
# key
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: 114.114.114.114
启动服务
/usr/local/unbound/sbin/unbound
总结
远程控制可以控制启动、停止和reload。
