Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am trying to set up a DNS server on Amazon Linux using BIND9. It has to act as a master nameserver for a lot of domains.

I am going desperate...

I have imported all of the DNS zone files using NamedManager (a web interface that creates bind configration files).

My /etc/named.conf is as follows:

options {
    listen-on port 53 { any; };
    directory   "/var/named";
    dump-file   "/var/named/data/cache_dump.db";
    statistics-file "/var/named/data/named_stats.txt";
    memstatistics-file "/var/named/data/named_mem_stats.txt";
    allow-query     { any; };
    allow-recursion {; };

include "/etc/named.namedmanager.conf";

zone "." IN {
        type hint;
        file "named.ca";

My /etc/named.namedmanager.conf (the auto-generated files) is as follows:

zone "mydomain.com.dns" IN {
        type master;
        file "mydomain.com.dns.zone";
        allow-update { none; };
zone "myotherdomain.com.dns" IN {
        type master;
        file "myotherdomain.com.dns.zone";
        allow-update { none; };
// ... more zones

My /var/named/mydomain.com.zone

$ORIGIN mydomain.com.
$TTL 120
@               IN SOA ns.THISNAMESERVER.com. mymail@mymaindomain.com. (
                        2013111005 ; serial
                        21600 ; refresh
                        3600 ; retry
                        604800 ; expiry
                        120 ; minimum ttl

; Nameservers
mydomain.com.   86400 IN NS ns.THISNAMESERVER.com.

But when I try to resolve mydomain.com using this DNS server from home I get the following:

[me@myhomepc ~]$ host mydomain.com. ns.MYNAMESERVER.com
Using domain server:
Address: <my-nameserver-ip>#53

Host mydomain.com not found: 5(REFUSED)

I tried disabling recursion for (recursion no; in options{}), as I need to be my nameserver to be serving results. In that case I don't get REFUSED but I don't get any answer!

Please help me :(

share|improve this question
If you use nc does it form a tcp connection on port 53? –  Joel Davis Nov 16 '13 at 23:44
[me@mypc ~]$ nc ns.mynameserver.com 53 gives no output. How do I know? –  Qualcuno Qui Nov 16 '13 at 23:50
try nc -vz ns.mynameserver.com 53 if it's the old version nc -v ns.mynameserver.com 53 if it's the newer one –  Joel Davis Nov 16 '13 at 23:51
Usually no output means it didn't connect, though. –  Joel Davis Nov 16 '13 at 23:52
I thought that 5(REFUSED) meant that the server accepted our connection but is refusing to reply to us? stackoverflow.com/a/1697403/33204 –  slm Nov 17 '13 at 3:31
show 2 more comments

1 Answer

The config files look OK except that in the file /var/named/mydomain.com.zone you need to put an A record for mydomain.com, something like this:

mydomain.com. IN A x.y.z.t

Add this line in /var/named/mydomain.com.zone, don't forget to update the serial at the beginning of the file and then restart or reload the named service.

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.