1 下载bind-9.4.0.tar.gz后解开,cd bind-9.4
2 配置编译
./configure --prefix=/usr --sysconfdir=/etc --enable-threads --disable-openssl-version-check ;make;make install
3 生成rndc.conf和rndc.key:
/usr/sbin/rndc-confgen >/etc/rndc.conf
tail -10 /etc/rndc.conf| head -9 | sed s/#\ //g >/etc/rndc.key
生成根文件记录:dig @a.root-servers.net . NS >named.ca
4 生成named.conf :
options {
directory "/var/named/data";
dump-file "/var/named/data/dump.db";
statistics-file "/var/named/data/named_stats.txt";
version "fuck you";
pid-file "/var/run/named/named.pid";
listen-on {125.64.32.137;};
recursion yes;
recursive-clients 1000000;
};
controls {
inet 127.0.0.1 allow { localhost; } keys { rndc-key; };
};
include "/etc/rndc.key";
logging {
channel warning
{
file "/var/log/dns_warnings" versions 3 size 20m;
severity warning;
print-category yes;
print-severity yes;
print-time yes;
};
channel general_dns
{
file "/var/log/dns_logs" versions 3 size 20m;
severity info;
print-category yes;
print-severity yes;
print-time yes;
};
channel query_log {
file "/var/log/dns-query.log" versions 3 size 20m;
severity debug;
print-time yes;
print-severity yes;
};
channel dynamic
{
file "/var/log/dnsalllogs" versions 3 size 20m;
severity dynamic;
print-category yes;
print-severity yes;
print-time yes;
};
category default { warning; } ;
category queries { dynamic; } ;
category queries { general_dns; } ;
category queries { query_log; };
};
zone "." IN {
type hint;
file "/var/named/named.ca";
5 调试启动named : named -u named -gc /etc/named.conf
没有出错就ok
6 正式启动named : named -u named -c /etc/named.conf &