-   Linux - Networking (
-   -   Local caching only DNS takes a long time to resolve (

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


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



// generated by

options {
        forwarders {
        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 allow { localhost; } keys { rndckey; };
zone "." IN {
        type hint;
        file "";

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

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

include "/etc/rndc.key";


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

If I type 'server' (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...


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 ( 56(84) bytes of data.
64 bytes from ( icmp_seq=0 ttl=118 time=25.9 ms
64 bytes from ( icmp_seq=1 ttl=118 time=24.7 ms
64 bytes from ( icmp_seq=2 ttl=118 time=24.0 ms

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


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.