I'm configing CentOS Web Panel on my server but there is a problem all my services is working but "BIND DNS Server"

When i try to start it. It says :

Job for named.service failed because the control process exited with error code. See "systemctl status named.service" and "journalctl -xe" for details.

When i click on show Show journalctl output it contains this :

- The start-up result is done.
Aug 12 14:13:22 2.179.254.91 systemd[1]: Starting Berkeley Internet Name Domain (DNS)...
-- Subject: Unit named.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit named.service has begun starting up.
Aug 12 14:13:22 2.179.254.91 bash[23218]: /etc/named.conf:11: unknown option 'listen-on'
Aug 12 14:13:22 2.179.254.91 bash[23218]: /etc/named.conf:12: unknown option 'listen-on-v6'
Aug 12 14:13:22 2.179.254.91 bash[23218]: /etc/named.conf:13: unknown option 'directory'
Aug 12 14:13:22 2.179.254.91 bash[23218]: /etc/named.conf:14: unknown option 'dump-file'
Aug 12 14:13:22 2.179.254.91 bash[23218]: /etc/named.conf:15: unknown option 'statistics-file'
Aug 12 14:13:22 2.179.254.91 bash[23218]: /etc/named.conf:16: unknown option 'memstatistics-file'
Aug 12 14:13:22 2.179.254.91 bash[23218]: /etc/named.conf:17: unknown option 'allow-query'
Aug 12 14:13:22 2.179.254.91 bash[23218]: /etc/named.conf:27: unknown option 'recursion'
Aug 12 14:13:22 2.179.254.91 bash[23218]: /etc/named.conf:27: unknown option 'dnssec-enable'
Aug 12 14:13:22 2.179.254.91 bash[23218]: /etc/named.conf:28: unknown option 'dnssec-validation'
Aug 12 14:13:22 2.179.254.91 bash[23218]: /etc/named.conf:29: unknown option 'bindkeys-file'
Aug 12 14:13:22 2.179.254.91 bash[23218]: /etc/named.conf:29: unknown option 'managed-keys-directory'
Aug 12 14:13:22 2.179.254.91 bash[23218]: /etc/named.conf:29: unknown option 'pid-file'
Aug 12 14:13:22 2.179.254.91 bash[23218]: /etc/named.conf:30: unknown option 'session-keyfile'
Aug 12 14:13:22 2.179.254.91 systemd[1]: named.service: control process exited, code=exited status=1
Aug 12 14:13:22 2.179.254.91 systemd[1]: Failed to start Berkeley Internet Name Domain (DNS).
-- Subject: Unit named.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit named.service has failed.
-- 
-- The result is failed.
Aug 12 14:13:22 2.179.254.91 systemd[1]: Unit named.service entered failed state.
Aug 12 14:13:22 2.179.254.91 systemd[1]: named.service failed.

named.conf file:

//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a any DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
// See the BIND Administrator's Reference Manual (ARM) for details about the
// configuration located in /usr/share/doc/bind-{version}/Bv9ARM.htmloptions {
    listen-on port 53 { any; };
    listen-on-v6 port 53 { ::1; };
    directory   "/var/named";
    dump-file   "/var/named/data/cache_dump.db";
    statistics-file "/var/named/data/named_stats.txt";
    memstatistics-file "/var/named/data/named_mem_stats.txt";
    allow-query     { any; };   /* 
     - If you are building an AUTHORITATIVE DNS server, do NOT enable recursion.
     - If you are building a RECURSIVE (caching) DNS server, you need to enable 
       recursion. 
     - If your recursive DNS server has a public IP address, you MUST enable access 
       control to limit queries to your legitimate users. Failing to do so will
       cause your server to become part of large scale DNS amplification 
       attacks. Implementing BCP38 within your network would greatly
       reduce such attack surface 
    */
    recursion no;   dnssec-enable yes;
    dnssec-validation yes;  /* Path to ISC DLV key */
    bindkeys-file "/etc/named.iscdlv.key";  managed-keys-directory "/var/named/dynamic";    pid-file "/run/named/named.pid";
    session-keyfile "/run/named/session.key";
};logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};zone "." IN {
    type hint;
    file "named.ca";
};include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";

zone "ftrade.ir" {
    type master;
    file "/var/named/ftrade.ir.db";};// zone_end ftrade.ir

//zone "nss1.infz.ir" {type master;file "/var/named/nss1.infz.ir.db";};//zone "" {type master;file "/var/named/.db";};
//zone "" {type master;file "/var/named/.db";};//zone "ns1.centos-webpanel.com" {type master;file "/var/named/ns1.centos-webpanel.com.db";};
//zone "ns2.centos-webpanel.com" {type master;file "/var/named/ns2.centos-webpanel.com.db";};

// zone infz.ir
zone "infz.ir" {
    type master;
    file "/var/named/infz.ir.db";};
// zone_end infz.ir

What i want to do is , I want to work with my domain "infz.ir" and my web panel use its dns with this ip : 2.179.254.91 My dns are : ns1.infz.ir ns2.infz.ir

  • Why are you running a nameserver if you have one with your provider? In 99% of all cases, you don't need this and can safely disable BIND. – Sven Aug 12 at 9:33
  • @Sven i dont get it , what can i run it without bind ? – Danial RiCaRoS Aug 12 at 9:35
  • At the end of the 10th line of named.conf, you are missing a newline, as options { ends up being part of the comment, causing the errors. – Torin Carey Aug 12 at 13:09
up vote 0 down vote accepted

Your named.conf is missing a crucial line from the beginning and that's the root cause for all the errors you get. You have the ending for your options { }; block, but it never starts! It should start like this:

options {
    listen-on port 53 { any; };
    // all the other options
};logging {

You have errors in the mentioned zone files.

Aug 12 13:51:26 2.179.254.91 bash[15527]: /var/named/infz.ir.db:4: ignoring out-of-zone data (2.179.254.91)
Aug 12 13:51:26 2.179.254.91 bash[15527]: /var/named/infz.ir.db:11: ignoring out-of-zone data (2.179.254.91)
Aug 12 13:51:26 2.179.254.91 bash[15527]: /var/named/infz.ir.db:12: ignoring out-of-zone data (2.179.254.91)
Aug 12 13:51:26 2.179.254.91 bash[15527]: /var/named/infz.ir.db:14: ignoring out-of-zone data (2.179.254.91)
Aug 12 13:51:26 2.179.254.91 bash[15527]: /var/named/infz.ir.db:18: ignoring out-of-zone data (2.179.254.91)
Aug 12 13:51:26 2.179.254.91 bash[15527]: /var/named/infz.ir.db:18: warning: '2.179.254.91.': MX is an address
Aug 12 13:51:26 2.179.254.91 bash[15527]: /var/named/infz.ir.db:26: file does not end with newline
Aug 12 13:51:26 2.179.254.91 bash[15527]: zone infz.ir/IN: has 0 SOA records
Aug 12 13:51:26 2.179.254.91 bash[15527]: zone infz.ir/IN: has no NS records
Aug 12 13:51:26 2.179.254.91 bash[15527]: zone infz.ir/IN: not loaded due to errors.
Aug 12 13:51:26 2.179.254.91 bash[15527]: _default/infz.ir/IN: bad zone
Aug 12 13:51:26 2.179.254.91 bash[15527]: /var/named/ftrade.ir.db:24: file does not end with newline

If you don't know what is wrong with the files, append them to your question.

  • I appended it.. – Danial RiCaRoS Aug 12 at 9:47
  • Adding the config file is a good idea, but the errors are in /var/named/infz.ir.db and /var/named/ftrade.ir.db – RalfFriedl Aug 12 at 11:40

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.