rndc: connect failed: connection refused

After starting named with the command /etc/init.d/named start you get an OK but the named server is not running.

The problem could be that named tries to write to the file /var/run/named.pid . On most Linux/UNIX systems the user named is not allowed to write to that file. Instead the user named should write to /var/run/named/named.pid


Open /etc/named.conf and add pid-file "/var/run/named/named.pid" to the "options" section.

If you run rndc-confgen you should add the pid-file section yourself.

# Use with the following in named.conf, adjusting the allow list as needed:
options {
	pid-file "/var/run/named/named.pid";
key "rndc-key" {
      algorithm hmac-md5;
      secret "DTKqPmkyorw5dFYCyz6Fiw==";

controls {
      inet port 953
              allow {; } keys { "rndc-key"; };
# End of named.conf

The solution was found by using strace. strace said that named was trying to write to the wrong pid file and the option was found in the manual.

This bug occoured in Mandrake 10.1 by using Webmin as configuration tool.

by Hans Schou 2005-06-25