vim /etc/named.conf
编辑正向解析和反向解析
zone "6688.cc" IN {
type master;
file "6688.cc.zone";
};
zone "0.168.192.in-addr.arpa" IN {
type master;
file 192.168.0.local";
};
cd /var/named
vim 6688.cc.zone
$TTl 600
$ORIGIN 6688.cc.
@ IN SOA nsl.6688.cc. admin.6688.cc.(
2011112401
1H
10M
7D
1D)
IN NS nsl
IN NS ns2
IN MX 10 mail
IN MX 20 mail2
ns1 IN A 192.168.0.181
ns2 IN A 192.168.0.182
mail IN A 192.168.0.181
mail2 IN A 192.168.0.182
www IN A 192.168.0.181
ftp IN A 192.168.0.181
www2 IN CNAME www
cp 6688.cc.zone 192.168.0.local
vim 192.168.0.local 修改内容
$TTl 600
$ORIGIN 6688.cc.
@ IN SOA nsl.6688.cc. admin.6688.cc.(
2011112401
1H
10M
7D
1D)
IN NS nsl
IN NS ns2
IN MX 10 mail
IN MX 20 mail2
181 IN PTR ns1
182 IN PTR ns2
181 IN PTR mail
182 IN PTR mail2
181 IN PTR www
181 IN PTR ftp
chmod o-r 6688.cc.zone 192.168.0.local
chgrp named 6688.cc.zone 192.168.0.local
named-checkconf 检查主配置文件
named-checkzone 检查区域文件
service named restart
tail /var/log/messages
关闭selinux
setenforce 0
rndc是 dns远程配置工具
rndc flush 清空linux的dns 缓存
rndc status 查看DNS的区域
rndc reload 重新读取配置文件
rndc trace 2 调试第二个进程
rndc stop 停止服务
rndc notrace 停止调试
rndc freeze zone 让某个区域不能工作
retransfer 重传某个区域
配置从服务器
和创建主服务器一样
rndc-confgen > /etc/rndc.conf
cat !$
把key "rndckey"{
algorithm hmac-md5;
secret "uAgAJYS+FB3xvAWoVxctGQ==";
};
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndckey"; };
};
复制到/etc/named.conf配置文件中
vim /etc/named.conf
编写options {
directory "/var/named";
querylog yes;启动日志
version "hh";
};
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";
};
保存退出。
chmod o-r /etc/named.confd需要把它的权限改为其他用户没有任何权限
chgrp named /etc/named.conf 把属组改为named
cd /var/named/
编写区域文件named.ca localhost.zone named.local
dig -t NS . > /var/named/named.ca 获取所有的记录
编写localhost.zone区域文件
vim localhost.zone
$TTL 43200
@ IN SOA localhost. root.localhost. (
2011112401
3H
15M
1W
1D)
IN NS localhost.
localhost. IN A 127.0.0.1
cp localhost.zone named.local
修改named.local
vim named.local
$TTL 43200
@ IN SOA localhost. root.localhost. (
2011112401
3H
15M
1W
1D)
IN NS localhost.
1 IN PTR localhost.
chown :named localhost.zone named.*
named-checkconf 检查主配置文件
named-checkzone 检查区域文件
named-checkzone "localhost" localhost.zone
service named start启动服务
tail /var/log/messages,查看日志看是否有错误