LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Bind will not start after editing /var/named.conf (https://www.linuxquestions.org/questions/linux-server-73/bind-will-not-start-after-editing-var-named-conf-4175535401/)

fail_distraction 02-28-2015 09:24 PM

Bind will not start after editing /var/named.conf
 
I'm trying to set up BIND for the first time. So far so good. I can ping, do an nslookup, and restart the named service just fine. It all resolves from my machine.

Now it is time to create my zones in /var/named.conf and then create the records.

I want to create a forward lookup and a reverse lookup.

So I open /var/named.conf and added the two zones

Code:

    zone "smw.local" IN {
            type master;
            file "smw.local.zone";
            allow-update { none; };
    };

    zone "1.168.192.in-addr.arpa" IN {
            type master;
            file "smw.local.rr.zone";
            allow-update { none; };
    };

But then I can't restart the named service. I do

Code:

service named restart
And the service fails.

smw.local.zone exists and so does smw.local.rr.zone

If I remove the two zones I added to named.conf the service restarts fine.

----

named.conf

smw.local.zone

smw.local.rr.zone

Why might the service not want to start after adding the two zones?

bathory 03-01-2015 03:07 AM

Hi,

You miss the brackets in the SOA records of both zone files. Also you use a CNAME for the MX RR, that is illegal:
Code:

$ORIGIN smw.local.
$TTL 86400
@      IN      SOA    smw.local.      hostmaster.smw.local. (
        2001062501      ;serial
        21600          ;refresh after 6 hours
        3500            ;retry after 1 hour
        604800          ;expire after 1 week
        86400          ;minimum TTL 1 day
        )
        IN      NS              smw.local.
        IN      MX      10      mail.smw.local.
        IN      A              192.168.1.2
dns1    IN      A              192.168.1.2
ns1    IN      A              192.168.1.2
ftp    IN      A              192.168.1.2
mail    IN      CNAME          192.168.1.2
www    in      CNAME          ns1

Code:

$ORIGIN 1.168.192.addr.arpa.
$TTL 86400
@      IN      SOA    smw.local.      hostmaster.smw.local. (
        2001062501      ;serial
        21600          ;refresh after 6 hours
        3500            ;retry after 1 hour
        604800          ;expire after 1 week
        86400          ;minimum TTL 1 day
        )
@      IN      NS      ns1.smw.local.
1      IN      PTR    NS1.smw.local.
2      IN      PTR    ns1.smw.local.
3      IN      PTR    ns1.smw.local.
4      IN      PTR    ns1.smw.local.

BTW you could use named-checkzone to find out the errors

Regards

fail_distraction 03-01-2015 10:58 AM

I made those changes, but it still fails.

Plus you said, "Also you use a CNAME for the MX RR"

So instead of CNAME use MX?

These are the errors

/var/named/smw.local.zone:17: near '192.168.1.2': not a valid number
zone smw.local/IN: loading from master file /var/named/smw.local.zone failed: not a valid number

Maybe it needs a priority number? I'll check and get back.

fail_distraction 03-01-2015 11:25 AM

I'm trying to go back and make things simple. Below is my forward and reverse zone files. The forward file loads, but thereverse doesn't

Forward:
Code:

$ORIGIN smw.local.
$TTL 86400
@      IN      SOA    smw.local.      hostmaster.smw.local. (
        2001062501      ;serial
        21600          ;refresh after 6 hours
        3500            ;retry after 1 hour
        604800          ;expire after 1 week
        86400          ;minimum TTL 1 day
        )
               
        IN      NS              smw.local.
        IN      A              192.168.1.2
dns1    IN      A              192.168.1.2
ns1    IN      A              192.168.1.2

Reverse
Code:

$ORIGIN 1.168.192.addr.arpa.
$TTL 86400
@      IN      SOA    smw.local.      hostmaster.smw.local. (
        2001062501      ;serial
        21600          ;refresh after 6 hours
        3500            ;retry after 1 hour
        604800          ;expire after 1 week
        86400          ;minimum TTL 1 day
        )
               
@      IN      NS      ns1.smw.local.
1      IN      PTR    NS1.smw.local.
2      IN      PTR    ns1.smw.local.

The errors I get from the reverse are

/var/named/smw.local.rr.zone:4: ignoring out-of-zone data (1.168.192.addr.arpa)
/var/named/smw.local.rr.zone:12: ignoring out-of-zone data (1.168.192.addr.arpa)
/var/named/smw.local.rr.zone:13: ignoring out-of-zone data (1.1.168.192.addr.arpa)
/var/named/smw.local.rr.zone:14: ignoring out-of-zone data (2.1.168.192.addr.arpa)
zone smw.local/IN: has 0 SOA records
zone smw.local/IN: has no NS records
zone smw.local/IN: not loaded due to errors.

What's getting me is I can go into my named.conf and remove the reverse zone, but named won't even start then..

bathory 03-01-2015 12:05 PM

Quote:

Plus you said, "Also you use a CNAME for the MX RR"

So instead of CNAME use MX?

These are the errors

/var/named/smw.local.zone:17: near '192.168.1.2': not a valid number
zone smw.local/IN: loading from master file /var/named/smw.local.zone failed: not a valid number
Oops I forgot to change the CNAME with A:
Code:

<snip>
          IN      MX      10      mail.smw.local.
mail    IN    A        192.168.1.2
<snip>


Quote:

/var/named/smw.local.rr.zone:4: ignoring out-of-zone data (1.168.192.addr.arpa)
/var/named/smw.local.rr.zone:12: ignoring out-of-zone data (1.168.192.addr.arpa)
/var/named/smw.local.rr.zone:13: ignoring out-of-zone data (1.1.168.192.addr.arpa)
/var/named/smw.local.rr.zone:14: ignoring out-of-zone data (2.1.168.192.addr.arpa)
zone smw.local/IN: has 0 SOA records
zone smw.local/IN: has no NS records
zone smw.local/IN: not loaded due to errors.
That is because you use a wrong zone name in $ORIGIN. The correct is 1.168.192.in-addr.arpa and not 1.168.192.addr.arpa.

fail_distraction 03-01-2015 12:10 PM

Now it says

/var/named/smw.local.rr.zone:4: ignoring out-of-zone data (1.168.192.in-addr.arpa)
/var/named/smw.local.rr.zone:12: ignoring out-of-zone data (1.168.192.in-addr.arpa)
/var/named/smw.local.rr.zone:13: ignoring out-of-zone data (1.1.168.192.in-addr.arpa)
/var/named/smw.local.rr.zone:14: ignoring out-of-zone data (2.1.168.192.in-addr.arpa)
zone smw.local/IN: has 0 SOA records
zone smw.local/IN: has no NS records
zone smw.local/IN: not loaded due to errors.


I'll keep researching thanks for the help.

------

I forgot to remove the period after arpa. Here is my reverse record now

Code:


$ORIGIN 1.168.192.in-addr.arpa
$TTL 86400
@      IN      SOA    smw.local.      hostmaster.smw.local. (
        2001062501      ;serial
        21600          ;refresh after 6 hours
        3500            ;retry after 1 hour
        604800          ;expire after 1 week
        86400          ;minimum TTL 1 day
        )

@      IN      NS      ns1.smw.local.
1      IN      PTR    ns1.smw.local.
2      IN      PTR    ns1.smw.local.

This is giving the following errors


/var/named/smw.local.rr.zone:4: SOA record not at top of zone (1.168.192.in-addr.arpa.smw.local)
zone smw.local/IN: loading from master file /var/named/smw.local.rr.zone failed: not at top of zone
zone smw.local/IN: not loaded due to errors.

bathory 03-01-2015 12:30 PM

Quote:

$ORIGIN 1.168.192.in-addr.arpa
You miss the trailing dot in the zone name (after the word arpa):
Code:

$ORIGIN 1.168.192.in-addr.arpa.

fail_distraction 03-01-2015 12:44 PM

With the trailing dot I get

/var/named/smw.local.rr.zone:4: ignoring out-of-zone data (1.168.192.in-addr.arpa)
/var/named/smw.local.rr.zone:12: ignoring out-of-zone data (1.168.192.in-addr.arpa)
/var/named/smw.local.rr.zone:13: ignoring out-of-zone data (1.1.168.192.in-addr.arpa)
/var/named/smw.local.rr.zone:14: ignoring out-of-zone data (2.1.168.192.in-addr.arpa)
zone smw.local/IN: has 0 SOA records
zone smw.local/IN: has no NS records
zone smw.local/IN: not loaded due to errors.

bathory 03-01-2015 01:28 PM

Quote:

Originally Posted by fail_distraction (Post 5325218)
With the trailing dot I get

/var/named/smw.local.rr.zone:4: ignoring out-of-zone data (1.168.192.in-addr.arpa)
/var/named/smw.local.rr.zone:12: ignoring out-of-zone data (1.168.192.in-addr.arpa)
/var/named/smw.local.rr.zone:13: ignoring out-of-zone data (1.1.168.192.in-addr.arpa)
/var/named/smw.local.rr.zone:14: ignoring out-of-zone data (2.1.168.192.in-addr.arpa)
zone smw.local/IN: has 0 SOA records
zone smw.local/IN: has no NS records
zone smw.local/IN: not loaded due to errors.

You have something wrong in your config, as it looks like the reverse zone uses the zonefile of the forward zone.
Double-check your configuration files and post the output of both:
Code:

named-checkzone smw.local /var/named/smw.local.zone
named-checkzone 1.168.192.in-addr.arpa /var/named/smw.local.rr.zone


fail_distraction 03-01-2015 01:51 PM

I think it's working. I'm doing all of this for the first time, and at this point I'm a little lost. I got named started. So I did an nslookup for ns1 and it came back

Server: 127.0.0.1
Address: 127.0.0.1#53

Name: ns1.smw.local
Address: 192.168.1.2

Am I right? Have I done it? I got rid of the reverse zone for now from my named.conf. Here is my current zone file.

Code:


$TTL 86400
@  IN  SOA    ns1.mydomain.com. root.mydomain.com. (
        2013042201  ;Serial
        3600        ;Refresh
        1800        ;Retry
        604800      ;Expire
        86400      ;Minimum TTL
)
; Specify nameservers
                IN      NS              ns1.smw.local.
; Resolve nameserver hostnames to IP
ns1            IN      A              192.168.1.2

; Define hostname -> IP pairs which you wish to resolve
@              IN      A              192.168.1.2
www            IN      A              192.168.1.2
ns1            IN      A              192.168.1.2


bathory 03-01-2015 02:02 PM

Quote:

So I did an nslookup for ns1 and it came back

Server: 127.0.0.1
Address: 127.0.0.1#53

Name: ns1.smw.local
Address: 192.168.1.2

Am I right? Have I done it? I got rid of the reverse zone for now from my named.conf. Here is my current zone file.
Yup, it's the correct answer.
You may delete one of the 2 A records for ns1 in the zone file. And don't forget to increase the serial after doing changes to the zonefile

Regards

fail_distraction 03-01-2015 02:13 PM

Thanks for the help! Yo mean get rid of either the www or ns1 record? Why should I change the serial?

And one last question. The reason I am doing this is because I'm going to set up a FreeIPA domain controller and I need a DNS server so my hostnames are resolvable. In order to make hostnames resolvable for all of my machines do I need to add a zone and zone file for each of them?

bathory 03-02-2015 12:38 AM

Quote:

Yo mean get rid of either the www or ns1 record?
I mean to remove one of the two:
Quote:

ns1 IN A 192.168.1.2

Quote:

Why should I change the serial?
You need to increase the serial every time you do changes in a zone file, so named gets notified about the changes. You need to reload named too.


Quote:

The reason I am doing this is because I'm going to set up a FreeIPA domain controller and I need a DNS server so my hostnames are resolvable. In order to make hostnames resolvable for all of my machines do I need to add a zone and zone file for each of them?
If I understand what you're trying to do, I'd say you need to add an entry (an A RR) for each one of your hosts in the same zone file, that is smw.local.zone in your case.

Regards


All times are GMT -5. The time now is 09:49 PM.