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
Solution:
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 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};
# End of named.conf