Solved

Setting Up BIND

Posted on 2011-03-23
12
489 Views
Last Modified: 2012-05-11
Hi,

I've got a Windows server running as a Primary DNS.

I want to set up a secondary DNS on Centos so that I can make DNS changes if the primary DNS goes down.

I've installed Bind and set up the config files following a guide but i'm getting the following when i start the NAMED service.

Error in named configuration:
zone localhost/IN: loading master file /var/named/localhost.zone: file not found
_default/localhost/IN: file not found

Im not sure what to do now. I've tried changing the directory to /var/named instead of /etc but that didnt help.

Thanks
Dan

From /var/named/localhost.zone

$TTL    86400
@               IN SOA  @       root (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum

                IN NS           @
                IN A            127.0.0.1
                IN AAAA         ::1

Open in new window

From "/var/named/chroot/etc/named.conf"

options {
        directory "/etc";
        pid-file "/var/run/named/named.pid";
        recursion no;
        };

zone "company.com" {
        type slave;
        file "company.com.zone";
        masters {
                1.2.3.4;
        };
};

zone "localhost" {
        type master;
        file "/var/named/localhost.zone";
};

Open in new window

0
Comment
Question by:DanJourno
  • 5
  • 4
  • 2
  • +1
12 Comments
 
LVL 5

Assisted Solution

by:Angelgeo
Angelgeo earned 75 total points
ID: 35197560
zone localhost/IN: loading master file /var/named/localhost.zone: file not found

file must be there
/var/named/chroot/var/named/localhost.zone
0
 
LVL 8

Assisted Solution

by:pilson66
pilson66 earned 75 total points
ID: 35197561
If you run bind in chroot environment in /var/named/chroot, you need to save files to /var/named/chroot/var/named/
0
 
LVL 4

Expert Comment

by:m_walker
ID: 35197578
If you dont need the localhost zone file you can comment that section out.

If needed create the zone file.
It may need to be in the chroot folder (or not) so try one location then the other
I would try the choot one first, then copy to the other if it still errors.

/var/named/named.localhost
/var/named/chroot/var/named/named.localhost

Zone file data for the localhost
$TTL 1D
@       IN SOA  @ rname.invalid. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        NS      @
        A       127.0.0.1
        AAAA    ::1

After you setup the zone file set the correct permissions
chmod 0640 named.localhost
chown root:namd named.localhost
then restart named/bind
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 5

Author Comment

by:DanJourno
ID: 35197581
ok, it runs successfully now.

however, it doesnt seem to be downloading the zone from the primary server. i've checked the primary server and its allowing zone transfers.

any ideas how i can diagnose this?

thanks
dan
0
 
LVL 8

Expert Comment

by:pilson66
ID: 35197599
Please show logfile, from this mashine, and if possible - from primary NS.
0
 
LVL 4

Expert Comment

by:m_walker
ID: 35197600
Ensure on your primary server that your backup is has an NS record.
If you dont want to make the slave/backup known, then you will need to set its ip address in the allowed to (zone)transfer list. (NS record hosts should be allowed by default.)
0
 
LVL 4

Expert Comment

by:m_walker
ID: 35197632
ie: in this part of the zone file settings

zone..png
0
 
LVL 5

Author Comment

by:DanJourno
ID: 35197650
Please show logfile, from this mashine, and if possible - from primary NS.

Where are the BIND logs kept in centos?

The Primary server doesnt show anything unusual in the logs.

Thanks
Dan
0
 
LVL 5

Author Comment

by:DanJourno
ID: 35197656
you will need to set its ip address in the allowed to (zone)transfer list. (NS record hosts should be allowed by default

I've got the option checked that says Allow Transfers to Any Server.

Thanks
Dan
0
 
LVL 4

Accepted Solution

by:
m_walker earned 350 total points
ID: 35197736
BIND logs should be were your named.conf file told them to be
eg:
In my home test bind setup

logging {
        channel default_debug {
                file "data/named.run";
//              severity dynamic;
                severity info;
                print-category yes;
                print-severity yes;
                print-time yes;
        };
        category default
        {
                default_debug;
        };
};

Since I used a relative path in the logging section it will be under the base/root folder from the options section
eg:
directory       "/var/named";

for the zone transfer logs try the normal messages log file and post the response.

You may need to check the permissions on the target folder in linux.

From the config file above it looks like you are using the /etc folder for your zone files.  You might want to change that to a folder just for bind.  the bind process will need write access to the folder where the slave zone file is created.

You could try this (is simple)
create a bind zone folder
mkdir /bindzones
chown root:named /bindzones
chmod 0770 /bindzones
(0660 should be enough)
then in named.conf put the full path in the file for the backup zone to
file "/bindzones/company.com.zone";


restart and check
0
 
LVL 5

Author Closing Comment

by:DanJourno
ID: 35197758
thanks.

it was a permissions issue.
0
 
LVL 4

Expert Comment

by:m_walker
ID: 35197770
Good to hear you got it working.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
BIND is the most widely used Name Server. A Name Server is the one that translates a site name to it's IP address. There is a new bug in BIND (https://kb.isc.org/article/AA-01272), affecting all versions of BIND 9 from BIND 9.1.0 (inclusive) thro…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question