/etc/named.conf
chown named /etc/named.conf
cd /var/named/
dig -t NS . > named.ca
检测配置是否有问题: named-checkconf
检测正解析: named-checkzone "localhost" /var/named/localhost.zone
检测反解析: named-checkzone "0.0.127.in-addr.arpa" /var/named/named.local
rndc-confgen -r /dev/urandom -a // 这一步是生成 rndc.key, 如果没有这个key namd 是启动不了的。
chown named:named /etc/rndc.key
/etc/init.d/named start
netstat -lnp |grep named // 查看一下named进程是否监听了53端口
首先测试正向解析:dig @127.0.0.1 localhost.
vim /etc/named.conf
加入如下配置:
options {
directory "/var/named";
};
zone "." IN {
type hint;
file "named.ca";
};
zone "localhost" IN {
type master;
file "localhost.zone";
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
};
vim localhost.zone //加入
$TTL 86400
@ IN SOA localhost. admin.localhost. (
2013081601
1H
10M
7D
1D
)
@ IN NS localhost.
localhost. IN A 127.0.0.1
vim named.local //加入
$TTL 86400
@ IN SOA localhost. admin.localhost. (
2013081601
1H
10M
7D
1D
)
@ IN NS localhost.
1 IN PTR localhost
接着测试反解析:dig @127.0.0.1 -x 127.0.0.1
原文:http://blog.51cto.com/amazing61/2063921