5

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 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 { 127.0.0.1; };
};

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. [email protected]. (
                        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:
Name: ns.MYNAMESERVER.com
Address: <my-nameserver-ip>#53
Aliases: 

Host mydomain.com not found: 5(REFUSED)

I tried disabling recursion for 127.0.0.1 (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!

7
  • If you use nc does it form a tcp connection on port 53?
    – Bratchley
    Commented Nov 16, 2013 at 23:44
  • [me@mypc ~]$ nc ns.mynameserver.com 53 gives no output. How do I know? Commented Nov 16, 2013 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
    – Bratchley
    Commented Nov 16, 2013 at 23:51
  • Usually no output means it didn't connect, though.
    – Bratchley
    Commented Nov 16, 2013 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
    Commented Nov 17, 2013 at 3:31

2 Answers 2

1

The name you are looking up is not part of any zone that you have.

The zone that you have configured is named mydomain.com.dns but you are trying to look up the name mydomain.com.

In addition to this it looks like there is out of zone data inside the mydomain.com.dns zone, but I can only assume that the problem here is actually the zone name.

For any additional errors you may want to look at your logs and/or named-checkconf -zj output.

1
  • (Yes, I know this is and old question but it had been autobumped and the answer hadn't been posted, maybe it can help someone else.) Commented Jun 24, 2014 at 6:29
0

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:

Add this line in /var/named/mydomain.com.zone:

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

and don't forget to update the serial at the beginning of the file and then restart or reload the named service.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .