在主服务器上操作编辑配置文件
[root@centos6 ~]# vim /etc/named.conf
options {
listen-on port 53 { any; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { any; };
allow-transfer { 192.168.0.253; };#授权才可以做从服务器
zone "." IN {
type hint;
file "named.ca";
};
zone "alice.com" IN {
type master;
file "named.alice.com";
};
zone "0.168.192.in-addr-arpa" IN {
type master;
file "named.192.168.0";
};
};
编辑解析库文件和反向解析库文件
[root@centos6 ~]# vim /var/named/named.alice.com $TTL 1D
@ IN SOA master.alice.com. rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
@ IN NS master.alice.com.
master.alice.com. IN A 192.168.0.254
@ IN NS slave.alice.com.
slave.alice.com. IN A 192.168.0.253
client.alice.com. IN A 192.168.0.10
[root@centos6 ~]# vim /var/named/named.192.168.0
$TTL 1D
@ IN SOA master.alice.com. rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
@ NS master.alice.com.
@ NS slave.alice.com.
254 IN PTR master.alice.com.
253 IN PTR slave.alice.com.
10 IN PTR client.alice.com.
开启服务
[root@centos6 ~]# service named start
Starting named: [ OK ]
从服务器上的配置文件
[root@centos6 ~]# vim /etc/named.conf
options {
listen-on port 53 { any; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { any; };
zone "." IN {
type hint;
file "named.ca";
};
zone "alice.com" IN {
type master;
file "slaves/named.alice.com";
};
zone "0.168.192.in-addr-arpa" IN {
type master;
file "slaves/named.192.168.0";
};
从服务器开启服务
从服务器的目录权限
[root@centos6 named]# ll
total 40
-rw-r-----. 1 root named 230 Sep 15 05:25 192.168.172.zone
drwxrwx---. 2 named named 4096 Sep 16 03:41 data
drwxrwx---. 2 named named 4096 Sep 16 04:24 dynamic
-rw-r-----. 1 root named 3171 Jan 11 2016 named.ca
-rw-r-----. 1 root named 713 Sep 15 21:13 named.ca.rpmsave
-rw-r-----. 1 root named 152 Dec 15 2009 named.empty
-rw-r-----. 1 root named 152 Jun 21 2007 named.localhost
-rw-r-----. 1 root named 168 Dec 15 2009 named.loopback
drwxrwx---. 2 named named 4096 Sep 16 04:52 slaves
options {
listen-on port 53 { any; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { any; };
recursion no;#caching服务器写为yes
dnssec-enable no;
dnssec-validation no;
/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
zone "." IN {
type hint;
file "named.ca";};
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
除.服务器以外,其他服务器修改named.ca文件
[root@centos6 ~]# vim /var/named/named.ca
. 3600000 NS A.ROOT-SERVERS.NET.
A.ROOT-SERVERS.NET. 3600000 A 192.168.153.9
配置.服务器
a. name.conf中删除name.ca的项目
b. rfc1912文件
zone "." IN {
type master;
file "root.zone";
};
c. root.zone
$TTL 1D
@ IN SOA ns. admin. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS ns.
ns. A 192.168.153.9
com. NS ns.com.
ns.com. A 192.168.153.8
d.启动named
配置.com服务器
a. rfc1912文件
zone "com" IN {
type master;
file "com.zone";
};
b. com.zone
$TTL 1D
@ IN SOA ns.com. rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS ns.com.
ns.com. A 192.168.153.8
magedu.com. NS ns1.magedu.com.
magedu.com. NS ns2.magedu.com.
ns1.magedu.com. A 192.168.153.7
ns2.magedu.com. A 192.168.153.6
c.启动named
配置主magedu.com
a. rfc1912文件
zone "magedu.com" IN {
type master;
file "magedu.com.zone";
};
b. magedu.com.zone
$TTL 1D
@ IN SOA ns1.magedu.com. rname.invalid. (
2018091301 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS ns1.magedu.com.
NS ns2.magedu.com.
A 192.168.153.7
ns2 A 192.168.153.6
www A 1.1.1.1
ftp A 2.2.2.2
* A 10.10.10.10
c.启动named
配置从magedu.com
a. rfc1912文件
zone "magedu.com" IN {
type slave;
masters { 192.168.153.7; };
file "slaves/MAGEDU.COM.ZONE";
};
b. 启动named