LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Local caching only DNS takes a long time to resolve (http://www.linuxquestions.org/questions/linux-networking-3/local-caching-only-dns-takes-a-long-time-to-resolve-219904/)

essdeeay 08-19-2004 06:26 PM

Local caching only DNS takes a long time to resolve
 
Hello everybody, this is my first post here - and I'm pretty much a linux newbie.

- Fedora core 2

Background

More for proof of concept than anything else, I would like to set up DNS caching so it will serve the LAN (currently only 2 machines) in the hope that it may improve performance slightly.

DNS configuration

(/etc/resolv.conf)
Code:

nameserver 127.0.0.1
(/etc/named.conf)
Code:

// generated by named-bootconf.pl

options {
        forwarders {
                212.23.8.1;
                212.23.8.6;
        };
        directory "/var/named";
        /*
        * If there is a firewall between you and nameservers you want
        * to talk to, you might need to uncomment the query-source
        * directive below.  Previous versions of BIND always asked
        * questions using port 53, but BIND 8.1 uses an unprivileged
        * port by default.
        */
        // query-source address * port 53;
};

//
// a caching only nameserver config
//
controls {
        inet 127.0.0.1 allow { localhost; } keys { rndckey; };
};
zone "." IN {
        type hint;
        file "named.ca";
};

zone "localhost" IN {
        type master;
        file "localhost.zone";
        allow-update { none; };
};

zone "0.0.127.in-addr.arpa" IN {
        type master;
        file "named.local";
        allow-update { none; };
};

include "/etc/rndc.key";

The TEST

I run NSLOOKUP, type 'server' to verify it's checking 127.0.0.1 then type any hostname on the internet it takes at least 1.5 seconds to resolve, sometimes longer.

If I type 'server 212.23.8.1' (my ISP primary DNS, and listed as first forwarder in named.conf) then type different hostnames on the internet it responds immediately.

The Question

What havn't I done, or what have I done wrong which makes using local DNS as caching only so sloooow.

Many thanks in advance,
Steve :)

homey 08-20-2004 06:25 AM

Greetings essdeeay,

Try adding the nameservers to /etc/resolv.conf

For example...

search mydomain.com
nameserver 212.23.8.1
nameserver 212.23.8.6
nameserver 127.0.0.1

essdeeay 08-20-2004 10:07 AM

Thanks for the answer homey. I'm sure this would work, but what I'm trying to do is force the use of the local DNS server and let it forward to the ISPs servers - my thinking is, the local DNS cache will build up and it will be slightly faster resolving DNS for LAN machines.

I've played around with a few things...

If local DNS can resolve, it responds in 2ms. If local DNS can't resolve, it goes to root and takes 600ms (which is not what I want).

I would like it to go to ISP servers for a 30ms response time instead, hence the 2 forwarders specified in named.conf. However, it isn't doing this and this is the problem.

So I guess my 2 questions are:

a) What should the behaviour be?
b) How do I put it right?

Many thanks again,
Steve :)

homey 08-20-2004 10:28 AM

I guess I don't know how you should proceed then but that's how I do it and the time seems ok to me.

PING monster.com (63.121.29.1) 56(84) bytes of data.
64 bytes from www.in.monster.com (63.121.29.1): icmp_seq=0 ttl=118 time=25.9 ms
64 bytes from www.in.monster.com (63.121.29.1): icmp_seq=1 ttl=118 time=24.7 ms
64 bytes from www.in.monster.com (63.121.29.1): icmp_seq=2 ttl=118 time=24.0 ms


Edit: Actually, I only have my server listed in /etc/resolv.conf

search mydomain.com
nameserver 192.168.0.1

and the forwards are in the /etc/named.custom

chort 08-20-2004 11:41 AM

I'm wondering if the '.' zone should really be there? If you're forwarding all queries to your ISP that can't immediately be answered from your cache, then I don't see any reason why your name server would need to know how to find the root servers.


All times are GMT -5. The time now is 11:25 PM.