直入主题:
资源准备:
1.下载最新的Bind发行版:.目前最新版本为:bind-9.6.1.tar.gz 并将其上传到服务器上的/usr/local/src目录
2.部署服务器IP:192.168.1.22,bind没有配置DLZ,在官网看了一下,目前最新版本似乎不支持DLZ。
安装:
1.软件安装
# cd /usr/local/src
#tar zxvf bind-9.6.1.tar.gz
#cd bind-9.6.1
#./configure --enable-largefile --enable-threads --prefix=/usr/local/named
#make;make install
2.配置
#cd /usr/local/named/etc
#/usr/local/named/sbin/rndc-confgen > /usr/local/named/etc/rndc.conf
#tail -n10 rndc.conf |head -n9 |sed -e s/#\//g > named.conf
#mkdir -p /usr/local/named/data
下面再编辑named.conf文件并补充如下信息:
options {
Directory "/usr/local/named/etc";
Pid-file "named.pid";
listen-on port 53 {any;};
Allow-query {any;};
Dump-file "/usr/local/named/data/cache_dump.db";
Statistics-file "/usr/local/named/data/named_stats.txt";
};
zone "." in {
Type hint;
File "named.root";
};
zone "localhost" in {
Type master;
File "localhost.zone";
};
zone "0.0.127.in-addr.arpa" in {
Type master;
File "localhost.rev";
};
zone "test.com" IN {
type master;
file "test.com.zone";
allow-update { none; };
};
zone "0.168.192.in-addr.arpa" IN {
type master;
file "test.com.local";
allow-update { none; };
};
在当前目录下增加几个文件:
#vi localhost.zone
内容如下:
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS localhost.
1 IN PTR localhost.
#vi localhost.rev
内容如下:
$TTL 3600
@ IN SOA localhost. root.localhost. (
1; serial
3600; refresh every hour
900; retry every 15 minutes
3600000; expire 1000 hours
3600); minimun 1 hour
IN NS localhost.
1 IN PTR localhost.
#wget
此次测试增加一个test.com的区域:
#vi test.com.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.
#vi test.com.zone
内容如下:
$ttl 1D
@ IN SOA test.com. root.test.com. (
1053891162
3H
15M
1W
1D )
IN NS 192.168.1.22.
IN MX 5 mail.test.com.
www IN A 192.168.1.244
到此配置完成
启动Bind:
#../sbin/named -gc named.conf #此处启动了调试,有问题会打印出出错信息。当调试正常后启动需要去掉g这个参数。
测试,随便找个windows机器测试一下:
C:\>nslookup
*** Can't find server name for address 192.168.1.1: Non-existent domain
Default Server: UnKnown
Address: 192.168.1.1
> server 192.168.1.22
Default Server: [192.168.1.22]
Address: 192.168.1.22
>
Server: [192.168.1.22]
Address: 192.168.1.22
Name:
Address: 192.168.1.244
>
到此说明功能正常。此次配置没有涉及主从DNS配置,下次有时间再配置。
阅读(1951) | 评论(0) | 转发(0) |