系统:Redhat Linux 企业版
Bind版本:bind-9.4.1-P1
1.下载最新版的Bind ,现在最新稳定版为bind-9.4.1-P1.tar.gz :
2.安装:
#cd /usr/local/src
#tar xzvf bind-9.4.1-P1.tar.gz
#cd bind-9.4.1-P1
#./configure –prefix=/usr/local/dns
#make
#make install
3.配置:配置文件包括-----db.127.0.0,db.192.168.1,db.cache,db.domain,named.conf,rndc.conf
配置文件存放路径:/usr/local/dns/etc
(1)配置rndc.conf
#/usr/local/dns/sbin/rndc-confgen > /usr/local/dns/etc/rndc.conf
自动生成rndc.conf,内容如下:
# Start of rndc.conf
key "rndc-key" {
algorithm hmac-md5;
secret "******";
};
options {
default-key "rndc-key";
default-server 127.0.0.1;
default-port 953;
};
# End of rndc.conf
# Use with the following in named.conf, adjusting the allow list as needed:
# key "rndc-key" {
# algorithm hmac-md5;
# secret "******";
# };
#
# controls {
# inet 127.0.0.1 port 953
# allow { 127.0.0.1; } keys { "rndc-key"; };
# };
# End of named.conf
(2)配置named.conf
#vi /usr/local/dns/etc/named.conf
options {
directory "/usr/local/dns/etc";
};
zone "." in {
type hint;
file "db.cache";
};
zone "0.0.127.in-addr.arpa" in {
type master;
file "db.127.0.0";
};
zone "domain.cn" in {
type master;
file "db.domain";
};
zone "1.168.192.in-addr.arpa" in {
type master;
file "db.192.168.1";
};
// rndc.conf生成,把rndc.conf后面#号部分放到下面.
key "rndc-key" {
algorithm hmac-md5;
secret "******";
};
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};
(3)配置db.cache
下载到/usr/local/dns/etc目录,并改名为db.cache。
4)配置db.127.0.0
# vi /usr/local/dns/etc/db.127.0.0
$TTL 3h
0.0.127.in-addr.arpa. IN SOA ns1.domain.cn. nsmaster.domain.cn. (
2007083001;
3h;
1h;
1w;
1h);
0.0.127.in-addr.arpa. IN NS ns1.domain.cn.
1.0.0.127.in-addr.arpa. IN PTR local.
(5)配置db.domain,注意域名后面的.别忘了。
# vi /usr/local/dns/etc/db.domain
$TTL 3h
domain.cn. IN SOA ns1.domain.cn. nsmaster.domain.cn. (
2007083001
3h
1h
1w
1h)
;
;name server
;
domain.cn. IN NS ns1.domain.cn.
;
;address
;
localhost.domain.cn. IN A 127.0.0.1
ns1.domain.cn. IN A 192.168.1.10
nnn.domain.cn. IN A 192.168.1.11
bbs.domian.cn. IN A 192.168.1.12
(6)配置db.192.168.1
# vi /usr/local/dns/etc/db.192.168.1
$TTL 3h
225.89.211.in-addr.arpa IN SOA ns1.domain.cn. nsmaster.domain.cn. (
2007083001
3h
1h
1w
1h)
;
;name server
;
1.168.192.in-addr.arpa. IN NS ns1.domain.cn.
;
;address
;
10.1.168.192.in-addr.arpa. IN PTR ns1.domain.cn.
11.1.168.192.in-addr.arpa. IN PTR
12.1.168.192.in-addr.arpa. IN PTR bbs.domain.cn
4.启动
#cd /usr/local/dns/sbin
#./named –c /usr/local/dns/etc
#./named –g
5.测试
利用nslookup进行测试。
更改配置文件后,可以使用下列命令来刷新配置文件
#cd /usr/local/dns/sbin
#./rndc reload
//服务被拒绝的话,你肯定是用了putty之类的远程修改,如果是修改named.conf
注意:安装后只是简单的成功,最好还是去弄明白DNS的原理,如SOA NS的含义。如果nslookup或host
命令提示无此命令,那就是没装bind-utils工具。一般服务器自带,最好不要卸载rpm的安装方便,但是关联实在是很麻烦。
阅读(1070) | 评论(0) | 转发(0) |