主DNS服务器配置

  1. 主DNS服务器使用Redhat7.5,域名为juzldream.fun,且搭配的IP网段为192.168.5.0/24这一段,因此主要的正解网域为juzldream.fun,而反解的网域则为192.168.5.0/24。

  2. 配置/etc/named/named.conf options选项配置

    options {
            directory       "/var/named";
            allow-recursion {192.168.5.136;};
            notify yes;         #启动通知功能
    };
    
    zone "." IN {
            type hint;
            file "named.ca";
    };
    
    zone "localhost" IN {
            type master;
            file "named.localhost";
            allow-transfer {none;};  #不允许增量传送
    };
    
    zone "0.0.127.in-addr.arpa" IN {
            type master;
            file "named.loopback";
            allow-transfer {none;};
    };
    
    zone "juzldream.fun" IN {
            type master;
            file "juzldream.fun";
            allow-transfer {192.168.5.128;};     #允许192.168.5.128从服务器传送
    }; 
    
    zone "5.168.192.in-addr.arpa" IN {
        type master;
        file "juzldream.back";
        allow-transfer {192.168.5.128;};
    };
    
  3. juzldream.fun 正向区域数据文件配置

    $TTL 600
    @       IN      SOA     ns1.juzldream.fun. admin.juzldream.fun. (
                                               2019021805
                                               1H
                                               5M
                                               2D
                                               6H
    )
            IN      NS      ns1
            IN      NS      ns2
            IN      MX  10  mail
    ns1     IN      A       192.168.5.130
    ns2     IN      A       192.168.5.128  ;从DNS服务地址,tips 从服务器需要配置ns2地址。
    mail    IN      A       192.168.5.140
    www     IN      A       192.168.5.150
    www     IN      A       192.168.5.151
    ftp     IN      A       192.168.5.160
    pop     IN      CNAME   mail
    web     IN      CNAME   www
    test    IN      A       192.168.5.170
    *.juzldream.fun. IN     A       192.168.5.88 ;DNS泛域名解析
    
  4. juzldream.jun 反向区域数据文件配置

    $TTL 600
    @       IN      SOA     ns1.juzldream.fun. admin.juzldream.fun. (
                                                2019021803
                                                1H
                                                5M
                                                2D
                                                6H
    )
            IN      NS      ns1.juzldream.fun.
            IN      NS      ns2.juzldream.fun.
    130     IN      PTR     ns1.juzldream.fun.
    128     IN      PTR     ns2.juzldream.fun.
    140     IN      PTR     mail.juzldream.fun.
    150     IN      PTR     www.juzldream.fun.
    151     IN      PTR     www.juzldream.fun.
    160     IN      PTR     ftp.juzldream.fun.
    170     IN      PTR     test.juzldream.fun.
    
  5. 检查配置文件设置是否正确

    [root@testdns ~]# named-checkconf

  6. 检查zone文件配置是否正确

    [root@testdns ~]# named-checkzone "5.168.192.in-addr.arpa" /var/named/juzldream.back 
    zone 5.168.192.in-addr.arpa/IN: loaded serial 2019021804
    OK
    [root@testdns ~]# named-checkzone "juzldream.fun" /var/named/juzldream.fun
    zone juzldream.fun/IN: loaded serial 2019021806
    OK
    
    
  7. 启动DNS服务器

    named -f -g -d 3 -u named

  8. 域名正反向测试

你可能感兴趣的:(主DNS服务器配置)