在 redhat as3 上通过
先从 下载bind,我下载的是bind-9.4.1.tar.gz
我下载的文件放在/root目录下
进入目录解压缩
[root@linux root]#tar vxfz bind-9.4.1.tar.gz
进如刚解压出来的目录
[root@linux root]# cd bind-9.4.1
编译配置
[root@linux bind-9.4.1]#./configure --prefix=/usr/local/named --enable-threads –sysconfdir=/etc
#--enable-threads是开启多线程处理能力
#--sysconfdir=/etc 是配置文件目录
[root@linux bind-9.4.1]#make
[root@linux bind-9.4.1]#make install
进入/usr/local/named
[root@linux bind-9.4.1]#cd /usr/local/named
[
生成rndc控制命令的key文件
[root@linux named]# sbin/rndc-confgen > /etc/rndc.conf
从rndc.conf文件中提取named.conf用的key
named]# tail -10 /etc/rndc.conf | head -9 | sed s/#\ //g > /etc/named.conf
自动在/etc 生成named,conf文件
建立区文件目录
[root@linux etc]# mkdir /var/named
进入/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.ca文件
echo "nameserver 192.58.128.30" > /etc/resolv.conf
[root@linux named]#dig –t ns . > /var/named/named.ca
echo "nameserver 192.168.1.234" > /etc/resolv.conf
建立zn.cn域名正向解析文件
[root@linux named]#vi zn.cn.bind
$TTL 86400
@ IN SOA ns.zn.cn. root.ns.zn.cn. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS ns.zn.cn.
zhangning-t60 IN A 192.168.1.107
ns IN A 192.168.1.234
mail IN A 192.168.1.234
@ IN MX 5 mail
www IN A 192.168.1.234
IN A 192.168.1.24
IN A 192.168.1.34
IN A 192.168.1.23
* IN A 192.168.1.234
@ IN A 192.168.1.23
test IN CNAME ns
建立zn.cn域名反向解析文件
[root@linux named]#vi 1.168.192.bind
$TTL 86400
@ IN SOA ns.zn.cn. root.ns.zn.cn. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS ns.zn.cn.
107 IN PTR zhangning-t60.zn.cn.
234 IN PTR mail.zn.cn.
234 IN PTR ns.zn.cn.
234 IN PTR .
24 IN PTR .
23 IN PTR .
34 IN PTR .
配置named.conf加如以下代码
[root@linux etc]# vi named.conf
options {
directory "/var/named";
pid-file "named.pid";
};
zone "." {
type hint;
file "named.ca";
};
zone "localhost" {
type master;
file "localhost.zone";
allow-update { none; };
};
zone "0.0.127.in-addr.arpa" {
type master;
file "named.local";
allow-update { none; };
};
zone "zn.cn" {
type master;
file "zn.cn.bind";
allow-update { none; };
};
zone "1.168.192.in-addr.arpa" IN {
type master;
file "1.168.192.bind";
allow-update { none; };
};
现在配置完了可以启动BIND了
named
tail /var/log/messages
只要显示
runing表示运行正常
测试DNS
[root@linux etc]# host 192.168.1.234
89.19.202.220.in-addr.arpa domain name pointer ns.zn.cn.
如上显示表示DNS反向解析正常
[root@ns named]# ping mail.zn.cn
PING mail.zn.cn (192.168.1.234) 56(84) bytes of data.
64 bytes from (192.168.1.234): icmp_seq=0 ttl=0 time=0.620 ms
[root@ns named]# ping
PING jupiter.sina.com.cn (202.108.33.32) 56(84) bytes of data.
64 bytes from 202.108.33.32: icmp_seq=0 ttl=247 time=2163 ms
如上显示表示正向解析正常
DNS配置完成。
注意 空域名。和MX 一起用不能一起起做用。
阅读(1326) | 评论(0) | 转发(0) |