- 背景:域名为willow.com,主DNS为ns.willow.com,
主DNS的IP地址为1.1.1.18
mail服务器IP为1.1.1.19
www服务器的IP为1.1.1.20
www服务器的IP为1.1.1.21
www服务器的IP为1,1.1.22
ftp服务器别名为www
以上需要正反向正常解析
2.新增named.conf配置文件内容
vim /etc/named.conf 新增如下内容:
options {
directory "/var/named";
};
zone "." IN {
type hint;
file "named.ca";
};
zone "localhost" IN {
type master;
file "named.localhost";
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.loopback";
};
#以下正向区域zone配置
zone "willow.com" {
type master;
file "willow.com.zone";
};
#以下反向区域zone配置
zone "1.1.1.in-addr.arpa" IN {
type master;
file "1.1.1.zone";
};
~
3.注意named.conf属主,属组及权限,手动创建的named.conf文件需做对应更改
chown root.named /etc/named.conf
chmod 640 /etc/named.conf
4.新增正向区域文件willow.com.zone
vim willow.com.zone 新增如下内容:
TTL 600
willow.com. IN SOA ns.willow.com. root.willow.com. (
20160516
1H
10M
3D
1D )
willow.com. IN NS ns
IN MX 10 mail
ns IN A 1.1.1.18
mail.willow.com. IN A 1.1.1.19
www IN A 1.1.1.20
www IN A 1.1.1.21
www IN A 1.1.1.22
ftp IN CNAME www.willow.com.
~
5.新增反向区域文件1.1.1.zone
vim 1.1.1.zone 新增如下内容:
$TTL 600
@ IN SOA ns.willow.com. root.willow.com. (
20160516
1H
10M
3D
1D )
IN NS ns.willow.com.
18 IN PTR ns.willow.com.
19 IN PTR mail.willow.com.
20 IN PTR www.willow.com.
21 IN PTR www.willow.com.
22 IN PTR www.willow.com.
6.注意willow.com.zone和1.1.1.zone区域文件的属主,属组及权限
chmod 640 /var/named/willow.com.zone
chown root.named /var/named/willow.com.zone
chmod 640 /var/named/1.1.1.zone
chown root.named /var/named/1.1.1.zone
7.检查配置文件及区域数据文件语法错误
named-checkconf
named-checkzone "wilow.com.zone" /var/named/willow.com.zone
named-checkzone "1.1.1.zone" /var/named/1.1.1.zone
8.一切OK后,设定开机自启动服务并启动named服务
chkconfig named on
service named restart