Solved [Solved] BIND DNS Server problem

Hello,

I have been added this lines to /etc/named/named.conf:

Code:
zone "minootux.org" IN {
        type master;
        file "/etc/named/master/minootux.org.zone";
        allow-transfer { 127.0.0.1 ; 192.168.1.3 ; };
        allow-query     { 127.0.0.1 ; 192.168.1.0/24; };

};

This is /etc/named/master/minootux.org.zone:

Code:
$TTL 3600
$ORIGIN example.org.

example.org.   IN      SOA     FreeBSD.example.org.     info.example.org. (
                                                        2012081405
                                                        1d
                                                        2h
                                                        4w
                                                        1h
                                                                )

                        IN      NS      FreeBSD
example.org.            IN      A       192.168.1.4
FreeBSD                 IN      A       192.168.1.4

And finaly this is my /etc/resolv.conf:

Code:
nameserver 127.0.0.1
nameserver 8.8.8.8

The problem is when I run ping example.org this error message shown:

Code:
ping: cannot resolve example.org: Unknown host

Althogh named is running.

I'm new to FreeBSD, BIND and english language, so please answer me in simple english.
Thanks a lot.
 
You are defining a zone "minootux.org" but have a zone file with "example.org". That's not going to work.
 
Sorry for that. The original domain is minootux.org but I replaced it with example.org via my hand to post it here. Please consider it minootux.org at all :)
 
This is the output of that command:

Code:
FreeBSD# dig @127.0.0.1 minootux.org

; <<>> DiG 9.9.1-P2 <<>> @127.0.0.1 minootux.org
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 25039
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;minootux.org.                  IN      A

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Sep 14 11:49:13 2012
;; MSG SIZE  rcvd: 41
 
Oh, I think this:
Code:
example.org.            IN      A       192.168.1.4
Should be changed to this:
Code:
                        IN      A       192.168.1.4

Don't forget to update the serial number if you make changes!
 
Thanks, I tried that and then reload named configuration but nothing changed yet. (I updated serial number too)
 
First of all:
if you remove tje $ORIGIN line entrirely and keep your configuration as it is in your post, does it work?

Secondly:
set
Code:
allow-query {any;};
for a start and maybe try this on your main named.conf as well. We haven't seen your main configuration of named.conf, which might be the reason for your problems.

Third:
what do the logs say about this? Is everything loaded normally?

Fourth:
use named-checkconf(8) and named-checkzone(8) to see if your syntax is correct.

Code:
#named-checkconf
#named-checkzone example.com /file/to/exaple.com.db

If the above are fine and you can't understand what's happening, run:

# named -g

to start named in the foreground and sending all its error messages to stderr.

Generally: Disable your firewall for the testing period. Try to use the default configuration that came with your installation and just add the zone you wish, keeping it as simple as possible. Load your configuration, and validate that everything works fine by reading your logs. Then ask your server a DNS query and it must repond. If this works, narrow down the configuration, step-by-step, to meet your needs, validating its usability after each step. If all works well, re-enable your firewall and see if everything still works as expected (trying to connect from external hosts as well that are allowed to query your DNS server).

Good luck.
 
Removing 'minootux.org.' from the A record will make no difference. An entry with no value in the resource column (first column) will just take the value above. The entry above (NS) also has a blank resource column so will also take the value from above, which is 'minootux.org.' from the SOA line. You also don't strictly need the '$ORIGIN' line as $ORIGIN is set to the zone name by default, or 'IN' after the zone name in named.conf but these shouldn't be doing any harm.

I assume this is a completely standard setup and that you are starting it the FreeBSD way -

Code:
# service named start [on recent FreeBSD or]
# /etc/rc.d/named start

The path is normally /etc/namedb, not /etc/named. Although in actual fact that's just a symlink to /var/named/etc/namedb, with /var/named being the jailed root named uses by default. The FreeBSD rc scripts set up the relevant environment and pass the correct paths to named which is why I ask that you're starting it through FreeBSD and not just running named manually (Although starting manually should still work).

I would double check the output in /var/log/messages when starting the server to see if it's rejecting your zone file for some reason. Can't see any problems but it's very easy to make a mistake. There could also be an error in named.conf. Either way named should print errors to messages if it has a problem.

Also you can run the following to dump the zones config to file and see if it's actually loading your zone records:

Code:
# rndc dumpdb -zones
# cat /var/named/var/dump/named_dump.db

As suggested by SirDice, use dig to test the server first, then if that works ping to check the server is using your DNS server correctly. It's just good practice to test things a step at a time rather than jumping to the end and having multiple things that could be the issue.
 
Thanks for replies. I checked /var/log/messages and found the problem:

Code:
Sep 14 15:40:08 FreeBSD named[2223]: zone minootux.org/IN: loading 
from master file /etc/named/master/minootux.org.zone failed: file not found
Sep 14 15:40:08 FreeBSD named[2223]: zone minootux.org/IN: not loaded due to errors.

I solve that and now it's work but this is very bad mistake. My apologize for wasting your time :r
 
Back
Top