0

we have deployed a new zone on our dns :

named.conf for the new zone (like others)

zone "db.0.30.10.in-addr.arpa" {
                type master;
                file "/etc/named/internal/db.0.30.10.in-addr.arpa";
                notify yes;
                allow-transfer {
                        dns2-int; key "int-key";
                };
                check-names warn;
        };

this is the new file for the zone (like others):

[root@dns-1 zones]# cat db.0.30.10.in-addr.arpa
$ORIGIN 0.30.10.in-addr.arpa.
$TTL 3600
@          IN   SOA          ns1.0.30.10.in-addr.arpa. domainmaster.0.30.10.in-addr.arpa. 2021072301 10800 3600 2419200 900
@          IN   NS           ns1
ns1        IN   A            10.25.16.7
@          IN   NS           ns2
ns2        IN   A            10.25.16.8
@          IN   NS           ns3
ns3        IN   A            10.20.1.15
@          IN   NS           ns4
ns4        IN   A            10.20.9.15

When I try to restart named there is a issue with the zone and named does not start :

Feb 15 08:13:36 dns-1 bash[root]: systemctl restart named

Feb 15 08:13:36 dns-1 bash[3211663]: /etc/named/internal/db.6.30.10.in-addr.arpa:10: ignoring out-of-zone data (6.30.10.in-addr.arpa)
Feb 15 08:13:36 dns-1 bash[3211663]: /etc/named/internal/db.6.30.10.in-addr.arpa:11: ignoring out-of-zone data (ns4.6.30.10.in-addr.arpa)
Feb 15 08:13:36 dns-1 bash[3211663]: /etc/named/internal/db.6.30.10.in-addr.arpa: file does not end with newline
Feb 15 08:13:36 dns-1 bash[3211663]: zone db.6.30.10.in-addr.arpa/IN: has 0 SOA records
Feb 15 08:13:36 dns-1 bash[3211663]: zone db.6.30.10.in-addr.arpa/IN: has no NS records
Feb 15 08:13:36 dns-1 bash[3211663]: zone db.6.30.10.in-addr.arpa/IN: not loaded due to errors.
Feb 15 08:13:36 dns-1 bash[3211663]: internal/db.6.30.10.in-addr.arpa/IN: bad zone

Can you advise if there is something wrong and how to fix please ? Thanks

  • The errors are for the zone db.6.30.10.in-addr.arpa but you're showing us db.0.30.10.in-addr.arpa (a six versus a zero) – Bob Feb 15 '22 at 13:56

2 Answers2

0

You say:

zone "db.0.30.10.in-addr.arpa"

So you are defining zone db.0.30.10.in-addr.arpa where db is probably not right.

Then in the zone you say:

$ORIGIN 0.30.10.in-addr.arpa.

which is probably correct, but incompatible with the zone statement above as this new zone is "above" previous one (it would have worked in opposite direction FWIW).

Which is also what the bind log messages tell you except that they correspond to a zone declaration of db.6.30.10.in-addr.arpa and not db.0.30.10.in-addr.arpa, so either you have both problems or you just created an error when you obfuscated.

So in short, the db. has to go in the zone name. You are probably mixing the zone name and the file name (which is 100% arbitrary, there is no obligation to have a db anywhere in the name)

Patrick Mevzek
  • 9,273
  • 7
  • 29
  • 42
0

You have two configurations in total:

1. named.conf configuration

2. zone file configuration

for the named.conf I will provide with a sample, which as you may see you have your main named configuration and zone names inside.

the zone files are kept in a separate file

Sample:

options {
    directory   "/zones";
    pid-file    "/var/run/named/pid";
    statistics-file "/var/stats/named.stats";
    listen-on   { 127.0.0.1; 1.2.3.4;};
        allow-transfer {127.0.0.1; 2.3.4.5;};
        recursive-clients 20;
    disable-empty-zone "255.255.255.255.IN-ADDR.ARPA";
    disable-empty-zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.ARPA";
    disable-empty-zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.IP6.ARPA";
    };

key "rndc-key" {
    algorithm hmac-md5;
    secret "HashedContent";
};

controls {
      inet 127.0.0.1 port 953
              allow { 127.0.0.1; } keys { "rndc-key"; };
};

zone "." {
    type slave;
    file "/etc/namedb/slave/root.slave";
    masters {
        192.5.5.241;    // F.ROOT-SERVERS.NET.
    };
    notify no;
};
zone "arpa" {
    type slave;
    file "/etc/namedb/slave/arpa.slave";
    masters {
        192.5.5.241;    // F.ROOT-SERVERS.NET.
    };
    notify no;
};
zone "in-addr.arpa" {
    type slave;
    file "/etc/namedb/slave/in-addr.arpa.slave";
    masters {
        192.5.5.241;    // F.ROOT-SERVERS.NET.
    };
    notify no;
};

zone "localhost"    { type master; file "/etc/namedb/master/localhost-forward.db"; };
zone "127.in-addr.arpa" { type master; file "/etc/namedb/master/localhost-reverse.db"; };
zone "255.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "0.ip6.arpa"   { type master; file "/etc/namedb/master/localhost-reverse.db"; };
zone "0.in-addr.arpa"   { type master; file "/etc/namedb/master/empty.db"; };
zone "10.in-addr.arpa"     { type master; file "/etc/namedb/master/empty.db"; };
zone "16.172.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "17.172.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "18.172.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "19.172.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "20.172.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "21.172.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "22.172.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "23.172.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "24.172.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "25.172.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "26.172.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "27.172.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "28.172.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "29.172.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "30.172.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "31.172.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "168.192.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "254.169.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "2.0.192.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "100.51.198.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "113.0.203.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "test" { type master; file "/etc/namedb/master/empty.db"; };
zone "example" { type master; file "/etc/namedb/master/empty.db"; };
zone "invalid" { type master; file "/etc/namedb/master/empty.db"; };
zone "example.com" { type master; file "/etc/namedb/master/empty.db"; };
zone "example.net" { type master; file "/etc/namedb/master/empty.db"; };
zone "example.org" { type master; file "/etc/namedb/master/empty.db"; };
zone "18.198.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "19.198.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "240.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "241.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "242.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "243.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "244.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "245.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "246.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "247.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "248.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "249.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "250.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "251.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "252.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "253.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };
zone "254.in-addr.arpa" { type master; file "/etc/namedb/master/empty.db"; };


// Customers Zones
zone "domain1.com" { type master; file "db.domain1.com.hosts"; };
zone "domain2.net" { type master; file "db.domain2.net.hosts"; };

as you observed I have mentioned the names of the zone files in the named.conf and stored them in "/zones" directory. each zone file name must correspond to the same name as you mentioned here.

so for example, a zone file name must exactly be "db.domain1.com.hosts" and then inside the file, you have your records defined.

By using this file you may see some issues, but by reading the log file you can edit and remove unnecessary options. This was just a sample to guide you on how to have the main config and zone files in two separated configuration files for sake of simplicity.

Zareh Kasparian
  • 517
  • 3
  • 17