Slow DNS

Xian ian at codepad.net
Thu May 12 09:53:55 PDT 2005


On Thursday 12 May 2005 12:43, you wrote:
> Xian wrote:
> >I have just set up a router and would like DNS caching on it. I have tried
> > to set it up an it kind of works, just computer using it as their
> > nameserver take ages on DNS queries, up to 4-5 seconds.
> >
> >To set up the DNS caching I added the ip of another DNS server
> >to /etc/resolv.conf and added namd_enable="YES" to /etc/rc.conf.
> >I also tweaked the following lines in /var/named/etc/namedb/named.conf:
> >listen-on       { "any"; };
> >forwarders {
> >       192.168.0.1;
> >};
> >query-source address * port 53;
> >
> >Any ideas on how to make it run better? The DNS server at 192.168.0.1
> > answers DNS queries in a few milliseconds.
>
> do this test for me. from the machine witht he dns setup on it, ping
> www.google.com, note how long it takes, then ping it again. your local
> dns shouldhave cached it after the 2nd try. the 4 - 5 seconds delay
> could be your dns contacting the root dns servers.

Ping doesn't work yet from withing this segment of the LAN (that's my next 
problem to fix).
Using dig instead (on www.freebsd.org because www.google.com was already in 
the cache):

[ian at hercules:~] %dig www.freebsd.org
<snip>
;; Query time: 4311 msec
;; SERVER: 192.168.1.1#53(192.168.1.1)
;; WHEN: Thu May 12 17:28:43 2005
;; MSG SIZE  rcvd: 211

[ian at hercules:~] %dig www.freebsd.org
<snip>
;; Query time: 7 msec
;; SERVER: 192.168.1.1#53(192.168.1.1)
;; WHEN: Thu May 12 17:28:47 2005
;; MSG SIZE  rcvd: 211

The strange thing is that I made sure that freebsd.org was in the cache of 
192.168.0.1 before I did this test, and that machine took 14ms to reply.
Why does it take so long to look stuff up when the machine at 192.168.0.1 
takes much less than this to look stuff up for the first time? Thats what is 
confusing me.
-- 
/Xian

"C lets you shoot yourself in the foot rather easily. C++ allows you to blow 
your whole leg off"
unknown author


More information about the freebsd-questions mailing list