在此处,你将在该行的正上方指定区域文件信息,如下所示:
zone "dns01.fedora.local" IN {
type master;
file"forward.fedora.local";
allow-update { none;};
};
zone "1.168.192.in-addr.arpa" IN {
type master;
file"reverse.fedora.local";
allow-update { none;};
};
forward.fedora.local 和 reverse.fedora.local 文件是要创建的区域文件的名称。它们可以是任意名字。
保存并退出。
创建区域文件
创建你在 /etc/named.conf 文件中指定的转发和反向区域文件:
$ sudovi/var/named/forward.fedora.local
添加以下行:
$TTL 86400
@ IN SOA dns01.fedora.local. root.fedora.local.(
2011071001;Serial
3600;Refresh
1800;Retry
604800;Expire
86400;Minimum TTL
)
@ IN NS dns01.fedora.local.
@ IN A 192.168.1.160
dns01 IN A 192.168.1.160
client IN A 192.168.1.136
所有粗体(LCTT 译注:本译文中无法呈现粗体)内容都特定于你的环境。保存文件并退出。接下来,编辑 reverse.fedora.local 文件:
$ sudovi/var/named/reverse.fedora.local
添加以下行:
$TTL 86400
@ IN SOA dns01.fedora.local. root.fedora.local.(
2011071001;Serial
3600;Refresh
1800;Retry
604800;Expire
86400;Minimum TTL
)
@ IN NS dns01.fedora.local.
@ IN PTR fedora.local.
dns01 IN A 192.168.1.160
client IN A 192.168.1.136
160 IN PTR dns01.fedora.local.
136 IN PTR client.fedora.local.
所有粗体(LCTT 译注:本译文中无法呈现粗体)内容都特定于你的环境。保存文件并退出。
你还需要配置 SELinux 并为配置文件添加正确的所有权。
sudochgrp named -R /var/named
sudochown-v root:named /etc/named.conf
sudo restorecon -rv /var/named
sudo restorecon /etc/named.conf
配置防火墙:
sudo firewall-cmd –add-service=dns –perm
sudo firewall-cmd –reload
检查配置是否存在语法错误
sudo named-checkconf /etc/named.conf
如果没有输出或返回错误,那么你的配置有效。
检查转发和反向区域文件。