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/run/named/dump.db";
statistics-file "/var/run/named/named_stats.txt";
version "fuck you";
pid-file "/var/run/named/named.pid";
listen-on {192.168.1.100;};
# recursion no;拒绝递归查询
recursive-clients 1000000;
};
controls {
inet 127.0.0.1 allow { localhost; } keys { rndc-key; };
};
include "/etc/rndc.key";
logging {
channel error
{
file "/var/log/dns-error.log" versions 3 size 2m;
severity error;
print-time yes;
print-severity yes;
print-category yes;
};
channel warning
{
file "/var/log/dns-warnings.log" versions 3 size 20m;
severity warning;
print-category yes;
print-severity yes;
print-time yes;
};
channel info
{
file "/var/log/dns-info.log" versions 3 size 2048m;
severity info;
print-category yes;
print-severity yes;
print-time yes;
};
channel dynamic
{
file "/var/log/dns-dynamic.log" versions 3 size 2048m;
severity dynamic;
print-category yes;
print-severity yes;
print-time yes;
};
category queries { error; };
category default { warning; } ;
category queries { info; } ;
category queries { dynamic; } ;
};
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 &
7 维护: a 标准的记录文件格式如下:
cat /var/named/data/abc.com.hosts
$ttl 38400
abc.com. IN SOA abc.com.cn. root.xinfo.net. (
1001573771
10800
3600
432000
38400 )
abc.com. IN NS abc.net.cn.
abc.com. IN NS abc.com.cn.
. IN A 221.10.5.198
. IN A 218.6.247.104
support.abc.com. IN A 221.10.5.198
employee.abc.com. IN A 220.248.128.41
555.abc.com. IN CNAME abc.555.com.
mail.abc.com. IN A 221.10.5.196
abc.com. IN MX 10 mail
注意最后一行MX记录只能用非IP的域,本文中为mail,并且该域在前有A记录,本文中为mail.abc.com
b dns顺便贴一下设定MX记录的四大原则:
1.MX记录应该指向主机名称,而非IP地址.
2.所有MX主机都必须要有合法的A资源记录.
3.MX记录不可以指向别名.
4.指定明确的优先值.
阅读(1326) | 评论(0) | 转发(0) |