首页 > 代码库 > 从零开始部署bind9服务器之二:部署缓存服务器

从零开始部署bind9服务器之二:部署缓存服务器

所有操作均在192.168.1.104上进行

 

一、安装bind9:

yum install -y bind

 

 

二、修改配置文件:

cp /etc/named.conf{,.back}              //先做备份

vim /etc/named.conf

技术分享

 

 

三、启动服务:

chkconfig --level 35 named on          //设置开机启动

service named start

 

 

验证:

技术分享

dig -t A www.souhu.com @192.168.1.104      //在192.168.1.0/24主机上操作

技术分享

 

 

dig -t A www.sina.com @192.168.1.104     //在非192.168.1.0/24主机上操作

技术分享

 

 

附:

/etc/named.conf

//

// named.conf

//

// Provided byRed Hat bind package to configure the ISC BIND named(8) DNS

// server as acaching only nameserver (as a localhost DNS resolver only).

//

// See/usr/share/doc/bind*/sample/ for example named configuration files.

//

 

//自定义acl

acl myNet {

              192.168.1.0/24;      

};

 

options {

              listen-on port 53 { 192.168.1.104;127.0.0.1; };

//           listen-on-v6 port 53 { ::1; };

              directory             "/var/named";

              dump-file            "/var/named/data/cache_dump.db";

        statistics-file"/var/named/data/named_stats.txt";

        memstatistics-file"/var/named/data/named_mem_stats.txt";

              allow-query     { any; };     //允许任何主机查询

              recursion yes;                //开启递归查询功能

              allow-recursion { myNet; };   //只允许指定的客户端进行递归查询

              dnssec-enable no;             //关闭dnssec

              dnssec-validation no;         //关闭dnssec

 

              /* Path to ISC DLV key */

//           bindkeys-file"/etc/named.iscdlv.key";

 

//           managed-keys-directory"/var/named/dynamic";

};

 

logging {

        channel default_debug {

                file"data/named.run";

                severity dynamic;

        };

};

 

zone"." IN {

              type hint;

              file "named.ca";

};

 

include"/etc/named.rfc1912.zones";

include"/etc/named.root.key";

 


从零开始部署bind9服务器之二:部署缓存服务器