用unbound搭建简单的DNS服务器
2017-03-02 16:48
183 查看
unbound是一款相对简单的DNS服务软件,相对于bind9的复杂配置,更适合新手搭建DNS服务器使用。
话不多说,下面介绍一下unbound的配置。
截止笔者写这篇文章时,unbound已经更新到1.6.1版本。本例所用环境如下:
linux服务器为:Ubuntu 14.04;
unbound软件版本为:1.6.0。
以下为具体安装过程:
1.安装依赖包:
#CentOS系统:
#官方下载地址:
https://unbound.net/download.html
3.编译安装
首先执行./sbin/unbound-checkconf检查配置文件语法,确认无误后进行下一步;
执行/sbin/unbound-control-setup生成秘钥,之后才能使用/sbin/unbound-control命令;
最后执行./sbin/unbound启动服务。
6.测试解析结果
话不多说,下面介绍一下unbound的配置。
截止笔者写这篇文章时,unbound已经更新到1.6.1版本。本例所用环境如下:
linux服务器为:Ubuntu 14.04;
unbound软件版本为:1.6.0。
以下为具体安装过程:
1.安装依赖包:
#CentOS系统:
sudo yum -y install gcc openssl-devel expat-devel libevent-devel#ubuntu系统:
sudo apt-get install gcc openssl libssl-dev libexpat1-dev libevent-dev2.下载unbound软件
#官方下载地址:
https://unbound.net/download.html
3.编译安装
./configure --prefix=/usr/local/unbound --with-pthreads --with-libevent --with-ssl参数说明:
--with-pthreads:支持多线程; --with-libevent:允许使用大的传出端口范围。 --with-ssl:用于生成秘钥文件4.配置unbound.conf文件
server: verbosity: 1 num-threads: 2 #线程数 interface: 127.0.0.1 #监听地址(一般写本机内网ip) interface: ::0 port: 53 #端口 so-reuseport: yes #为每个线程的传入查询打开专用侦听套接字。可以更均匀地将传入查询分布到线程 cache-min-ttl: 60 #解析最小缓存时间 cache-max-ttl: 600 #解析最大缓存时间 outgoing-range: 8192 access-control: 10.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 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-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: "/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.85.启动服务
首先执行./sbin/unbound-checkconf检查配置文件语法,确认无误后进行下一步;
执行/sbin/unbound-control-setup生成秘钥,之后才能使用/sbin/unbound-control命令;
最后执行./sbin/unbound启动服务。
6.测试解析结果
$ dig m.baidu.com @127.0.0.1 ; <<>> DiG 9.9.5-3ubuntu0.4-Ubuntu <<>> m.taobao.com @127.0.0.1 ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 61026 ;; flags: qr rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 ;; WARNING: recursion requested but not available ;; QUESTION SECTION: ;m.baidu.com. IN A ;; ANSWER SECTION: m.baidu.com. 600 IN A 192.168.10.1 ;; Query time: 0 msec ;; SERVER: 127.0.0.1#53(127.0.0.1) ;; WHEN: Thu Mar 02 16:39:50 CST 2017 ;; MSG SIZE rcvd: 46
相关文章推荐
- 在ubuntu 12.04上搭建简单的DNS服务器
- linux搭建简单DNS服务器,实现域名解析到任意ip
- DNS服务器概念的简单的介绍,与搭建一个简单的DNS名称缓存服务器,实现域名解析(一)
- DNS查询过程及DNS服务器简单搭建
- Centos6.7 简单搭建dns服务器
- RedHat5搭建简单DNS服务器
- 在Windows下使用MaraDNS搭建简单的DNS服务器
- 简单的搭建SVN服务器
- Fedora 8 下LAMP简单搭建
- 搭建DNS服务器(私人使用)
- CXF全接触(六) --- 搭建简单的Web服务环境
- svn 服务简单搭建 ZT
- 使用BIND来搭建简单的主辅DNS服务器 推荐
- 用Ant,Struts搭建简单工程应用环境
- 使用 Unbound 创建DNS服务器
- 搭建DNS服务器(私人使用)
- 简单的搭建Web系统常用的框架页面
- 搭建DNS服务器
- 推荐一个比较不错简单的php运行平台软件PHPnow 搭建 PHP 环境[安装图文教程]