一.下载最新的Bind发行版:
①.在根目录下创建一个名为software的文件夹并进入这个文件夹(此文件夹是为了放置下载的源码包和解压的文件):
mkdir /software
cd /software
②.下载bind.9.6.1的软件包:
wget ftp://ftp.isc.org/isc/bind9/9.6.1/bind-9.6.1.tar.gz
二.软件安装:
①.解压该软件包并进入:
tar zxvf bind-9.6.1.tar.gz
cd bind-9.6.1
②.指明路径并编译安装
./configure --enable-largefile --enable-threads --prefix=/usr/local/named
make
make install
三.开始配置:
/usr/local/named/sbin/rndc-confgen > /usr/local/named/etc/rndc.conf
cd /usr/local/named/etc
tail -10 rndc.conf | head -9 | sed s/#\ //g > named.conf
①.下面再编辑named.conf文件并补充如下信息:
vi /usr/local/named/etc/named.conf
options {
listen-on port 53 { 172.15.0.140; };
Directory "/usr/local/named";
Pid-file "named.pid";
Allow-query {any;};
Dump-file "/usr/local/named/data/cache_dump.db";
Statistics-file "/usr/local/named/data/named_stats.txt";
#forward only;
forwarders {218.104.111.114;218.104.111.122;}; //设置转发的公网DNS服务器地址
#forwarders {202.103.24.68;202.103.44.150;};
#forwarders {172.18.0.6;};
//设置内网DNS服务器转发
#atcp-clients 10000;
#listen-on { any;};
};
zone "." in {
Type hint;
File "named.root";
};
zone "localhost" in {
Type master;
File "localhost.zone";
};
zone "0.0.127.in-addr.arpa" in {
Type master;
File "localhost.rev";
};
cd /usr/local/named/
②.在当前目录下增加几个文件:
vi localhost.zone
$TTL 86400
@ IN SOA @ root (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS @
IN A 127.0.0.1
IN AAAA ::1
vi localhost.rev
$TTL 86400
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS localhost.
1 IN PTR localhost.
③.下载named.root这个文件
wget ftp://ftp.rs.internic.net/domain/named.root
到此配置完成
三.测试bind启动:
/usr/local/named/sbin/named -gc /usr/local/named/etc/named.conf
启动Bind:
/usr/local/named/sbin/named -c /usr/local/named/etc/named.conf
此处启动了调试,有问题会打印出出错信息。当调试正常后启动需要去掉g这个参数。