LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-28-2015, 09:24 PM   #1
fail_distraction
LQ Newbie
 
Registered: Oct 2012
Posts: 24

Rep: Reputation: Disabled
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?
 
Old 03-01-2015, 03:07 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,159
Blog Entries: 1

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
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
 
Old 03-01-2015, 10:58 AM   #3
fail_distraction
LQ Newbie
 
Registered: Oct 2012
Posts: 24

Original Poster
Rep: Reputation: Disabled
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.

Last edited by fail_distraction; 03-01-2015 at 11:07 AM.
 
Old 03-01-2015, 11:25 AM   #4
fail_distraction
LQ Newbie
 
Registered: Oct 2012
Posts: 24

Original Poster
Rep: Reputation: Disabled
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..

Last edited by fail_distraction; 03-01-2015 at 11:59 AM.
 
Old 03-01-2015, 12:05 PM   #5
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,159
Blog Entries: 1

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
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.
 
Old 03-01-2015, 12:10 PM   #6
fail_distraction
LQ Newbie
 
Registered: Oct 2012
Posts: 24

Original Poster
Rep: Reputation: Disabled
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.

Last edited by fail_distraction; 03-01-2015 at 12:19 PM.
 
Old 03-01-2015, 12:30 PM   #7
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,159
Blog Entries: 1

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
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.
 
Old 03-01-2015, 12:44 PM   #8
fail_distraction
LQ Newbie
 
Registered: Oct 2012
Posts: 24

Original Poster
Rep: Reputation: Disabled
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.
 
Old 03-01-2015, 01:28 PM   #9
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,159
Blog Entries: 1

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
Quote:
Originally Posted by fail_distraction View Post
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

Last edited by bathory; 03-01-2015 at 01:34 PM.
 
Old 03-01-2015, 01:51 PM   #10
fail_distraction
LQ Newbie
 
Registered: Oct 2012
Posts: 24

Original Poster
Rep: Reputation: Disabled
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

Last edited by fail_distraction; 03-01-2015 at 01:59 PM.
 
Old 03-01-2015, 02:02 PM   #11
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,159
Blog Entries: 1

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
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
 
Old 03-01-2015, 02:13 PM   #12
fail_distraction
LQ Newbie
 
Registered: Oct 2012
Posts: 24

Original Poster
Rep: Reputation: Disabled
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?

Last edited by fail_distraction; 03-01-2015 at 02:40 PM.
 
Old 03-02-2015, 12:38 AM   #13
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,159
Blog Entries: 1

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
named.conf and /var/named/zones VolkHe Linux - Server 1 12-20-2014 12:01 PM
(bind) named: couldn't open pid file '/var/run/named/named.pid' - any help? samengr Linux - Server 6 04-01-2009 06:22 AM
service named cant start error in named.conf file gayanasa Linux - Server 2 07-02-2008 09:58 AM
BIND -named.conf ryanc75 Linux - General 3 09-19-2005 02:57 AM
cannot find named.conf and /var/named kaushikma Red Hat 1 02-07-2004 12:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration