Bind not forwarding on CentOS 6

8,196

I would suggest to add, beside localhost, the IP address of the machine itself:

allow-recursion {127.0.0.1; 192.168.1.1;}

Of course, you need to replace 192.168.1.1 with the real IP address you are using.

Share:
8,196

Related videos on Youtube

Jonathan
Author by

Jonathan

I'm a programmer living and working in Glasgow, Scotland. Day-to-day, I work with Java, SQL, some JEE technologies, like JPA, and Javascript. I'm passionate about performance, and really interested in highly-scalable web applications. I enjoy working with legacy code (Crazy, I know!) because of its trove of interesting challenges.

Updated on September 18, 2022

Comments

  • Jonathan
    Jonathan over 1 year

    I have bind configured (sort of) on CentOS 6 as a forward-only DNS server, like so:

    options {
        listen-on port 53 { 127.0.0.1; };
        directory "/var/named";
        recursion yes;
        allow-recursion { localhost; };
        forward only;
        forwarders { 8.8.8.8; 8.8.4.4; };
    };
    
    include "/etc/named.rfc1912.zones";
    

    The problem is, that it seems it's not doing any forwarding:

    $ dig www.google.com
    
    ; <<>> DiG 9.7.3-P3-RedHat-9.7.3-8.P3.el6_2.2 <<>> www.google.com
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 1037
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
    
    ;; QUESTION SECTION:
    ;www.google.com.                    IN      A
    
    ;; Query time: 555 msec
    ;; SERVER: 127.0.0.1#53(127.0.0.1)
    ;; WHEN: Fri Jan 27 13:30:52 2012
    ;; MSG SIZE  rcvd: 32
    

    I do not have bind-chroot installed on this server. I can confirm that my resolv.conf file is configured to use 127.0.0.1 for DNS lookups. If I do dig @8.8.8.8 www.google.com then I get a correct response.

    If I remove the forwarding statements and add the hint zone for the root servers, then it does correctly resolve names, but of course I don't want to be hitting the root servers for every lookup. Any suggestions?

    • James O'Gorman
      James O'Gorman over 12 years
      Try running dig +trace to confirm named is working correctly.