0

Can you please take a look at the below config and what I am doing wrong?

Just set up Ubuntu 14.04.4 LTS with bind and when I do a dig to my server I get a status: SERVFAIL

My configuration is the below:

dig @192.168.6.1 www.example.com

; <<>> DiG 9.9.6-P2 <<>> @192.168.6.1 www.example.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 25376
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.example.com.                        IN      A

;; Query time: 5 msec
 ;; SERVER: 192.168.6.1#53(192.168.6.1)
;; WHEN: Fri Jun 10 12:13:28 UTC 2016
;; MSG SIZE  rcvd: 43

named.conf.local contains

 zone "example.com" {
         type master;
         file "/etc/bind/db.example.com";
    };

 zone "128.10.in-addr.arpa" {
   type master;
   file "/etc/bind/db.192.168";  # 192.168.0.0/16 subnet
  };

the named.conf.options

options {
      directory "/var/cache/bind";
    recursion yes;                 # enables resursive queries
    allow-recursion { any; };  # allows recursive queries from "trusted" clients
    listen-on { 192.168.6.1; };   # ns1 private IP address - listen on private
    allow-transfer { none; };
    allow-query { any; };
    forwarders {
            8.8.8.8;
            8.8.4.4;
    };
    auth-nxdomain no;    # conform to RFC1035
    listen-on-v6 { any; };
  };

the db file

;
; BIND data file for local loopback interface
;
$TTL    604800
 @       IN      SOA     ns.example.com. root.example.com. (
                          1         ; Serial
                     604800         ; Refresh
                      86400         ; Retry
                    2419200         ; Expire
                     604800 )       ; Negative Cache TTL
  ; name server NS records
    IN      NS      ns.example.com.

  ; name servers A reconds

   ns.example.com.  IN      A       192.168.6.1

  ; A records

   www     IN      A       192.168.1.21
  • 1
    What do your nameserver logs say? – Jenny D Jun 10 '16 at 13:07
  • nothing actually. I checked /var/log/syslog. The last messages for named is when I restarted bind. Jun 10 14:10:21 Server-1 named[32702]: command channel listening on 127.0.0.1#953 Jun 10 14:10:21 Server-1 named[32702]: the working directory is not writable Jun 10 14:10:21 Server-1 named[32702]: managed-keys-zone: loaded serial 0 Jun 10 14:10:21 Server-1 named[32702]: all zones loaded Jun 10 14:10:21 Server-1 named[32702]: running – Olive.b Jun 10 '16 at 13:12
  • 2
    While this could simply be a question formatting issue, your zone file appears to have unnecessary leading whitespace. Leading whitespace means "use the same name as the previous record", which would create a few syntax errors in this case. I suggest using the named-checkzone command to validate this zonefile, but I would have expected this to appear in your logs. – Andrew B Jun 10 '16 at 13:22
  • 1
    Please don't post log output in a comment - instead, click on the "edit" link and add it to the question. – Jenny D Jun 10 '16 at 13:29
  • You should increase the log level for named and re-try the query, and then add the resulting output. – Jenny D Jun 10 '16 at 13:30
-2

The mistake is find in this line: @ IN SOA ns.example.com. root.example.com. Don't use the above but rather use : @ IN SOA example.com. root.example.com.

  • That's incorrect, it should be the primary master name server so in this case it is set correctly. See en.wikipedia.org/wiki/SOA_record – bodgit Feb 19 at 10:00
  • 1
    ietf.org/rfc/rfc1035.txt also states that the first and second parameters are MNAME (The <domain-name> of the name server that was the original or primary source of data for this zone.) and RNAME (A <domain-name> which specifies the mailbox of the person responsible for this zone.). Please consider removing your answer, as it is incorrect. – asdmin Feb 19 at 10:27

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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