LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   named-checkconf has errors (https://www.linuxquestions.org/questions/linux-newbie-8/named-checkconf-has-errors-916132/)

windstory 11-29-2011 01:21 AM

named-checkconf has errors
 
My box is scientific lunux 6.1 86, and I restored previous running bind configuration. However I could not start named.

This is my "myserver.dyndns.org.zone" file which I used previous version.

Code:

$TTL 86400
@        IN        SOA        myserver.dyndns.org        test.dyndns.org (
                        2007042623        ;
                        28800;
                        7200;
                        604800;
                        86400;
                        )
                IN        NS        myserver.dyndns.org
                IN        A        192.168.0.1
server                IN        A        192.168.0.1

And this the resilt of "named-checkconf".

Code:

[root@localhost dynamicdns_setup]# named-checkconf /var/named/chroot/var/named/myserver.dyndns.org.zone
/var/named/chroot/var/named/myserver.dyndns.org.zone:1: unknown option '$TTL'
/var/named/chroot/var/named/myserver.dyndns.org.zone:4: unknown option '28800'
/var/named/chroot/var/named/myserver.dyndns.org.zone:5: unknown option '7200'
/var/named/chroot/var/named/myserver.dyndns.org.zone:6: unknown option '604800'
/var/named/chroot/var/named/myserver.dyndns.org.zone:7: unknown option '86400'
/var/named/chroot/var/named/myserver.dyndns.org.zone:8: unknown option ')'
/var/named/chroot/var/named/myserver.dyndns.org.zone:11: unexpected token near end of file

Also I have another problem.

I've edited "rndckey" to "rndc-key" at "/etc/named.conf", But "service named start" still has an error message.

Quote:

service named start
Starting named:
Error in named configuration:
/etc/named.conf:7: unknown key 'rndckey'
[FAILED]
Please let me know how to resolve these errors.

Thanks in advance.

bathory 11-29-2011 01:57 AM

Hi,

named-checkconf is used to check named.conf for errors.
If you want to check your zone file, you should use named-checkzone:
Code:

named-checkconf myserver.dyndns.org /var/named/chroot/var/named/myserver.dyndns.org.zone

Quote:

I've edited "rndckey" to "rndc-key" at "/etc/named.conf", But "service named start" still has an error message.

Quote:
service named start
Starting named:
Error in named configuration:
/etc/named.conf:7: unknown key 'rndckey'
[FAILED]
You should make sure that the key name is the same in both named.conf and rndc.conf.

Regards

windstory 11-29-2011 02:17 AM

bathory/
Thanks for your kind reply.

The result is here:

Quote:

[root@localhost dynamicdns_setup]# named-checkconf myserver.dyndns.org /var/named/chroot/var/named/myserver.dyndns.org.zone
usage: named-checkconf [-h] [-j] [-p] [-v] [-z] [-t directory] [named.conf]
[root@localhost dynamicdns_setup]# locate rndc.conf
/usr/share/doc/bind-9.7.3/arm/man.rndc.conf.html
/usr/share/man/man5/rndc.conf.5.gz

bathory 11-29-2011 02:34 AM

Oups sorry for that...
I said you need named-checkzone, but in the command I used named-checkconf.
Here is the correct one
Code:

named-checkzone myserver.dyndns.org /var/named/chroot/var/named/myserver.dyndns.org.zone
Or since you're running bind chrooted under /var/named/chroot,
Code:

named-checkzone -t var/named/chroot myserver.dyndns.org /var/named/myserver.dyndns.org.zone

windstory 11-29-2011 02:46 AM

The results are here:

Quote:

[root@localhost dynamicdns_setup]# named-checkzone myserver.dyndns.org /var/named/chroot/var/named/myserver.dyndns.org.zone
zone myserver.dyndns.org/IN: NS 'myserver.dyndns.org.myserver.dyndns.org' has no address records (A or AAAA)
zone myserver.dyndns.org/IN: not loaded due to errors.

[root@localhost dynamicdns_setup]# named-checkzone -t /var/named/chroot myserver.dyndns.org /var/named/myserver.dyndns.org.zone
zone myserver.dyndns.org/IN: NS 'myserver.dyndns.org.myserver.dyndns.org' has no address records (A or AAAA)
zone myserver.dyndns.org/IN: not loaded due to errors.

windstory 11-29-2011 02:49 AM

And the "0.168.192.in-addr.arpa.zone" file is:

Quote:

$TTL 86400
@ IN SOA @ root (
5;
28800;
7200;
604800;
86400;
)
IN NS server
1 IN PTR myserver.dyndns.org

bathory 11-29-2011 03:01 AM

Quote:

zone myserver.dyndns.org/IN: NS 'myserver.dyndns.org.myserver.dyndns.org' has no address records (A or AAAA)
This is because you missed the trailing dot in the NS RR and you don't have an A RR for it. So edit the zone file, using the following, increase the serial and re-check
Code:

...
                IN        NS        myserver.dyndns.org.
myserver  IN    A      192.168.0.1
...

Quote:

And the "0.168.192.in-addr.arpa.zone" file is:
Same goes for the reverse zone. Missed the trailing dot and you're using server instead of myserver in the NS RR
Code:

...
  IN NS myserver
1 IN PTR myserver.dyndns.org.


windstory 11-29-2011 03:20 AM

Thanks. But "0.168.192.in-addr.arpa.zone" file has still error.

Quote:

[root@localhost dynamicdns_setup]# named-checkzone -t /var/named/chroot myserver.dyndns.org /var/named/myserver.dyndns.org.zone
zone myserver.dyndns.org/IN: loaded serial 2011112901
OK


[root@localhost dynamicdns_setup]# named-checkconf -z
zone myserver.dyndns.org/IN: loaded serial 2011112902
zone 0.168.192.in-addr.arpa/IN: NS 'myserver.0.168.192.in-addr.arpa' has no address records (A or AAAA)
zone 0.168.192.in-addr.arpa/IN: not loaded due to errors.
_default/0.168.192.in-addr.arpa/IN: bad zone
I edited "0.168.192.in-addr.arpa.zone" as this:

Quote:

$TTL 86400
@ IN SOA @ root (
5;
28800;
7200;
604800;
86400;
)
IN NS myserver
1 IN PTR myserver.dyndns.org.

windstory 11-29-2011 03:27 AM

I changed "server" to "server.", then I got this result:

Quote:

[root@localhost dynamicdns_setup]# named-checkconf -z
zone myserver.dyndns.org/IN: loaded serial 2011112902
zone 0.168.192.in-addr.arpa/IN: loaded serial 6
Does this mean OK?

bathory 11-29-2011 03:36 AM

Quote:

I changed "server" to "server.", then I got this result:

Quote:
[root@localhost dynamicdns_setup]# named-checkconf -z
zone myserver.dyndns.org/IN: loaded serial 2011112902
zone 0.168.192.in-addr.arpa/IN: loaded serial 6
Does this mean OK?
It means that the zone file is correct, but it's not going to work, because you don't have an A RR for server.dyndns.org.
You need this:
Code:

$TTL 86400
@ IN SOA @ root (
5;
28800;
7200;
604800;
86400;
)
  IN NS myserver.dyndns.org. ;sorry forgot it as usual :redface:
1 IN PTR myserver.dyndns.org.


windstory 11-29-2011 03:42 AM

bathory/ Thanks a lot!


All times are GMT -5. The time now is 05:03 AM.