Fixing BIND9 rndc error "connection to remote host closed"

Solution 1:

With a little help from @plluksie, I solved this on my own. Here's what I did:

  1. First I ran rndc-confgen -a to regenerate my rndc key and conf file.
  2. Next, I verified that the contents of /etc/rndc.key were the same as /var/named/chroot/etc/rndc.key. They were (/etc/rndc.key was a symlink to /var/named/chroot//etc/rndc.key on my system)
  3. Then I edited /etc/rndc.key and copied the new key. I pasted that key into /etc/rndc.conf and /var/named/chroot/etc/rndc.conf
  4. The i restarted BIND via /etc/init.d/named restart and tested using: rndc reload some.zome.

These steps solved the issue for me.

Solution 2:

Ensure that file /etc/rndc.conf exists and have

key somekey {
         algorithm hmac-md5;
         secret "somesecret";
     };

and also there is proper section in /etc/named.conf :

key "somename" {
     algorithm hmac-md5;
     secret "somesecret";
};

controls {
     inet * port someport allow {"somegroup";} keys {"somename";};
};

Do not forget to read named.conf(5) and rndc.conf(5)

If it will not help, do what is described in the error message: check named and rndc versions (should be the same)