当前位置: > CentOS > CentOS服务器 > DNS服务器 >

CentOS 6.2 DNS 服务器搭建 Bind9.7.3

时间:2014-05-18 23:52来源:linux.it.net.cn 作者:IT网

[root@www named]yum -y install bind     //升级安装的包
[root@www named]#vim /etc/named.conf
//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//


options {
        listen-on port 53 { any; };   //改为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; }; //改为 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;
        };
};


zone "." IN {
        type hint;
        file "named.ca";
};


include "/etc/named.rfc1912.zones";
=========================================================
==================================
[root@www named]# vim /etc/named.rfc1912.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 http://www.ietf.org/internet-drafts/draft-ietf-dnsop-default-local-zones-02.txt
// (c)2007 R W Franks
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//


zone "localhost.localdomain" IN {
        type master;
        file "named.localhost";
        allow-update { none; };
};


zone "localhost" IN {
        type master;
        file "named.localhost";
        allow-update { none; };
};
//注销蓝色这几行
//zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
//      type master;
//      file "named.loopback";
//      allow-update { none; };
//};


//zone "1.0.0.127.in-addr.arpa" IN {
//      type master;
//      file "named.loopback";
//      allow-update { none; };
//};            //注销这几行


zone "0.in-addr.arpa" IN {
        type master;
        file "named.empty";
        allow-update { none; };
};
//添加正反向
zone "linuxidc.com" IN {
        type master;
        file "linuxidc.com.zone"; 
};
zone "1.168.192.in-addr.arpa" IN {
        type master;
        file "1.168.192.zone";
};
===========================================================================================
[root@www named]# pwd
/var/named/chroot/var/named
[root@www named]#
[root@www named]#touch linuxidc.com.zone    ( 创建正向数据文件)
[root@www named]#touch 1.168.192.zone     (创建反向数据文件)
[root@www named]#vim linuxidc.com.zone
===========================================================================================
$TTL    86400
@       IN      SOA    ns.linuxidc.com. root.linuxidc.com. (
                        42        ; serial (d. adams)
                        3H        ; refresh
                        15M        ; retry
                        1W        ; expiry
                        1D )        ; minimum
@       IN       NS             ns.linuxidc.com.
ns      IN       A               192.168.1.8
www     IN       A               192.168.1.8
===========================================================================================
[root@www named]#vim 1.168.192.zone
===========================================================================================


$TTL    86400
@       IN      SOA     ns.linuxidc.com. root.linuxidc.com. (
                        1997022700 ; Serial
                        28800      ; Refresh
                        14400      ; Retry
                        3600000    ; Expire
                        86400 )    ; Minimum
@       IN      NS              ns.linuxidc.com.
8       IN      PTR             ns.linuxidc.com.
8       IN      PTR             www.linuxidc.com.
本篇文章来源于 Linux公社网站  原文链接:http://www.linuxidc.com/Linux/2012-08/67145.htm

(责任编辑:IT)
------分隔线----------------------------