zoukankan      html  css  js  c++  java
  • 使用BIND安装智能DNS服务器(二)---配置rndc远程控制

    首先两个BIND DNS服务器要正常运行。

          主DNS服务器IP:192.168.1.100

    客户机DNS服务器IP:192.168.1.101

    1 主DNS端配置:

    cd /etc/

    生成rndc.conf文件

    rndc-confgen > rndc.conf

    查看文件

    cat rndc.conf

    # Start of rndc.conf
    key "rndc-key" {
    algorithm hmac-md5;
    secret "VcL5wC2GHCzCU7ju+ajC1Q==";
    };
    
    options {
    default-key "rndc-key";
    default-server 127.0.0.1;
    default-port 953;
    };
    # End of rndc.conf
    
    # Use with the following in named.conf, adjusting the allow list as needed:
    # key "rndc-key" {
    # algorithm hmac-md5;
    # secret "VcL5wC2GHCzCU7ju+ajC1Q==";
    # };
    # 
    # controls {
    # inet 127.0.0.1 port 953
    # allow { 127.0.0.1; } keys { "rndc-key"; };
    # };
    # End of named.conf

    vim named.conf

     将下面这些添加到named.conf末尾

    //支持远程rndc控制
    key "rndc-key" {
    algorithm hmac-md5;
    secret "VcL5wC2GHCzCU7ju+ajC1Q==";
    };
    
    //inet: 如果只允许本地使用rndc控制把*换为127.0.0.1
    //allow: 允许通过rndc管理此DNS的IP、KEY,这里设置为客户端IP
    controls {
    inet * port 953    
    allow { localhost; 192.168.1.101; } keys { "rndc-key"; }; 
    };
    
     

    删除rndc.key

    rm rndc.key -f

    重启BIND

    service named restart

    2 客户端配置

    cd /etc/

    生成rndc.conf文件

    rndc-confgen > rndc.conf

    编辑文件,修改secret为主DNS服务器配置中的值

    vim rndc.conf

    # Start of rndc.conf
    key "rndc-key" {
    algorithm hmac-md5;
    secret "VcL5wC2GHCzCU7ju+ajC1Q==";
    };
    
    options {
    default-key "rndc-key";
    default-server 127.0.0.1;
    default-port 953;
    };
    # End of rndc.conf
    
    # Use with the following in named.conf, adjusting the allow list as needed:
    # key "rndc-key" {
    # algorithm hmac-md5;
    # secret "VcL5wC2GHCzCU7ju+ajC1Q==";
    # };
    # 
    # controls {
    # inet 127.0.0.1 port 953
    # allow { 127.0.0.1; } keys { "rndc-key"; };
    # };
    # End of named.conf

    vim named.conf

     将下面这些添加到named.conf末尾,注意:secret的值要和主服务器中的secret值相同

    //支持远程rndc控制
    key "rndc-key" {
    algorithm hmac-md5;
    secret "VcL5wC2GHCzCU7ju+ajC1Q==";
    };
    
    //inet: 如果只允许本地使用rndc控制把*换为127.0.0.1
    //allow: 允许通过rndc管理此DNS的IP、KEY,这里设置为主DNS服务器IP
    controls {
    inet * port 953    
    allow { localhost; 192.168.1.100; } keys { "rndc-key"; }; 
    };

     

    删除rndc.key

    rm rndc.key -f

    重启BIND

    service named restart

  • 相关阅读:
    C/C++中volatile关键字详解(转)
    Spring中 @Autowired标签与 @Resource标签 的区别(转)
    [转]各种互斥量的总结
    nginx限制ip访问(转)
    HDU 4833 Best Financing (DP)
    HDU 4832 Chess (DP)
    HDU 4831 Scenic Popularity
    POJ 2155 Matrix (二维线段树)
    POJ 2155 Matrix (二维树状数组)
    HDU 4819 Mosaic (二维线段树)
  • 原文地址:https://www.cnblogs.com/etangyushan/p/4335225.html
Copyright © 2011-2022 走看看