说明:这是一篇对DNS排错的文章,因为在网上(包括RedHat知识库)几乎没有对文中提到的错误进行直接描述和提出最好最快的解决方案的报告,经过长达尽一个小时的排错和资料查阅才有了这篇文章的脱稿。
昨天我刚刚在非生产环境中的Red Hat Enterprise Linux Server上配置了一台DNS服务器,以做测试使用。但是很快遇到了一个奇怪的错误。
我在执行“service named status”后,其中第一行显示如下内容:
- [root@localhost ~]# service named status
- rndc: connect failed: 127.0.0.1#953: connection refused
- named (pid 6207) is running...
- [root@localhost ~]#
一般大家都知道,rndc 主要是用来控制named进程及其配置文件的,可以用来连接DNS服务器并对配置进行重新载入,其端口号就是953。那么导致这个错误的原因可能是什么呢?
我的解决思路:
首先,发现问题,仔细阅读查看命令的回显信息。例如我详细的查看service的状态信息。
- [root@localhost gdd]# service --status-all
- abrtd (pid 2371) is running...
- abrt-dump-oops (pid 2379) is running...
- acpid (pid 2111) is running...
- atd (pid 5396) is running...
- auditd (pid 1833) is running...
- automount (pid 2195) is running...
- avahi-daemon (pid 2016) is running...
- Usage: /etc/init.d/bluetooth {start|stop}
- certmonger is stopped
- Stopped
- cgred is stopped
- Frequency scaling enabled using ondemand governor
- crond (pid 2423) is running...
- cupsd (pid 2086) is running...
- dnsmasq is stopped
- dovecot is stopped
- Usage: /etc/init.d/firstboot {start|stop}
- hald (pid 2120) is running...
- I don't know of any running hsqldb server.
- httpd (pid 6595) is running...
- Table: filter
- Chain INPUT (policy ACCEPT)
- num target prot opt source destination
- 1 ACCEPT all ::/0 ::/0 state RELATED,ESTABLISHED
- 2 ACCEPT icmpv6 ::/0 ::/0
- 3 ACCEPT all ::/0 ::/0
- 4 ACCEPT tcp ::/0 ::/0 state NEW tcp dpt:22
- 5 REJECT all ::/0 ::/0 reject-with icmp6-adm-prohibited
- Chain FORWARD (policy ACCEPT)
- num target prot opt source destination
- 1 REJECT all ::/0 ::/0 reject-with icmp6-adm-prohibited
- Chain OUTPUT (policy ACCEPT)
- num target prot opt source destination
- IPsec stopped
- Table: filter
- Chain INPUT (policy ACCEPT)
- num target prot opt source destination
- 1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
- 2 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
- 3 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
- 4 ACCEPT tcp -- 10.0.0.0/8 0.0.0.0/0 tcp dpt:953
- 5 ACCEPT tcp -- 10.0.0.0/8 0.0.0.0/0 tcp dpt:53
- 6 ACCEPT tcp -- 10.0.0.0/8 0.0.0.0/0 tcp dpt:443
- 7 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
- 8 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
- Chain FORWARD (policy ACCEPT)
- num target prot opt source destination
- 1 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
- Chain OUTPUT (policy ACCEPT)
- num target prot opt source destination
- Table: mangle
- Chain PREROUTING (policy ACCEPT)
- num target prot opt source destination
- Chain INPUT (policy ACCEPT)
- num target prot opt source destination
- Chain FORWARD (policy ACCEPT)
- num target prot opt source destination
- Chain OUTPUT (policy ACCEPT)
- num target prot opt source destination
- Chain POSTROUTING (policy ACCEPT)
- num target prot opt source destination
- Table: nat
- Chain PREROUTING (policy ACCEPT)
- num target prot opt source destination
- Chain POSTROUTING (policy ACCEPT)
- num target prot opt source destination
- Chain OUTPUT (policy ACCEPT)
- num target prot opt source destination
- irqbalance (pid 1895) is running...
- Kdump is operational
- started
- qpidd is stopped
- matahari-qmf-hostd is stopped
- matahari-qmf-networkd is stopped
- matahari-qmf-serviced is stopped
- matahari-qmf-sysconfigd is stopped
- Checking for mcelog
- mcelog is stopped
- mdmonitor is stopped
- messagebus (pid 1993) is running...
- mysqld is stopped
- rndc: connect failed: 127.0.0.1#953: connection refused
- named is stopped
- No open transaction
- netconsole module not loaded
- Configured devices:
- lo eth0
- Currently active devices:
- lo eth0
- NetworkManager (pid 2004) is running...
- rpc.svcgssd is stopped
- rpc.mountd is stopped
- nfsd is stopped
- rpc.rquotad is stopped
- rpc.statd (pid 2037) is running...
- nmbd is stopped
- ntpd (pid 2243) is running...
- oddjobd is stopped
- portreserve (pid 1851) is running...
- master (pid 2347) is running...
- postmaster is stopped
- Process accounting is disabled.
- qpidd (pid 2390) is running...
- quota_nld is stopped
- rdisc is stopped
- restorecond (pid 10836) is running...
- rhnsd (pid 2445) is running...
- rhsmcertd (pid 2457 2456) is running...
- rngd is stopped
- rpcbind (pid 1909) is running...
- rpc.gssd is stopped
- rpc.idmapd (pid 2076) is running...
- rpc.svcgssd is stopped
- rsyslogd (pid 1858) is running...
- sandbox is stopped
- saslauthd is stopped
- sfcb is not running, but pid file exists
- smartd is stopped
- smbd is stopped
- snmpd is stopped
- snmptrapd is stopped
- spamd is stopped
- spice-vdagentd is stopped
- openssh-daemon (pid 2233) is running...
- sssd is stopped
- CIM server (2470) is runningtomcat6 is stopped [ OK ]
- vsftpd is stopped
- wdaemon is stopped
- Webmin (pid 2498) is running
- wpa_supplicant (pid 2020) is running...
- ypbind is stopped
很显然,上面的显示中的第97行显示的
- rndc: connect failed: 127.0.0.1#953: connection refused
- named is stopped
是错误的信息。
