我公司目前在内网使用的dns的配置,目前存在一点小问题,但不影响使用,仅供参考

安装时一定要注意权限

系统:Centos 6.4_x64

Bind版本 :9.9.4

编译参数

./configure --prefix=/data/named --enable-epoll --enable-threads --enable-largefile --disable-ipv6

生成key

/data/named/sbin/rndc-confgen > /data/named/etc/rndc.conf

生成CA

dig -t NS . > /data/named/var/named/named.ca

named.conf

key "rndc-key" {
        algorithm hmac-md5; secret "Qs1YABFcyypxECCSbKDnjw==";
        };
controls { inet 127.0.0.1 port 953 allow { 127.0.0.1; } keys { "rndc-key"; }; };

acl innet {
        127.0.0.0/8;
        192.168.2.0/24;
};
options {
        listen-on  port 53  { any; };
        allow-query     { any; };
        recursion yes;
        directory "/data/named/var/named";
        dump-file "/data/named/var/named/cache_dump.db";
        pid-file "/data/named/var/run/named/named.pid";
        statistics-file "/data/named/var/named/named_stats.txt";
        zone-statistics yes;
        forward first;
        forwarders { 123.125.225.29; 114.114.114.114; };
};
logging {
        channel audit_log { file "/var/log/named.log" versions 3 size 50m; severity warning; print-time yes; print-category  yes;};
        category default { audit_log; };
        category general { audit_log; };
        category security { audit_log; };
        category config { audit_log; };
        category resolver { audit_log; };
        category xfer-in { audit_log; };
        category xfer-out { audit_log; };
        category notify { audit_log; };
        category client { audit_log; };
        category network { audit_log; };
        category update { audit_log; };
        category queries { audit_log; };
        category lame-servers { audit_log; };
};

view in {
        match-clients { innet; };
        recursion yes;

zone "." IN {
        type hint;
        file "named.ca";
};
zone "localhost" IN {
        type master;
        file "localhost.zone";
};
zone "0.0.127.in-addr.arpa" IN {
        type master;
        file "named.local";
        allow-update { none; };
};
zone "abc.com" IN {
        type master;
        file "abc.zone.in";
        allow-update { 127.0.0.1; };
        allow-transfer { none; };
};
zone "2.168.192.in-addr.arpa" IN {
        type master;
        file "abc.zone.addr";
        allow-update { 127.0.0.1; };
        allow-transfer { none; };
};
};

abc.zone.addr

$ORIGIN .
$TTL 3600       ; 1 hour
abc.com.             IN SOA  ns.abc.com. root.abc.com. (
                                20131845 ; serial
                                3600       ; refresh (1 hour)
                                900        ; retry (15 minutes)
                                3600000    ; expire (5 weeks 6 days 16 hours)
                                3600       ; minimum (1 hour)
                                )
                IN NS           ns.abc.com.
252             IN PTR          bj.abc.com.
252             IN PTR          www.abc.com.
252             IN PTR          tj.abc.com.
252             IN PTR          news.abc.com.

 

abc.zone.in

$ORIGIN .
$TTL 3600       ; 1 hour
abc.com              IN SOA  ns.abc.com. root.abc.com. (
                                2011060502 ; serial
                                3600       ; refresh (1 hour)
                                900        ; retry (15 minutes)
                                3600000    ; expire (5 weeks 6 days 16 hours)
                                3600       ; minimum (1 hour)
                                )
                        NS      ns.abc.com.
                        A       192.168.2.254
$ORIGIN abc.com.
$TTL 80000      ; 22 hours 13 minutes 20 seconds
bj                      A       192.168.2.252
fs                      A       192.168.2.252
$TTL 3600       ; 1 hour
news                    A       192.168.2.252
ns                      A       192.168.2.254
tj                      A       192.168.2.252
www                     A       192.168.2.252

 

生成缓存

/data/named/sbin/rndc dumpdb /data/named/var/named/cache_dump.db

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注