码迷,mamicode.com
首页 > 其他好文 > 详细

配置缓存DNS服务器和主DNS服务器

时间:2016-08-21 16:58:09      阅读:246      评论:0      收藏:0      [点我收藏+]

标签:服务   dns   域名解析   

规划:

域:fsy.com地址段:172.16.100.0/24

ns地址:172.16.100.3

www地址:172.16.100.3, 172.16.100.5

mail地址:172.16.100.4

ftp 别名: www

一.配置缓存DNS服务器:

    1.安装软件包

        [root@fsy-Centos6 ~]# yum -y install bind 

    2.备份主配置文件

        [root@fsy-Centos6 ~]# mv /etc/named.conf /etc/named.conf.orig 

    3.编辑主配置文件,并添加以下内容

        [root@fsy-Centos6 ~]# 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";

        };

    4.根据安装bind时生成的主配置文件改当前自定义的配置文件的属主、属组及权限

    [root@fsy-Centos6 ~]# chown root:named /etc/named.conf

    [root@fsy-Centos6 ~]# chmod 640 /etc/named.conf

    5.启动服务

    [root@fsy-Centos6 ~]# service named start

    6.保证此主机可以访问到互联网的情况下,将主机的DNS服务器指向本机地址(我的地址是172.16.100.3

    [root@fsy-Centos6 ~]# vim /etc/resolv.conf

    nameserver 172.16.100.3

    7.[root@fsy-Centos6 ~]# ping www.baidu.com

    此时可以ping通,说明一个简单的缓存DNS服务器已搭建完成

    8.将此服务设置为开机自动启动

    [root@fsy-Centos6 ~]# chkconfig --list named

    [root@fsy-Centos6 ~]# chkconfig  named on

二.配置主DNS服务器

做好以上的配置后:

1.修改主配置文件,并添加以下内容

[root@fsy-Centos6 ~]# vim /etc/named.conf

zone "fsy.com" IN {

        type master;

        file "fsy.com.zone";

};

 

zone "100.16.172.in-addr.arpa" IN {

        type master;

        file "172.16.100.zone";

};

2.检查主配置文件是否有语法错误

[root@fsy-Centos6 ~]# named-checkconf

3.编辑正向区域数据文件

[root@fsy-Centos6 ~]# cd /var/named/

[root@fsy-Centos6 named]# vim fsy.com.zone

添加以下内容:

$TTL 600

@        IN      SOA     ns1.fsy.com.    admin.fsy.com.  (

                                2016080101

                                1H

                                5M

                                2D

                                6H )

                IN      NS      ns1

                IN      MX      10      mail

ns1             IN      A       172.16.100.3

mail            IN      A       172.16.100.4

www            IN      A       172.16.100.5

www            IN      A       172.16.100.3

ftp              IN      CNAME   www

4.根据安装bind时生成的区域数据文件改当前自定义的配置文件的属主、属组及权限

[root@fsy-Centos6 named]# chmod 640 fsy.com.zone

[root@fsy-Centos6 named]# chown root:named fsy.com.zone

5.测试正向区域数据文件看有无语法错误

[root@fsy-Centos6 named]# named-checkzone "fsy.com" /var/named/fsy.com.zone

6.编辑反向区域数据文件

[root@fsy-Centos6 named]# cp fsy.com.zone 172.16.100.zone -p

[root@fsy-Centos6 named]# vim 172.16.100.zone

修改为以下内容:

$TTL 600

@       IN      SOA     ns1.fsy.com.    admin.fsy.com.  (

                                2016080101

                                1H

                                5M

                                2D

                                6H )

                IN      NS      ns1.fsy.com.

3               IN      PTR     ns1.fsy.com.

4               IN      PTR     mail.fsy.com.

5               IN      PTR     www.fsy.com.

3               IN      PTR    www.fsy.com.

 

7.测试反向区域数据文件看有无语法错误

    [root@fsy-Centos6 named]# named-checkzone "100.16.172.in-addr.arpa" 172.16.100.zone

8.重启服务

[root@fsy-Centos6 named]# service named restart

9.测试

[root@fsy-Centos6 named]# dig -x 172.16.100.3

[root@fsy-Centos6 named]# dig -t A www.fsy.com

正向和反向解析都正常,服务搭建成功

 

 


本文出自 “10917734” 博客,请务必保留此出处http://10927734.blog.51cto.com/10917734/1840819

配置缓存DNS服务器和主DNS服务器

标签:服务   dns   域名解析   

原文地址:http://10927734.blog.51cto.com/10917734/1840819

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!