linux下bind域名dns服务器安装配置
一、从bind官网网站下载http://www.bind.com/pub/bind9/ 进行安装
[root@redhat soft]# tar zxvf bind-9.9.0rc2.tar.gz
[root@redhat soft]# cd bind-9.9.0rc2
[root@redhat bind-9.9.0rc2]# ./configure --prefix=/usr/local/bind
[root@redhat bind-9.9.0rc2]# nake
[root@redhat bind-9.9.0rc2]# nake install
二、.生成rndc控制命令的key文件
[root@redhat bind-9.9.0rc2]# cd /usr/local/bind
[root@redhat bind]#sbin/rndc-confgen >./etc/rndc.conf
从rndc.conf文件中提取named.conf用的key
[root@redhat etc]# tail -10 rndc.conf|head -9 >named.conf
把9行前面的#去掉
三、配置域名解析文件
1.编辑named.conf
[root@redhat etc]# vi named.conf
key "rndc-key" {
algorithm hmac-md5;
secret "TEmKGmOBXeK/LfV3+MfGIQ==";
};controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};
options {
directory "/usr/local/bind/etc";
allow-query{ any;};
};
zone "." IN{
type hint;
file "named.root";
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "locahost.rev";
allow-update {none;};
};
zone "localhost" IN {
type master;
file "localhost.zone";
allow-update {none;};
};
zone "test.com" IN {
type master;
file "test.com.zone";
};
2.建立named.root,该文件可以从ftp://ftp.rs.internic.net/domain/named.root下载
3.建立localhost.zone文件
[root@redhat etc]# vi localhost.zone
$TTL 86400
@ IN SOA localhost. root.localhost. (
42 ; Serial
3600 ; Refresh
900 ; Retry
3600000 ; Expire
3600 ) ; Minimum
IN NS localhost.
localhost IN A 127.0.0.1
3.建立localhost.rev文件
[root@redhat etc]# vi localhost.rev
@ IN SOA localhost. root.localhost. (
2008022103 ; Serial
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS localhost
localhost IN A 127.0.0.1
1 IN PTR localhost
4.建立test.com.zone文件。
[root@redhat etc]# vi test.com.zone
@ IN SOA test.com. root.test.com. (
2008022102 ; Serial
3600 ; Refresh
900 ; Retry
3600000 ; Expire
3600 ) ; Minimum
IN NS ns1.test.com.
ns1 IN A 192.168.0.222
www IN A 192.168.0.111
5.测试dns解析
[root@redhat etc]# nslookup
> set type=any
> localhost
Server: 192.168.0.222
Address: 192.168.0.222#53localhost
origin = localhost
mail addr = root.localhost
serial = 42
refresh = 3600
retry = 900
expire = 3600000
minimum = 3600
localhost nameserver = localhost.localhost.
> test.com
Server: 192.168.0.222
Address: 192.168.0.222#53test.com
origin = test.com
mail addr = root.test.com
serial = 2008022102
refresh = 3600
retry = 900
expire = 3600000
minimum = 3600
test.com nameserver = ns1.test.com.
>
[root@redhat etc]# ping www.test.com
PING www.test.com (192.168.0.111) 56(84) bytes of data.
文章评论