Linux下DNS服务器安装配置

系统:RedHat6

一、安装必要软件:

二、全局配置文件:(/etc/named.conf)
[root@ etc]# vi named.conf

options {
        listen-on port 53 { 210.*.241.115; };
        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; };   //允许所有人查询
        //match-clients { any; };   //允许任意客户端
        //match-destinations { any; };  //允许任意目标
        recursion yes;

dnssec-enable yes;
        dnssec-validation yes;
        dnssec-lookaside auto;

/* Path to ISC DLV key */
        bindkeys-file "/etc/named.iscdlv.key";
};

logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};
view example_resolver {
        match-clients { any; };   //指定提交DNS客户端的源IP地址范围
        match-destinations { any; };   //指定提交DNS客户端的目标IP地址范围
        recursion yes;             //指定是否只允许递归查询
        include "/etc/named.zones";  //指定主配置文件

};


三、主配置文件(/etc/named.zones)

[root@ etc]# vi named.zones

// named.rfc1912.zones:
//
// Provided by Red Hat caching-nameserver package
//
// ISC BIND named zone configuration for zones recommended by
// RFC 1912 section 4.1 : localhost TLDs and address zones
// and
// (c)2007 R W Franks
//
// See /usr/share/doc/bind*/sample/ for

zone "example.com" IN {           //指定一个正向查询区域
        type master;              //指定区域类型为主要区域
        file "example.com.zero";   //指定区域配置文件名为"example.com.zero",路径默认为全局配置文件的“directory"路径
        allow-update { none; };   
};

zone " 241.*.210.in-addr.arpa" IN {   //指定一个反向查询区域
        type master;                 //指定区域类型为主要区域
        file "241 .*.210.local";  //指定区域配置文件名为"241.38.210.local",路径默认为全局配置文件的“directory"
        allow-update { none; };
};

四、区域配置文件:(在/var/named下)

正向:example.com.zero

[root@ named]# vi example.com.zero
;指定默认的TTL值
$TTL 1D
;区域名称  记录类型  SOA  主域名服务器(FQDN)  管理员邮件地址(@用“.”代替)
@       IN SOA  example.com.   root.example.com. (
                                        1       ; serial 序列号
                                        1D      ; refresh 刷新间隔
                                        1H      ; retry 重试间隔
                                        1W      ; expire 过期间隔
                                        3H )    ; minimum TTL

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/3c1a1eb15d7ad9172bbfe9084ab70353.html