• centos7 配置dns服务器


    yum install bind

    -------------------------------------------------------------------------------------------------

    //
    // /etc/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.
    //
    // See the BIND Administrator's Reference Manual (ARM) for details about the
    // configuration located in /usr/share/doc/bind-{version}/Bv9ARM.html

    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";
            allow-query     { any; };

            /*
             - If you are building an AUTHORITATIVE DNS server, do NOT enable recursion.
             - If you are building a RECURSIVE (caching) DNS server, you need to enable
               recursion.
             - If your recursive DNS server has a public IP address, you MUST enable access
               control to limit queries to your legitimate users. Failing to do so will
               cause your server to become part of large scale DNS amplification
               attacks. Implementing BCP38 within your network would greatly
               reduce such attack surface
            */
            recursion yes;

            dnssec-enable yes;
            dnssec-validation yes;

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

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

            pid-file "/run/named/named.pid";
            session-keyfile "/run/named/session.key";
    };


    logging {
            channel default_debug {
                    file "data/named.run";
                    severity dynamic;
            };
    };

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

    zone "demo.com" {
            type master;
            file "/var/named/demo.com";
    };

    include "/etc/named.rfc1912.zones";
    include "/etc/named.root.key";

    ------------------------------------------------------------------------

    /var/named/demo.com  (此文件对named用户要有read权限)

    ----

    $TTL 3H
    @       IN SOA  @ rname.invalid. (
                                            0       ; serial
                                            1D      ; refresh
                                            1H      ; retry
                                            1W      ; expire
                                            3H )    ; minimum
            NS      @
            A       127.0.0.1
            AAAA    ::1

    a       IN      A        109.105.4.65

    --------------------------------------------------------------------

    system start named

    system status named

    ------------------------------------------------

    测试:

    yum install bind-utils

    修改 vi /etc/resolv.conf

    nameserver 109.105.30.40

    # nslookup a.demo.com
    Server:        109.105.30.40
    Address:    109.105.30.40#53

    Name:    a.demo.com
    Address: 109.105.4.65

    ---------------------------------------------------------

    设置轮询

    //
    // 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.
    //
    // See the BIND Administrator's Reference Manual (ARM) for details about the
    // configuration located in /usr/share/doc/bind-{version}/Bv9ARM.html

    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";
        allow-query     { any; };

        /*
         - If you are building an AUTHORITATIVE DNS server, do NOT enable recursion.
         - If you are building a RECURSIVE (caching) DNS server, you need to enable
           recursion.
         - If your recursive DNS server has a public IP address, you MUST enable access
           control to limit queries to your legitimate users. Failing to do so will
           cause your server to become part of large scale DNS amplification
           attacks. Implementing BCP38 within your network would greatly
           reduce such attack surface
        */
        recursion no;

        dnssec-enable yes;
        dnssec-validation yes;

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

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

        pid-file "/run/named/named.pid";
        session-keyfile "/run/named/session.key";
        rrset-order {
            class IN type A name "demo.com" order cyclic;
            order cyclic;
        };
    };

    logging {
            channel default_debug {
                    file "data/named.run";
                    severity dynamic;
            };
    };

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

    zone "demo.com" {
            type master;
            file "/var/named/demo.com";
    };

    include "/etc/named.rfc1912.zones";
    include "/etc/named.root.key";

    -------------------

    order_spec定义:
    [ class class_name ][ type type_name ][ name "domain_name"] order ordering
    如果没有设定类,默认值为ANY。如果没有设定类型,默认值为ANY。如果没有设定
    名称,默认值为"*"。
    合法的排序值是:
    fixed:记录以它们在域文件中的顺序
    random:记录以随机顺序被返回
    cyclic:记录以环顺序被返回

    ---------------------------

    $TTL 3H
    @    IN SOA    @ rname.invalid. (
                        0    ; serial
                        1D    ; refresh
                        1H    ; retry
                        1W    ; expire
                        3H )    ; minimum
        NS    @
        A    127.0.0.1
        AAAA    ::1

    a       IN      A        109.105.30.133
            IN      A        109.105.30.132
    --------------------

    rndc reload  

    https://github.com/kennethkalmer/bind-dlz-on-rails

  • 相关阅读:
    SQL语句快速入门
    分享一些不错的sql语句
    放弃一键还原GHOST!!使用强大WIN7自带备份
    ZEND快捷方式
    eWebEditor在IE8,IE7下所有按钮无效之解决办法
    MySQL中文乱码解决方案集锦
    A+B Problem II(高精度运算)
    矩形嵌套(动态规划)
    贪心——会场安排
    擅长排列的小明(递归,暴力求解)
  • 原文地址:https://www.cnblogs.com/mhc-fly/p/8684331.html
Copyright © 2020-2023  润新知