Solved

Setting Up BIND

Posted on 2011-03-23
12
487 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
 
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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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 …
Occasionally you run into the website or two that will not resolve properly using your own DNS servers.  Some people simply set up global forwarders for their DNS server.  I don’t recommend doing this because it can cause problems resolving addresse…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

757 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now