dns配置高级篇

时间:2007-01-04 10:28:27   来源:  作者:whsong  点击:次  出处:技术无忧
关键字:dns配

作者cpss http://cpss.zz.ha.cn

欢迎转载,但必须注明出处和作者名称。



Dns配置高级篇



这里假设你已经独立或参考我的《架设dns攻略》将dns服务器成功架设起来,并且dns已经能够正常运行了。



现在我们dns开始工作了,是不是我们的工作已经OK了呢?不,不,不,named.conf文件还有很多东西需要我们配置呢。

DNS的配置文件named.conf是有非常多的可选项的,这里只是介绍一点常用的配置。如果你觉得还想继续研究下去,那也不需要在网上到处找资料的,直接用“man named.conf”就可以得到一个非常非常详细的说明。

这里首先感谢我的同事yiming先生对服务器安全性的不懈研究,否则我们也不会经常安装、配置最新版本的DNS服务器了。而且,这个named.conf是他配置的。好了,言归正传,Follow me,我们继续。





1.Options 我们通过options可以定制一个性能更优、安全性更高的dns服务器。

Version “I am cpss”;      

别人想探测我们dns版本,然后根据该版本的漏洞来攻击我们。休想!配置了这条命令后,别人再探测的版本后就是“I am cpss”了,呵呵。

Allow-transfer {192.168.1.1;192.168.1.4;};

如果没有配置这一条命令,任何人都可以通过nslookup工具来得到你域里面的zone文件,也就是说他得到了你的主机列表,然后再分析,再……。当然,slave dns需要你允许它能够传送,否则它就得不到master dns上的zone文件,也就没办法工作了。这里假设192.168.1.1和192.168.1.4是该dns服务器的slave服务器,在master服务器上配置了如上命令。

Listen-on{192.168.1.2;};

增加上这条命令,启动dns时就不会监听所有网络接口的53端口了,只监听指定网络接口的53端口。

Blackhole {hatenets;};

我们不想让某些网段使用我们的dns服务器,就用这条命令吧。不过还需要配置一个acl来定义匹配的网段,如下所示:

acl hatenets {

1.0.0.0/8;

2.0.0.0/8;

};
这两个网段的地址是无法使用我们的dns了。





2.logging 通过该选项,我们可以生成我们想要的日志。通过日志,我们可以更好地维护dns服务器。

Logging {

    Channel syslog_info {

    File “/var/log/bindall.log” versions 20 size 2m;

    Print-category yes;

    Print-time yes;

    Severity notice;

              };

    category       default {

          syslog_info;

                        };

    };
上例中我们建立了一个安全级别为notice的日志,dns的报错信息都会存放在“/var/log/bindall.log”日志文件了,分析该文件,我们就能轻松找出dns工作不正常的原因了。

Logging里面的安全级别很多,大家可以根据自己需要来制定一个或多个logging。下面是logging的语法:

  logging {

        [ channel channel_name {

        ( file path_name

          [ versions ( number | unlimited ) ]

          [ size size_spec ]

          | syslog ( kern | user | mail | daemon | auth | syslog | lpr |

                news | uucp | cron | authpriv | ftp |

                local0 | local1 | local2 | local3 |

                local4 | local5 | local6 | local7 )

          | null );



        [ severity ( critical | error | warning | notice |

                  info | debug [ level ] | dynamic ); ]

        [ print-category yes_or_no; ]

        [ print-severity yes_or_no; ]

        [ print-time yes_or_no; ]

        }; ]



        [ category category_name {

        channel_name; [ channel_name; ... ]

        }; ]

        ...

      };




3. 这里是我们named.conf样本,希望能对你有所帮助。

QUOTE:

我们named.conf的样本

acl hatenets {

  1.0.0.0/8;

  2.0.0.0/8;

};



options {

    files 10000;

# boot file for name server

#

    directory "/var/named";

    version "I am cpss";

    notify no;

    datasize 300m;

    allow-transfer {192.168.1.1;

                192.168.1.4;

                          };

               

    blackhole { hatenets; };

    interface-interval 0;

    cleaning-interval 120;

    listen-on {192.168.1.2;

          };

    statistics-interval 60;





logging {

    channel syslog_query {

    file "/var/log/bindquery.log" ;

    severity notice;

                };



    channel syslog_info {

    file "/var/log/bindall.log" versions 20 size 2m;

    print-category yes;

    print-time yes;

    print-severity yes;

    severity notice;

                };

   

    channel syslog_manitenance {

    file "/var/log/bindmaint.log" versions 10 size 2m;

    severity notice;    

                    };



    channel syslog_secu {

          syslog local6;

          severity info;

                };



    channel syslog_xfer {

    file "/var/log/bindxfer.log" versions 20 size 2m;

      print-category yes;

    print-time yes;

    print-severity yes;

    severity notice;

                };

   

   



    channel syslog_os {

    syslog local3;

    severity info;

          };



    channel syslog_panic {

    syslog local4;

    severity info;

                };



    channel syslog_stat {

    syslog local5;

    severity info;

                };



    channel syslog_config {

    file "/var/log/bind_config.log" versions 20 size 2m;

    print-category yes;

    print-time yes;

    print-severity yes;

    severity info;

                };

category     "xfer-in" {

    syslog_xfer;

          };





category     default {

    syslog_info;

                };



category     security {

    syslog_secu;

                };





category     os     {

    syslog_os;



                };



category     panic   {

    syslog_panic;

                };



category     statistics {

    syslog_stat;

                };



category     config {

    syslog_config;

                };



category     maintenance {

    syslog_manitenance;

                };





category lame-servers {null; };



category cname {null; };



};



#

# type domain source host/file

#

zone "." {

    type hint;

    file "/var/named/named.ca";

};



zone "0.0.127.IN-ADDR.ARPA" {

    type master;

    file "local.rev";

};

4.最新版本(2002年11月5日)的named.ca文件。

网页设计 http://www.pc51.net/www/ 提更多网页设计信息


相关文章

文章评论

共有 0 位网友发表了评论 此处只显示部分留言 点击查看完整评论页面

300x250广告位招租