• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 500
  • Last Modified:

Setting Up BIND

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
DanJourno
Asked:
DanJourno
  • 5
  • 4
  • 2
  • +1
3 Solutions
 
Kakhaber SiradzeCommented:
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
 
pilson66Commented:
If you run bind in chroot environment in /var/named/chroot, you need to save files to /var/named/chroot/var/named/
0
 
m_walkerCommented:
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
Improved Protection from Phishing Attacks

WatchGuard DNSWatch reduces malware infections by detecting and blocking malicious DNS requests, improving your ability to protect employees from phishing attacks. Learn more about our newest service included in Total Security Suite today!

 
DanJournoAuthor Commented:
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
 
pilson66Commented:
Please show logfile, from this mashine, and if possible - from primary NS.
0
 
m_walkerCommented:
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
 
m_walkerCommented:
ie: in this part of the zone file settings

zone..png
0
 
DanJournoAuthor Commented:
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
 
DanJournoAuthor Commented:
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
 
m_walkerCommented:
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
 
DanJournoAuthor Commented:
thanks.

it was a permissions issue.
0
 
m_walkerCommented:
Good to hear you got it working.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

  • 5
  • 4
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now