unbound主从

发布时间:2017-11-22 23:35:51编辑:admin阅读(4495)

    环境介绍:

    192.168.78.133Centos7(主DNS)

    192.168.78.134Centos7(辅DNS)

    192.168.78.128Centos6.5 (客户端)


    主DNS搭建,请参考文章《Centos 7安装unbound》

    http://www.py3study.com/index.php/Article/details/id/82.html


    辅DNS搭建,和主DNS方法类似

    步骤就是1~7


    进入配置文件目录

    cd /etc/unbound/local.d

    1.新增配置文件example.com.conf

    vim example.com.conf

    內容如下:


    #不需要进行安全检测

    domain-insecure:"example.com."

    forward-zone:

            name:"."

            #主DNS服务器地址

            forward-addr:"192.168.78.133"


    说明:


    当客户端到192.168.78.134(辅DNS)来请求DNS解析时,则转发到192.168.78.133(主DNS)服务器进行解析,如果解析成功,则缓存一份到本地。以后其它机器再到192.168.78.134(辅DNS)来请求DNS解析时,则不需要转发了,直接使用本地缓存的数据。


    验证配置文件是否正确

    unbound-checkconf

    2.重启unbound服务

    systemctl restart unbound


    同时,192.168.78.133(主DNS) 服务器上的该配置文件里也需要加上这行参数。

    ####主DNS操作部分#########################

    ssh登录到192.168.78.133

    3.编辑配置文件

    vim /etc/unbound/local.d/example.conf

    最后一行添加

    domain-insecure:"example.com."


    4.重启unbound服务

    systemctl restart unbound

    ##########################################


    5.开始在客户端测试

    登录到客户端192.168.78.128,修改客户端的DNS服务器

    vi /etc/resolv.conf

    地址指向192.168.78.134(辅DNS)

    ; generated by /sbin/dhclient-script

    search localdomain

    nameserver 192.168.78.134


    重启nscd服务

    /etc/init.d/nscd restart


    验证解析

    [root@localhost ~]# nslookup 

    > linuxprobe.example.com.

    Server: 192.168.78.134

    Address: 192.168.78.134#53


    Non-authoritative answer:

    Name: linuxprobe.example.com

    Address: 192.168.10.10

    > exit


    可以看到Server的地址为192.168.78.134(辅DNS)

    记录解析正常










关键字