[root@localhost sbin]# ./named -v
bind 9.5.1-p3-v3.0.9

问题现象:

[root@localhost sbin]# ./rndc flush -p 10056
rndc: connect failed: 127.0.0.1#953: connection refused

问题分析:

看报错认为rndc使用的953端口,将端口换为953后报同样的错误

首先看了下bind的named.conf文件

......
include "/home/alipms/zxtest/bind981/etc/rndc.key";
controls {
inet 127.0.0.1 port 10056 allow { 127.0.0.1; } keys { "rndc-key"; };
};
......

再看下rndc.key

key "rndc-key" {
algorithm hmac-md5;
secret "zwKd/d9neRFzJ8v/FVB8oA==";
};

最后查看了下bind的启动日志:

......
23-Jan-2014 08:47:55.106 command channel listening on 127.0.0.1#10056
......

可以确定rndc使用的是10056端口

[root@localhost sbin]# ./rndc -h
Usage: rndc [-b address] [-c config] [-s server] [-p port]
[-k key-file ] [-y key] [-V] command
......

可以看到是rndc命令输入有误

解决方式:

将命令换为:

[root@localhost sbin]# ./rndc -p 10056 flush

查看bind日志为:

23-Jan-2014 09:15:33.387 received control channel command 'flush'
23-Jan-2014 09:15:33.388 flushing caches in all views succeeded

PS:

可以使用rndc-confgen直接生成rndc.key,rndc-confgen和rndc在同一目录下

[root@localhost sbin]# ./rndc-confgen -h
Usage:
rndc-confgen [-a] [-b bits] [-c keyfile] [-k keyname] [-p port] [-r randomfile] [-s addr] [-t chrootdir] [-u user]
-a: generate just the key clause and write it to keyfile (/home/alipms/zxtest/bind981/etc/rndc.key)
-b bits: from 1 through 512, default 128; total length of the secret
-c keyfile: specify an alternate key file (requires -a)
-k keyname: the name as it will be used in named.conf and rndc.conf
-p port: the port named will listen on and rndc will connect to
-r randomfile: source of random data (use "keyboard" for key timing)
-s addr: the address to which rndc should connect
-t chrootdir: write a keyfile in chrootdir as well (requires -a)
-u user: set the keyfile owner to "user" (requires -a)
[root@localhost sbin]# ./rndc-confgen -p 10056 > ./rndc.key

查看生成的rndc.key

# Start of rndc.conf
key "rndc-key" {
algorithm hmac-md5;
secret "FT/3Iknv/lqLDlJFp9MkkQ==";
}; options {
default-key "rndc-key";
default-server 127.0.0.1;
default-port 10056;
};
# End of rndc.conf # Use with the following in named.conf, adjusting the allow list as needed:
# key "rndc-key" {
# algorithm hmac-md5;
# secret "FT/3Iknv/lqLDlJFp9MkkQ==";
# };
#
# controls {
# inet 127.0.0.1 port 10056
# allow { 127.0.0.1; } keys { "rndc-key"; };
# };
# End of named.conf

然后将注释部分:

 key "rndc-key" {
algorithm hmac-md5;
secret "FT/3Iknv/lqLDlJFp9MkkQ==";
}; controls {
inet 127.0.0.1 port 10056
allow { 127.0.0.1; } keys { "rndc-key"; };
};

拷贝至named.conf文件中或拷贝至特定文件中,然后将该文件include至named.conf文件中即可

rndc: connect failed: 127.0.0.1#953: connection refused的更多相关文章

  1. Bind 远程连接出现rndc: connect failed: 192.168.1.66#953: connection refused

    远程连接IP地址为192.168.1.66的BIND DNS服务器,出现 rndc: connect failed: 192.168.1.66#953: connection refused 原因:1 ...

  2. connect failed: 127.0.0.1#953: connection refused

    Problem1 : root@jeremy-VirtualBox:/etc/bind# /etc/init.d/bind9 restart * Stopping domain name servic ...

  3. 解决git Failed to connect to 127.0.0.1 port xxxx: Connection refused

    某天,用git拉取,提交代码的时候出现了git Failed to connect to 127.0.0.1 port xxxx: Connection refused的问题, 开始百度,看了一通.都 ...

  4. 【MongoDB】 Failed to connect to 127.0.0.1:27017, reason: Connection refused

    由于项目需要,在一台虚拟机上安装了MongoDB,但是在启动的时候,出现如下错误: [root@localhost bin]# ./mongo MongoDB shell version v3.4.0 ...

  5. Failed to connect to 127.0.0.1 port 1080: Connection refused package 问题解决方法

    错误: fatal: unable to access 'https://github.com/******': Failed to connect to 127.0.0.1 port 1080: C ...

  6. zabbix-Get value from agent failed: cannot connect to [[127.0.0.1]:10050]: [111] Connection refused

    监控zabbix服务端这台服务器,然后显示Get value from agent failed: cannot connect to [[127.0.0.1]:10050]: [111] Conne ...

  7. 我遇到的错误curl: (7) Failed to connect to 127.0.0.1 port 1086: Connection refused

    今天我用curl命令,无论如何都是出现: curl: (7) Failed to connect to 127.0.0.1 port 1086: Connection refused 找了很久,不知道 ...

  8. curl: (7) Failed to connect to 127.0.0.1 port 1086: Connection refused

    今天我用curl命令,无论如何都是出现: curl: (7) Failed to connect to 127.0.0.1 port 1086: Connection refused 找了很久,不知道 ...

  9. git时 Failed to connect to 127.0.0.1 port 1080: Connection refused

    在公司换了一台电脑之后发现git clone 和 npm install都失败,报错为 fatal: unable to access 'https://github.com/netease-im/N ...

随机推荐

  1. BZOJ_1615_[Usaco2008_Mar]_The Loathesome_Hay Baler_麻烦的干草打包机_(模拟+宽搜/深搜)

    描述 http://www.lydsy.com/JudgeOnline/problem.php?id=1615 一个主动轮带着一些轮子转,轮子带着轮子转,轮子带着轮子转...一个非主动轮只会被一个轮子 ...

  2. [HDU 1963] Investment

    Investment Time Limit:10000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu   Descrip ...

  3. 【转】win7 旗舰版激活密钥

    原文网址:http://zhidao.baidu.com/question/1496641289562471179.html 旗舰版KH2J9-PC326-T44D4-39H6V-TVPBYTFP9Y ...

  4. BrnShop开源网上商城第六讲:扩展视图功能

    在正式讲解扩展视图功能以前,我们有必要把视图的工作原理简单说明下.任何一个视图都会被翻译成一个c#类,并保存到指定的位置,然后被编译.这也就是为什么能在视图中包含c#代码片段的原因.下面我们通过一个项 ...

  5. windows下rundll32介绍

    最近看书介绍rundll32可以加载dll文件并执行其中导出函数,在MSDN中我们可以看到绍http://support.microsoft.com/kb/164787/zh-cn rundll32调 ...

  6. 【CSS】Beginner4:Text

    1.alter the size and shape of the text 2.font-family:Arial, Verdana,"Times New Roman",helv ...

  7. 【HTML】Beginner7:Image

    1.Image     The web is not just about text,it is a multi-media extravaganza and the most common form ...

  8. spoj 1812 LCS2(SAM+DP)

    [题目链接] http://www.spoj.com/problems/LCS2/en/ [题意] 求若干个串的最长公共子串. [思路] SAM+DP 先拿个串建个SAM,然后用后面的串匹配,每次将所 ...

  9. RTCP

    RTCP RTCP协议将控制包周期发送给所有连接者,应用与数据包相同的分发机制.低层协议提供数据与控制包的复用,如使用单独的UDP端口号.RTCP执行下列四大功能: (1) 主要是提供数据发布的质量反 ...

  10. Detect combined string

    写一个程序判断字符串A是否为其他两个字符串的组合,组合过程中其他两个字符串的相对顺序不能被破坏. 举例说明:abc和def可以组成字符串adebcf,但不能组成aefbcd,因为def的相对顺序已经被 ...