进入目录解压缩
[root@linux root]#tar xfz bind-9.3.1rc1.tar.gz
进如刚解压出来的目录
[root@linux root]# cd bind-9.3.1rc1
编译配置
[root@linux bind-9.3.1rc1]#./configure --prefix=/usr/local/named --enable-threads #--enable-threads开启多线程处理能力
[root@linux bind-9.3.1rc1]#make
[root@linux bind-9.3.1rc1]#make install
进入/usr/local/named 建立etc目录
[root@linux bind-9.3.1rc1]#cd /usr/local/named
[root@linux named]# mkdir etc
生成rndc控制命令的key文件
[root@linux named]# sbin/rndc-confgen > etc/rndc.conf
从rndc.conf文件中提取named.conf用的key
root@linux named]# cd etc
[root@linux etc]# tail -10 rndc.conf | head -9 | sed s/#\ //g > named.conf
自动在/usr/local/named/etc 生成named,conf文件
建立区文件目录
[root@linux etc]# mkdir /var/named
进入/var/named
[root@linux etc]# cd /var/named
建立localhost.zone文件
[root@linux named]#vi localhost.zone
$TTL 86400
$ORIGIN localhost.
@ 1D IN SOA @ root (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
1D IN A 127.0.0.1
[root@linux named]#vi named.local
$TTL 86400
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS localhost.
dig命令直接生成named.root文件
[root@linux named]#dig >; named.root
建立test.com域名正向解析文件
[root@linux named]#vi test.zone
@ IN SOA test.com. root.test.com. (
3H
15M
1W
1D )
IN MX 5 test.com.
www IN A 220.202.19.82
[root@linux named]#vi test.local
$TTL 86400
@ IN SOA test.com. root.test.com.(
20031001;
7200;
3600;
43200;
86400);
@ IN NS test.com.
82 IN PTR dns.test.com.
directory "/var/named"; #named区文件目录
pid-file "named.pid"; #进程id文件名
};
controls {
inet 127.0.0.1 allow { localhost; } keys { rndckey; };
};
zone "." IN {
type hint;
file "named.root";
};
type master;
file "localhost.zone";
allow-update { none; };
};
type master;
file "named.local";
allow-update { none; };
};
type master;
file "test.zone";
allow-update { none; };
};
zone "19.202.220.in-addr.arpa" IN {
type master;
file "test.local";
allow-update { none; };
};
runing表示运行成功
测试DNS
[root@linux etc]# host 220202.19.82
89.19.202.220.in-addr.arpa domain name pointer dns.test.com.
如上显示表示DNS反向解析正常
[root@linux etc]# ping [url]www.test.com[/url]
PING [url]www.test.com[/url] (220.202.19.82) 56(84) bytes of data.
如上显示表示正向解析正常
DNS配置完成。