主从域名服务器


red hat 官方文档


构建主从域名服务器

一、构建主域名服务器

1.在named.conf配置文件中添加“benet.com”主区域

[root@ns1 ~]# vi /etc/named.conf
……
zone "benet.com" IN {
        type master;
        file "benet.com.zone";
        allow-transfer { 173.16.16.6; };
};
zone "16.16.173.in-addr.arpa" IN {
        type master;
        file "173.16.16.arpa";
        allow-transfer { 173.16.16.6; };
};

2.建立“benet.com”区域的数据文件

[root@ns1 ~]# vi var/named/benet.com.zone
……
@         IN      NS      ns1.benet.com.  
          IN      NS      ns2.benet.com.  
          IN      A       173.16.16.5  
          IN      MX  10  mail.benet.com.  
ns1       IN      A       173.16.16.5
ns2       IN      A       173.16.16.6
mail      IN      A       173.16.16.1
www       IN      A       173.16.16.1
study     IN      A       173.16.16.2
*         IN      A       173.16.16.1
[root@ns1 ~]# vi /var/named/173.16.16.arpa
……
@     IN      NS      ns1.benet.com.
      IN      NS      ns2.benet.com.
1     IN      PTR     www.benet.com.
2     IN      PTR     study.benet.com.
5     IN      PTR     ns1.benet.com.
6     IN      PTR     ns2.benet.com.

3.启动或者重新加载named服务程序

service named reload

4.验证主域名服务器

 验证正向解析:nslookup www.benet.com
 验证泛域名解析:nslookup other.benet.com
 验证反向解析: nslookup 173.16.16.5
  • 若出现故障,请检查日志文件 /var/log/messages

二、构建从域名服务器

[root@ns2 ~]# vi /etc/named.conf
……
zone "benet.com" IN {
        type slave;
        masters { 173.16.16.5; };
        file "slaves/benet.com.zone";
};
zone "16.16.173.in-addr.arpa" IN {
        type slave;
        masters { 173.16.16.5; };
        file "slaves/173.16.16.arpa";
};

results matching ""

    No results matching ""