Linux DNS Server 配置

1,  首先查看是否安装以下的软件包
bind-libs- 9.3.3-10.el5
bind-devel-9.3.3-10.el5
bind-9.3.3-10.el5
bind-chroot-9.3.3-10.el5
bind-utils-9.3.3-10.el5
caching-nameserver-9.3.3-10.el5
2,对配置文件配置
vi named.caching-nameserver.conf
     如:
    options {
       # listen-on port 53 { 10.6.0.156; };  这个是本机的IP。
       # listen-on-v6 port 53 { ::1; };
        listen-on-v6 port 53  {any;};    any 和::1的区别是什么?
        listen-on port 53 {any;};
        directory       "/var/named"; 定义dns mapping 文件的目录
        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";
       # query-source    port 53;
       #query-source-v6 port 53;
       # allow-query {localhost;}
          allow-query     { any; };
 

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

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

        managed-keys-directory "/var/named/dynamic";
};

};
logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};
view localhost_resolver {
        match-clients      { 10.6.0.156t; };
        match-destinations { 10.6.0.156; };
        recursion yes;
        include "/etc/named.rfc1912.zones";
};  #也可以把有关zone的配置放在/etc/named.caching-nameserver.conf目录下。
 
3.  vi /etc/named.rfc1912.zones
   如下:
    zone "test.com" IN {
        type master;
        file "test.com.zero";
        allow-update { none; };
};
 
zone "0.6.10.in-addr.arpa" IN {
        type master;
        file "10.6.0.ptr";
        allow-update { none; };
};
 #IN 可以省略。zone内容不可以重复。
4,再在/var/named/目录中创建相应的正反解析文件
正向解析:
[root@test ~]# cat /var/named/test.com.zone
$TTL    30
@               IN SOA  @       root (
                                        42  ; serial (d. adams)
                                        3H  ; refresh
                                        15M ; retry
                                        1W  ; expiry
                                        1D )  ; minimum
                IN NS           @
www             IN A            10.6.0.156
polo            IN A            10.6.0.156
test            IN A            10.6.0.156
smtp            IN MX 10        10.6.0.156
mail            IN CNAME        smtp.test.com
 
反向解析:
[root@test ~]# cat /var/named/10.6.0.ptr
$TTL    86400
@               IN SOA  @       root (
                                        42    ; serial (d. adams)
                                        3H    ; refresh
                                        15M   ; retry
                                        1W    ; expiry
                                        1D )   ; minimum
                IN NS           @
156             IN PTR          [url]www.test.com.[/url]
156             IN PTR          polo.test.com.
156             IN PTR          ftp.test.com.
156             IN PTR          mail.test.com.
 
注意:域名后面都要以“.”结束。
把两个正反解析文件CP/var/named/chroot/var/named目录下,注意文件属于组,以及权限。
  /etc/resolv.conf 添加nameserver 10.6.0156
posted @ 2013-05-31 11:49  奋斗侠侠儿  阅读(278)  评论(0编辑  收藏  举报