搭建BIND缓存服务器

搭建BIND缓存服务器

Bind Version: 9.11.4

😄 Written by Zak Zhu

参考

基础概念

Cache-only DNS

DNS缓存服务器不存在自定义的zone文件, 仅依靠缓存来为客户端提供服务, 通常用于负载均衡及加速访问操作.

操作环境

HOSTNAME IP ADDRESS ROLE
mac 192.168.199.103 DNS Client
cachedns.zakzhu.com 192.168.199.173 Cache-only DNS

搭建步骤

1. 安装bind

  • [root@cachedns ~]# yum install bind -y
    

2. 修改/etc/named.conf

  • [root@cachedns ~]# vim /etc/named.conf
    
    options {
        listen-on port 53 { 192.168.199.173; };
    		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";
            recursing-file  "/var/named/data/named.recursing";
            secroots-file   "/var/named/data/named.secroots";
        allow-query     { any; };
        forward only;
        forwarders { 223.5.5.5; 223.6.6.6; };
            recursion yes;
        dnssec-enable no;
        dnssec-validation no;
            bindkeys-file "/etc/named.root.key";
            managed-keys-directory "/var/named/dynamic";
            pid-file "/run/named/named.pid";
            session-keyfile "/run/named/session.key";
    };
    ... ...
    ... ...
    

3. 语法检查

  • [root@cachedns ~]# named-checkconf 
    

4. 启动named

  • [root@cachedns ~]# systemctl enable named
    [root@cachedns ~]# systemctl restart named
    

测试服务

[zak@mac ~ 11:00:39]
$ dig -t a www.dockone.io @192.168.199.173

1

posted @ 2020-03-18 11:27  ZakZhu  阅读(1166)  评论(0编辑  收藏  举报