I am using Bind on a Centos 6.5 server in order resolve subdomains to an IP.
I have *.ddns.example.com and ddns.example.com pointing to my server via A record. I have added a zone for this, see named.conf:
options {
listen-on port 53 { any; };
listen-on-v6 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; };
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
zone "." IN {
type hint;
file "named.ca";
};
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
zone "ddns.example.com" {
type master;
file "/var/named/ddns.example.com.hosts";
};
Here is my ddns.example.com.hosts file:
$ttl 38400
ddns.example.com. IN SOA ns1.digitalocean.com. jon@example.com. (
1414575123
10800
3600
604800
38400 )
ddns.example.com. IN NS ns1.digitalocean.com.
bob.ddns.example.com. IN A 8.8.8.8
I have restarted the named service and when pinging the domain bob.ddns.example.com I am getting a reply from 8.8.8.8, so the record is working as expected when pinging from the local server. However, when pinging outside of the server ie another network, the subdomain bob.ddns.example.com is still resolving to the IP of the server where bind is configured.
I have stopped my iptables completely to rule this out of the equation and the result is the same, the IP o the Bind server is resolved from the subdomain not 8.8.8.8 as expected. I have set the following options as suggested by some other posts:
listen-on port 53 { any; };
listen-on-v6 port 53 { any; };
allow-query { any; };
Are there some other options I need to set to allow the resolution from outside? or am I missing something completely?
Dig
The domain is actually a .es
domain so i will refer to it form here on in as so.
Here is an example of dig +trace bob.ddns.example.es
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.30.rc1.el6 <<>> +trace bob.ddns.example.es
;; global options: +cmd
. 518304 IN NS e.root-servers.net.
. 518304 IN NS b.root-servers.net.
. 518304 IN NS f.root-servers.net.
. 518304 IN NS i.root-servers.net.
. 518304 IN NS d.root-servers.net.
. 518304 IN NS g.root-servers.net.
. 518304 IN NS h.root-servers.net.
. 518304 IN NS m.root-servers.net.
. 518304 IN NS l.root-servers.net.
. 518304 IN NS k.root-servers.net.
. 518304 IN NS c.root-servers.net.
. 518304 IN NS j.root-servers.net.
. 518304 IN NS a.root-servers.net.
;; Received 228 bytes from 127.0.0.1#53(127.0.0.1) in 608 ms
es. 172800 IN NS ns1.cesca.es.
es. 172800 IN NS ns-ext.nic.cl.
es. 172800 IN NS ns15.communitydns.net.
es. 172800 IN NS ns3.nic.fr.
es. 172800 IN NS sns-pb.isc.org.
es. 172800 IN NS a.nic.es.
es. 172800 IN NS f.nic.es.
;; Received 461 bytes from 192.36.148.17#53(192.36.148.17) in 1540 ms
example.es. 86400 IN NS ns1.tsohost.co.uk.
example.es. 86400 IN NS ns2.tsohost.co.uk.
;; Received 84 bytes from 192.134.0.49#53(192.134.0.49) in 120 ms
bob.ddns.example.es. 1 IN A 178.62.171.XXX
;; Received 51 bytes from 95.142.155.4#53(95.142.155.4) in 20 ms
Here is the output of the command dig @127.0.0.1 bob.ddns.example.es
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.30.rc1.el6 <<>> @127.0.0.1 bob.ddns.example.es
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 11646
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;bob.ddns.example.es. IN A
;; ANSWER SECTION:
bob.ddns.example.es. 1 IN A 8.8.8.8
;; AUTHORITY SECTION:
ddns.example.es. 1 IN NS ns1.digitalocean.com.
;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Thu Oct 30 04:55:19 2014
;; MSG SIZE rcvd: 83
Here is the output of the command dig @8.8.8.8 bob.ddns.example.es
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.30.rc1.el6 <<>> @8.8.8.8 bob.ddns.example.es
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 35748
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;bob.ddns.example.es. IN A
;; ANSWER SECTION:
bob.ddns.blu.es. 0 IN A 178.62.171.XXX
;; Query time: 55 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Thu Oct 30 04:56:48 2014
;; MSG SIZE rcvd: 49
Please also note that the domain is registered with Godaddy. On Godaddy we set ns1.tsohost.co.uk as the name server. Here we serve the website (ie example.es and www.example.es) on the tsohost hosting package. On tso we created an A record for both ddns.example.es and *.ddns.example.es to go to a digital ocean server ie 178.62.171.XXX, it is on this server we wish to manipulate the IP addresses for these domains.