1、首先到www.isc.org查找最新的软件包,我所用的是bind-9.3.4.tar.gz。
今天写这个的时候,bind-9.4.0也已经发布了。
2、下载后,到bind-9.3.4.tar.gz所在目录,运行
[root@FCServer tmp]# ls
bind-9.3.4.tar.gz
[root@FCServer tmp]#tar xzvf bind-9.3.4.tar.gz
[root@FCServer tmp]#cd bind-9.3.4
3、依次运行以下命令安装bind
[root@FCServer bind-9.3.4]#./configure -sysconfdir=/etc
[root@FCServer bind-9.3.4]#make
[root@FCServer bind-9.3.4]#make install
4、创建/etc/named.conf
[root@FCServer etc]#vi /etc/named.conf
named.conf的内容如下:
options {
directory "/var/named";
};
zone "." {
type hint;
file "named.ca";
};
zone "localhost" {
type master;
file "named.local";
};
5、创建目录/var/namd
[root@FCServer etc]#mkdir /var/named
创建/etc/named.conf中指定的named.ca文件,步骤如下:
将所知的可用的DNS服务器地址写入/etc/resolv.conf
[root@FCServer named]#echo "nameserver 202.103.224.68" > /etc/resolv.conf
使用dig -t NS查询根服务器,所得到的结果如下:
[root@FCServer named]# dig -t NS
; <<>> DiG 9.3.4 <<>> -t NS
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 41800
;; flags: qr rd ra; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 1
;; QUESTION SECTION:
;. IN NS
;; ANSWER SECTION:
. 517462 IN NS K.ROOT-SERVERS.NET.
. 517462 IN NS L.ROOT-SERVERS.NET.
. 517462 IN NS M.ROOT-SERVERS.NET.
. 517462 IN NS A.ROOT-SERVERS.NET.
. 517462 IN NS B.ROOT-SERVERS.NET.
. 517462 IN NS C.ROOT-SERVERS.NET.
. 517462 IN NS D.ROOT-SERVERS.NET.
. 517462 IN NS E.ROOT-SERVERS.NET.
. 517462 IN NS F.ROOT-SERVERS.NET.
. 517462 IN NS G.ROOT-SERVERS.NET.
. 517462 IN NS H.ROOT-SERVERS.NET.
. 517462 IN NS I.ROOT-SERVERS.NET.
. 517462 IN NS J.ROOT-SERVERS.NET.
;; ADDITIONAL SECTION:
A.ROOT-SERVERS.NET. 603862 IN A 198.41.0.4
;; Query time: 14 msec
;; SERVER: 202.103.224.68#53(202.103.224.68)
;; WHEN: Sat Feb 24 13:30:36 2007
;; MSG SIZE rcvd: 244
再将A.ROOT-SERVERS.NET. 所对应的IP地址198.41.0.4写入/etc/resolv.conf
[root@FCServer named]# echo "nameserver 194.41.0.4" > /etc/resolv.conf
创建/var/named/named.ca文件
[root@FCServer named]#dig -t NS . > /var/named/named.ca
6、生成rndc控制文件
[root@FCServer named]#rndc-confgen > /etc/rndc.conf
将生成的rndc.conf文件中的相关内容加入到/etc/named.conf
[root@FCServer named]#tail +13 /etc/rndc.conf >> /etc/named.conf
rndc.conf需要加入到/etc/named.conf中的内容如下:
key "rndc-key" {
algorithm hmac-md5;
secret "3cZf/vU+US9KkKsJpDRljw==";
};
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};
7、启动named服务器,查看日志文件
[root@FCServer named]#named
[root@FCServer named]#tail /var/log/mesages
测试rndc,将本机作为DNS
[root@FCServer named]#rndc status
number of zones: 1
debug level: 0
xfers running: 0
xfers deferred: 0
soa queries in progress: 0
query logging is OFF
recursive clients: 0/1000
tcp clients: 0/100
server is up and running
测试rndc成功。
[root@FCServer named]#echo "nameserver 127.0.0.1" > /etc/resolv.conf
[root@FCServer named]#host www.isc.org
www.isc.org has address 204.152.184.88
www.isc.org has IPv6 address 2001:4f8:0:2::d
将本机作为DNS服务器解析成功。
| Sendmail中确定一些依赖包时发生的错误< 上页 | 下页 >/etc目录 |
|---|





