先从 ftp://ftp.isc.org/isc/bind9/9.2.5/ 下载 bind ,我下载的是 bind-9.2.5.tar.gz 下载的文件放在 /opt 目录下 进入目录解压缩 [root@ linux root]#" name="description" />
MILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">先从ftp://ftp.isc.org/isc/bind9/9.2.5/ 下载bind,我下载的是bind-9.2.5.tar.gz
下载的文件放在/opt目录下
进入目录解压缩
[root@linux root]#tar -zxvf bind-9.2.5.tar.gz
[root@linux root]# cd bind-9.2.5
编译配置
[root@linux bind-9.2.5]#./configure
[root@linux bind-9.2.5]#make
[root@linux bind-9.2.5]#make install
编译后默认配置文件目录是/etc
生成rndc控制命令的key文件
[root@linux named]# sbin/rndc-confgen > /etc/rndc.conf
从rndc.conf文件中提取named.conf用的key
先从ftp://ftp.isc.org/isc/bind9/9.2.5/ 下载bind,我下载的是bind-9.2.5.tar.gz
下载的文件放在/opt目录下
进入目录解压缩
[root@linux root]#tar -zxvf bind-9.2.5.tar.gz
[root@linux root]# cd bind-9.2.5
编译配置
[root@linux bind-9.2.5]#./configure
[root@linux bind-9.2.5]#make
[root@linux bind-9.2.5]#make install
编译后默认配置文件目录是/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
自动在/etc下生成named,conf文件
现在named.conf文件中有了rndc-key区段,然后我们来完善它:
options {
directory "/var/named";
};
zone "." IN {
type hint;
file "named.ca";
};
zone "localhost" IN {
type master;
file "localhost.zone";
allow-update ;
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
allow-update ;
};
zone "wllhc.org" IN {
type master;
file "wllhc.zone";
allow-update ;
};
zone "0.168.192.in-addr.arpa" IN {
type master;
file "0.168.192";
allow-update ;
};
key "rndc-key" {
algorithm hmac-md5;
secret "Nd0nLoL8t4Mv0iSpqP1noA==";
};
controls {
.net 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};
进入/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 NS @
1D IN A 127.0.0.1
建立named.local文件
[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.
1 IN PTR localhost.
dig命令直接生成named.root文件
[root@linux named]#dig > named.root
建立test.com域名正向解析文件
[root@linux named]#vi wllhc.zone
$ttl 1D
@ IN SOA wllhc.org. root.wllhc.org. (
1053891162
3H
15M
1W
1D )
IN NS wllhc.org.
IN MX 5 wllhct.com.
www IN A 192.168.0.244
建立wllhc.org域名反向解析文件
[root@linux named]#vi 0.168.192
$TTL 86400
@ IN SOA test.com. root.test.com.(
20031001;
7200;
3600;
43200;
86400);
@ IN NS test.com.
244 IN PTR www.wllhc.org.
现在配置完了可以启动BIND了
/usr/local/sbin/named
测试DNS
[root@linux etc]# nslookup www.wllhc.org
Server: 192.168.0.244
Address: 192.168.0.244#53
Name: www.wllhc.org
Address: 192.168.0.244
[root@linux etc]#nslookup 192.168.0.244
Server: 192.168.0.244
Address: 192.168.0.244#53
244.0.168.192.in-addr.arpa name = www.wllhc.org
DNS配置完成。