LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Bind9: NDC command failed : rndc: connect failed: connection refused (http://www.linuxquestions.org/questions/linux-networking-3/bind9-ndc-command-failed-rndc-connect-failed-connection-refused-230661/)

Boudewijn 09-14-2004 06:47 PM

Bind9: NDC command failed : rndc: connect failed: connection refused
 
Well, I've edited my bind9 config using webmin and the mandrake server admin guide (yeah the official one), and I'm getting this error:

NDC command failed : rndc: connect failed: connection refused

I've googled it and did not udnerstnad what was wrong. This is my /var/log/messages :


Sep 15 01:35:19 zeus named[13116]: starting BIND 9.2.3 -u named
Sep 15 01:35:19 zeus named[13116]: using 1 CPU
Sep 15 01:35:19 zeus named: named startup succeeded
Sep 15 01:35:19 zeus named[13116]: loading configuration from '/etc/named.conf'
Sep 15 01:35:19 zeus named[13116]: listening on IPv4 interface lo, 127.0.0.1#53
Sep 15 01:35:19 zeus named[13116]: listening on IPv4 interface eth1, 10.0.0.13#53
Sep 15 01:35:19 zeus named[13116]: couldn't add command channel 127.0.0.1#953: not found
Sep 15 01:35:19 zeus named[13116]: couldn't add command channel ::1#953: not found
Sep 15 01:35:19 zeus named[13116]: couldn't open pid file '/var/run/named.pid': Permission denied
Sep 15 01:35:19 zeus named[13116]: exiting (due to early fatal error)
Sep 15 01:38:31 zeus named: named startup succeeded
Sep 15 01:38:31 zeus named[13196]: starting BIND 9.2.3 -u named
Sep 15 01:38:31 zeus named[13196]: using 1 CPU
Sep 15 01:38:31 zeus named[13196]: loading configuration from '/etc/named.conf'
Sep 15 01:38:31 zeus named[13196]: listening on IPv4 interface lo, 127.0.0.1#53
Sep 15 01:38:31 zeus named[13196]: listening on IPv4 interface eth1, 10.0.0.13#53
Sep 15 01:38:31 zeus named[13196]: couldn't add command channel 127.0.0.1#953: not found
Sep 15 01:38:31 zeus named[13196]: couldn't add command channel ::1#953: not found
Sep 15 01:38:31 zeus named[13196]: couldn't open pid file '/var/run/named.pid': Permission denied
Sep 15 01:38:31 zeus named[13196]: exiting (due to early fatal error)
Sep 15 01:38:32 zeus kernel: martian source 10.0.0.13 from 10.0.0.13, on dev eth1
Sep 15 01:38:32 zeus kernel: ll header: 00:10:22:fd:df:cd:00:90:d0:ae:e2:82:08:00
Sep 15 01:38:32 zeus kernel: Redirect from 10.0.0.138 on eth1 about 10.0.0.13 ignored.
Sep 15 01:38:32 zeus kernel: Advised path = 10.0.0.13 -> 10.0.0.13, tos 00
Sep 15 01:38:34 zeus named[13225]: starting BIND 9.2.3 -u named
Sep 15 01:38:34 zeus named[13225]: using 1 CPU
Sep 15 01:38:34 zeus named: named startup succeeded
Sep 15 01:38:34 zeus named[13225]: loading configuration from '/etc/named.conf'
Sep 15 01:38:34 zeus named[13225]: listening on IPv4 interface lo, 127.0.0.1#53
Sep 15 01:38:34 zeus named[13225]: listening on IPv4 interface eth1, 10.0.0.13#53
Sep 15 01:38:35 zeus named[13225]: couldn't add command channel 127.0.0.1#953: not found
Sep 15 01:38:35 zeus named[13225]: couldn't add command channel ::1#953: not found
Sep 15 01:38:35 zeus named[13225]: couldn't open pid file '/var/run/named.pid': Permission denied
Sep 15 01:38:35 zeus named[13225]: exiting (due to early fatal error)


I don't know why named shouldn't get access to it's own PID file (i tried to start it as root....).

Does anyone recognize this problem (and would that 'anyone' please help me???) ?

My /etc/named.conf:

options {
directory "/etc";
pid-file "/var/run/named.pid";
forwarders {
194.109.6.66;
194.109.9.99;
194.109.104.104;
};
};

zone "." {
type hint;
file "/etc/db.cache";
};


zone "0.0.127.in-addr.arpa" {
type master;
file "/etc/127.0.0.rev";
};

zone "boudewijnector.com" {
type master;
file "/etc/boudewijnector.com.hosts";
};

zone "0.0.10.in-addr.arpa" {
type master;
file "/etc/10.0.0.rev";
};

maxut 09-15-2004 03:55 AM

"couldn't open pid file '/var/run/named.pid': Permission denied"
what is the permissions of that file?
ls -l /var/run/named.pid
i think named must be the owner of that file.


"couldn't add command channel 127.0.0.1#953: not found"
there must be some lines about rndc key in /etc/named.conf and /etc/rndc.conf . check them.

Boudewijn 09-15-2004 04:05 AM

I just had a look at the PID:


/var/run/named.pid doesn't exist --> var/run/named does . I chown'ed it to named .

About the RNDC conf file; I do not know what to check or where to look so I've posted it. Would you min hinting me where the error is?

RNDC.conf:


options {
default-server localhost;
default-key "key";
};

server localhost {
key "key";
};

key "key" {
algorithm hmac-md5;
secret "c3Ryb25nIGVub3VnaCBmb3IgYSBtYW4gYnV0IG1hZGUgZm9yIGEgd29tYW4K";
};

maxut 09-15-2004 04:22 AM

the following may help u.
http://www.linuxquestions.org/questi...hreadid=229950

good luck

Boudewijn 09-15-2004 04:29 AM

Thanks, I'll ahve look in the afternoon ;)

Boudewijn 09-15-2004 07:42 AM

Well, I read the other topic

I don't run it chrooted, and the hostnames are correct... so I don't know what's wrong.

This is /var/log/messages (it's still the same :+) :


Sep 15 14:39:23 zeus named[5089]: starting BIND 9.2.3 -u named
Sep 15 14:39:23 zeus named[5089]: using 1 CPU
Sep 15 14:39:23 zeus named[5089]: loading configuration from '/etc/named.conf'
Sep 15 14:39:23 zeus named[5089]: listening on IPv4 interface lo, 127.0.0.1#53
Sep 15 14:39:23 zeus named[5089]: listening on IPv4 interface eth1, 10.0.0.13#53
Sep 15 14:39:23 zeus named[5089]: couldn't add command channel 127.0.0.1#953: not found
Sep 15 14:39:23 zeus named[5089]: couldn't add command channel ::1#953: not found
Sep 15 14:39:23 zeus named[5089]: couldn't open pid file '/var/run/named.pid': Permission denied
Sep 15 14:39:23 zeus named[5089]: exiting (due to early fatal error)

Anyone's got more ideas?

bathory 09-15-2004 08:01 AM

You should change the ownership of /var/run to user named so he can write in there it's pid, or chmod it to 777 (bad idea), or better change the named.pid location in named.conf to a directory that user named has the right to write.

Boudewijn 09-15-2004 08:30 AM

I've already chown'ed it to 'named'

bathory 09-15-2004 08:49 AM

For my DNS's (primary and secondary) I have created a /var/named dir owned by the user "named" and in /etc/named.conf there are the lines:
Code:

directory "/var/named";
pid-file "named.pid";

So it creates the named.pid in that directory, where also reside the zone files (you have them sparsed in /etc) and it works flawlessly.
Hope that helps.

Boudewijn 09-15-2004 08:55 AM

Hmmpf

Just tried making the new directory in /var/

It already existed :confused: so I chown'ed it to named.
Doesn't work :mad:



This is displayed when tying to start named
Code:

[root@zeus var]# service named restart
Stopping named: rndc: connect failed: connection refused
                                                                [FAILED]
Starting named:                                                [  OK  ]
[root@zeus var]# service named stop
Stopping named: rndc: connect failed: connection refused
                                                                [FAILED]
[root@zeus var]#


maxut 09-15-2004 09:03 AM

Boudewijn

did u try "rndc-confgen" ?

bathory 09-15-2004 09:07 AM

Then chmod 777 /var/named :cool:

scowles 09-15-2004 09:13 AM

You have two problems:

1) command channel not defined

Did you add the following to your named.conf file? This is a copy/paste from my named.conf file.

// --------------------------------------------------------------------
// Define the rndc key for rndc command. Use "rndc-confgen -a -b 512"
// to create a new key
// --------------------------------------------------------------------
include "/etc/rndc.key";

// ------------------------------------------------------------------------
// Only allow localhost access from rndc
// ------------------------------------------------------------------------
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};

2) couldn't open pid file '/var/run/named.pid'

Since you are starting the named process as user named (which is good), then it needs its own directory structure defined subordinate to /var/run so that it has the proper permisiions to create the pid file. In other words, the default permissions of the /var/run directory do not allow a user other than root to create a file/directory.

[root@excelsior run]# pwd
/var/run
[root@excelsior run]# ls -ld named
drwxrwx--- 2 named named 1024 Mar 26 05:28 named

...and the corresponding named.conf entries from my named.conf file

// ------------------------------------------------------------------------
// Specify any "global" options for named
// ------------------------------------------------------------------------
options {

directory "/var/named";
pid-file "/var/run/named/named.pid";
statistics-file "/var/log/named/named.stats";
dump-file "/var/log/named/named.dump";
zone-statistics yes;
and so on.

Boudewijn 09-15-2004 12:54 PM

Ok,

I've done what you told me :

Step 2 (was in /var/run/)

[root@zeus run]# pwd
/var/run
[root@zeus run]# ls -ld named
drwxr-xr-x 2 named named 4096 Mar 25 12:35 named/
[root@zeus run]#

named.conf:


// --------------------------------------------------------------------
// Define the rndc key for rndc command. Use "rndc-confgen -a -b 512"
// to create a new key
// --------------------------------------------------------------------
include "/etc/rndc.key";

options {
directory "/var/named";
pid-file "/var/run/named/named.pid";
statistics-file "/var/log/named/named.stats";
dump-file "/var/log/named/named.dump";
zone-statistics yes;
forwarders {
194.109.6.66;
194.109.9.99;
194.109.104.104;
};
};

zone "." {
type hint;
file "/etc/db.cache";
};

zone "0.0.127.in-addr.arpa" {
type master;
file "/etc/127.0.0.rev";
};

zone "boudewijnector.com" {
type master;
file "/etc/boudewijnector.com.hosts";
};

zone "0.0.10.in-addr.arpa" {
type master;
file "/etc/10.0.0.rev";
};





# Use with the following in named.conf, adjusting the allow list as needed:
key "rndc-key" {
algorithm hmac-md5;
secret "WhS1vNG3buvfRS8wP+o3Vw==";
};

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



And tada: It runs :cool:

I'd like to thank everybody who's helped me a lot!

Cerephim 03-11-2005 08:56 PM

Bind9: NDC command failed : rndc: connect failed: connection refused
 
I finally figured mine out.

In /etc/sysconfig/named was written:
ROOTDIR="/var/named/chroot/"

I had uninstalled the bind-chroot rpm, but didn't notice this little file until I went reading the startup file in /etc/init.d/named.

If you completely comment out that line (which left my file with NO active lines), it may start for you.


All times are GMT -5. The time now is 06:38 AM.