centos dns 配置笔记之一高速缓存dns服务器配置

http://singlegod.blog.51cto.com/1909710/566640


安装所有bind套件以及其依赖的软件包
[root@dnsserver CentOS]# yum install bind*
查看安装了哪些
[root@dnsserver CentOS]# rpm -qa | grep bind
bind-chroot-9.3.6-4.P1.el5
bind-utils-9.3.6-4.P1.el5
bind-libs-9.3.6-4.P1.el5
ypbind-1.19-12.el5
bind-9.3.6-4.P1.el5
bind-libbind-devel-9.3.6-4.P1.el5
kdebindings-3.5.4-6.el5
bind-libbind-devel-9.3.6-4.P1.el5
bind-devel-9.3.6-4.P1.el5
[root@dnsserver CentOS]#  yum install caching-nameserver-9.3.6-4.P1.el5.x86_64.rpm
由于chroot技术的使用,咱们BIND的配置文件name.conf还有区域文件都在/var/named/chroot/目录下
配置文件named.conf在/var/named/chroot/etc/下,而区域配置文件在/var/named/chroot/var/named/下
而在以前的默认路径/var/named下都是链接文件
ls -an /var/named/
drwxr-x---  6  0 25 4096 05-15 17:36 chroot
drwxrwx---  2 25 25 4096 02-23 06:35 data
lrwxrwxrwx  1  0 25   45 05-15 12:46 localdomain.zone -> /var/named/chroot//var/named/localdomain.zone
lrwxrwxrwx  1  0 25   43 05-15 12:46 localhost.zone -> /var/named/chroot//var/named/localhost.zone
lrwxrwxrwx  1  0 25   44 05-15 12:46 named.broadcast -> /var/named/chroot//var/named/named.broadcast
lrwxrwxrwx  1  0 25   37 05-15 12:46 named.ca -> /var/named/chroot//var/named/named.ca
lrwxrwxrwx  1  0 25   44 05-15 12:46 named.ip6.local -> /var/named/chroot//var/named/named.ip6.local
lrwxrwxrwx  1  0 25   40 05-15 12:46 named.local -> /var/named/chroot//var/named/named.local
lrwxrwxrwx  1  0 25   39 05-15 12:46 named.zero -> /var/named/chroot//var/named/named.zero
 
配置/var/named/chroot/etc/named.conf 主配置文件
1,cd /var/named/chroot/
2,cp etc/named.caching-nameserver.conf etc/named.conf
3,vim etc/named.conf
//改动地方红色标出
options {
        listen-on port 53 {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";

        // Those options should be used carefully because they disable port
        // randomization
        // query-source    port 53;
        // query-source-v6 port 53;

        allow-query     { any; };
        allow-query-cache { localhost; };
};
logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};
view localhost_resolver {
        match-clients      { any; };
        match-destinations { any; };
        recursion yes;
        include "/etc/named.rfc1912.zones";
};
 
修改etc/named.rfc1912.zones文件
vim etc/named.rfc1912.zones
zone "." IN {
        type hint;
        file "named.ca";
};

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

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

zone "0.0.127.in-addr.arpa" IN {
        type master;
        file "named.local";
        allow-update { none; };
};

zone "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.ip6.local";
        allow-update { none; };
};

zone "255.in-addr.arpa" IN {
        type master;
        file "named.broadcast";
        allow-update { none; };
};
        allow-update { none; };
};
 
zone "0.in-addr.arpa" IN {
        type master;
        file "named.zero";
        allow-update { none; };
};
zone "jason.net"{
        type master;
        file "jason.net.zone";
        allow-update {none;};
};
zone "16.168.192.in-addr.arpa" IN{
        type master;
        file "192.168.16.zone";
        allow-update {none;};
};
//我的局域网域名jason.net
新建/var/named/chroot/var/named/jason.net.zone 和192.168.16.zone
vim var/named/jason.net.zone
$TTL    86400
@               IN SOA  localhost root (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum
                IN NS           jason.net.
localhost       IN A            127.0.0.1
dns             IN A            192.168.16.173
mail            IN A            192.168.16.176
master          IN A            192.168.16.173
~
vim var/named/192.168.16.zone
$TTL    86400
@       IN      SOA     localhost. root.localhost.  (
                                      1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
        IN      NS      jason.net.
173     IN      PTR     dns.jason.net.
 
 
启动 service named start
 
我出现的错误
启动 named:
named配置错误::
zone localdomain/IN: loaded serial 42
zone localhost/IN: loaded serial 42
zone 0.0.127.in-addr.arpa/IN: loaded serial 1997022700
zone 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: loaded serial 1997022700
zone 255.in-addr.arpa/IN: loaded serial 42
zone 0.in-addr.arpa/IN: loaded serial 42
zone jason.net/IN: loaded serial 42
zone 16.168.192.in-addr.arpa/IN: loading master file 192.168.16.zone;: file not found
localhost_resolver/16.168.192.in-addr.arpa/IN: file not found
 
很明显找不着配置文件192.168.16.zone
 
原因在配置 etc/named.rfc1912.zones时
zone "16.168.192.in-addr.arpa" IN{
        type master;
        file "192.168.16.zone;";//多加了一个“;”
        allow-update {none;};
};
 
 

你可能感兴趣的:(centos,职场,休闲,DNS服务器)