LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-28-2003, 07:47 PM   #1
mooreted
Member
 
Registered: May 2003
Posts: 598

Rep: Reputation: 30
DNS still slow after installing caching DNS


I have Charter Pipeline. After installing the cashing DNS applications onto my system to try to speed up DNS lookups and checking the configurations it still takes 30 seconds (that's right!) to resolve the hostname for my bank. Other pages load really quickly, but I notice a delay in DNS lookup quite often. There must be a way to speed this up.

Thanks,
Ted.
 
Old 12-28-2003, 08:14 PM   #2
meks
Member
 
Registered: Jul 2003
Location: AT, Upper Austria
Posts: 33

Rep: Reputation: 15
which nameserver(s) do you use to resolve domain names?
if you are using one of the roots and if you dont have the most recent root hint-file, get it:

ftp://ftp.rs.internic.net/domain/named.root

hmm...which dns-server are you actually running?

Last edited by meks; 12-28-2003 at 08:17 PM.
 
Old 12-28-2003, 08:29 PM   #3
mooreted
Member
 
Registered: May 2003
Posts: 598

Original Poster
Rep: Reputation: 30
The DNS package I installed was called caching-name-server. My resolv.conf is:

nameserver 66.169.254.29
nameserver 66.169.254.30
nameserver 66.189.219.30
nameserver 66.189.219.29
search rddng.ca.charter.com

I will update my named.ca file and see if that helps.

Thanks,
Ted.

Update: Updating the named.ca file did nothing. I have been working on this all week. If anyone knows what to do next, that would be nice.

Ted.

Last edited by mooreted; 12-28-2003 at 08:34 PM.
 
Old 12-28-2003, 08:40 PM   #4
meks
Member
 
Registered: Jul 2003
Location: AT, Upper Austria
Posts: 33

Rep: Reputation: 15
Quote:
Originally posted by mooreted
The DNS package I installed was called caching-name-server. My resolv.conf is:

nameserver 66.169.254.29
nameserver 66.169.254.30
nameserver 66.189.219.30
nameserver 66.189.219.29
search rddng.ca.charter.com

I will update my named.ca file and see if that helps.

Thanks,
Ted.

Update: Updating the named.ca file did nothing. I have been working on this all week. If anyone knows what to do next, that would be nice.

Ted.
ok...if you point the nameserver-entries in your resolv.conf to something other than 127.0.0.1 (or equivalent), your caching-structure is unable to do its work.

you will have to let the dns-package do all dns-resolves.

delete (or comment out) the four nameserver-lines, and simply add nameserver 127.0.0.1
since your dns-package is called "caching-name-server", i suppose that its already set up the right way.

if not...well...if not, post again


aah...look if there is a file called named.conf in /etc. maybe you could post its content the next time.

Last edited by meks; 12-28-2003 at 08:59 PM.
 
Old 12-28-2003, 09:19 PM   #5
chort
Senior Member
 
Registered: Jul 2003
Location: Silicon Valley, USA
Distribution: OpenBSD 4.6, OS X 10.6.2, CentOS 4 & 5
Posts: 3,660

Rep: Reputation: 76
Well yeah, you're not using your caching nameserver at all. Your resolv.conf still points to your ISP's nameservers. As meks pointed out, you need to use nameserver 127.0.0.1 in /etc/resolv.conf. If you want to use your ISP's servers as backups in case your own nameserver gets broken, then just place the entry for 127.0.0.1 above all the other entries (they're tried in order).

Also, if you currently have your ISP's nameservers in the "forwarders" section of /etc/named.conf, it will still be slow when doing the initial lookup for a host (because it isn't cached, so the request will be forwarded to your ISP); however after the first lookup, results will be retrieved from the local cache (until they expire and need refreshed).

That is no the default behavior, though. By default, the caching-nameserver package goes to the root servers for authority delegation.
 
Old 12-28-2003, 10:19 PM   #6
mooreted
Member
 
Registered: May 2003
Posts: 598

Original Poster
Rep: Reputation: 30
Okay, my resolv.conf file now only has 127.0.0.1 listed in it but name resolution is not any faster. Here is my named.conf file:

// generated by named-bootconf.pl


// secret must be the same as in /etc/rndc.conf
key "key" {
algorithm hmac-md5;
secret
"c3Ryb25nIGVub3VnaCBmb3IgYSBtYW4gYnV0IG1hZGUgZm9yIGEgd29tYW4K";
};

controls {
inet 127.0.0.1 allow { any; } keys { "key"; };
};


options {
pid-file "/var/run/named/named.pid";
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
//
zone "." {
type hint;
file "named.ca";
};

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

// workaround stupid stuff... (OE: Wed 17 Sep 2003)
zone "ac" { type delegation-only; };
zone "cc" { type delegation-only; };
zone "com" { type delegation-only; };
zone "cx" { type delegation-only; };
zone "museum" { type delegation-only; };
zone "net" { type delegation-only; };
zone "nu" { type delegation-only; };
zone "ph" { type delegation-only; };
zone "sh" { type delegation-only; };
zone "tm" { type delegation-only; };
zone "ws" { type delegation-only; };

Looks fine to me.

Ted.

P.S. Every time I reboot my resolv.conf changes back to its original state. My settings are getting over-written. Something is getting in the way, but I don't have enough experience to know what to look for.


Last edited by mooreted; 12-28-2003 at 10:40 PM.
 
Old 12-29-2003, 12:19 AM   #7
chort
Senior Member
 
Registered: Jul 2003
Location: Silicon Valley, USA
Distribution: OpenBSD 4.6, OS X 10.6.2, CentOS 4 & 5
Posts: 3,660

Rep: Reputation: 76
dhcp is causing it to be overwritten.

Try doing this (yes, twice)

$ dig@127.0.0.1 foo.com soa | grep time
$ dig@127.0.0.1 foo.com soa | grep time

The first time it will be just as long as normal, but the second time it should be very fast. If it's slow both times, then there is something wrong with your system (high load, network brokenness, etc).

It is possible, although not likely, that your ISP intercepts all outbound DNS requests and redirects them to their own servers. To test this you could try

$ dig @4.2.2.1 foo.com soa | grep SERVER

and see what the result is. If the SERVER is something other than 4.2.2.1, you have problems out of your control (unless you have some sort of router that is setup to forward DNS requests to your ISP, in which case you need to modify the router).
 
Old 12-29-2003, 12:46 AM   #8
meks
Member
 
Registered: Jul 2003
Location: AT, Upper Austria
Posts: 33

Rep: Reputation: 15
your configuration looks like a typical caching-ns-config.

do you actually know what a caching nameserver is?
each first lookup done for a domain will take as long as it took before you set up your dns. if you request the ip for a specific domain again, the dns will recognize that it's already cached and will not query again, but instead return the ip to the requesting client immediately.

this means, if you resolve www.google.com once, www.microsoft.com once and www.kernel.org once, your dns will have to send a query to one of the nameservers listed in your root hint-file. if the first root replies, the dns will cache it and send the resolved ip to the client. if the first root doesnt reply, the next will be tried and so on.
its most likely that, in your case, the first root replies, because you mentioned that you updated your root hint-file.

lets assume that your client gets the ip after 250ms and that your local dns cached it. try to access the same domain again - you will notice a speed improvement of about 50-100ms (depending on how long the first resolve took).

do a rndc flush and ping www.google.com afterwards. you will notice that the first icmp takes longer than the following replies.
if this happened, then your caching name server is set up properly.

how long do you have to wait for name-resolves to be completed? does it really take 30 seconds?
 
Old 12-29-2003, 10:41 AM   #9
mooreted
Member
 
Registered: May 2003
Posts: 598

Original Poster
Rep: Reputation: 30
dig reports "connection timed out. no servers could be reached." rndc reports "connection refused." I cannot ping anyone but myself.

Yes, it really does take 30 seconds to resolve hostname www.etrade.com. Other DNS resolutions take 10 seconds and others are immediate. If I load the etrade site from my browser a second time it comes up immediately, but I think that is only because it is being loaded from the hard drive. If I close my browser and reopen it, etrade once again takes 30 seconds to resolve the hostname. If I just type in the IP address for etrade it loads immediately.

I have used Shorewall to create rules for IPTABLES. I don't think Shorewall is causing problems but here are my rules:

###############################################################################
#SOURCE DEST POLICY LOG LEVEL LIMIT:BURST
fw net ACCEPT info
#loc net ACCEPT
net all DROP info
all all REJECT info
#LAST LINE -- ADD YOUR ENTRIES ABOVE THIS LINE -- DO NOT REMOVE

I will go in and accept "loc" and see if that makes a difference. If it does I'll post back. It's worth a try.

Ted.

Last edited by mooreted; 12-29-2003 at 10:52 AM.
 
Old 12-29-2003, 12:00 PM   #10
chort
Senior Member
 
Registered: Jul 2003
Location: Silicon Valley, USA
Distribution: OpenBSD 4.6, OS X 10.6.2, CentOS 4 & 5
Posts: 3,660

Rep: Reputation: 76
Quote:
dig reports "connection timed out. no servers could be reached."
Which dig though? dig @127.0.0.1, or dig @4.2.2.1, or both? If dig @127.0.0.1 times-out, then you have a serious misconfiguration, probably of your firewall. If you cannot dig @127.0.0.1, then none of your DNS lookups will be able to use your caching nameserver, so they'll just resolve everything through your ISP (assuming you have 127.0.0.1 listed at the top of resolv.conf and all the other nameservers listed below it).

Last edited by chort; 12-29-2003 at 12:01 PM.
 
Old 12-29-2003, 12:08 PM   #11
mooreted
Member
 
Registered: May 2003
Posts: 598

Original Poster
Rep: Reputation: 30
dig @127.0.0.1 times out dig @4.2.2.1 responds with a list of root servers. I will review my firewall rules again but they look right to me. I'll read the info on the Shorewall site and see if I missed anything.

Thanks,
Ted.
 
Old 12-29-2003, 12:41 PM   #12
mooreted
Member
 
Registered: May 2003
Posts: 598

Original Poster
Rep: Reputation: 30
I did a shorewall clear to disable the firewall and tried dig @127.0.0.1 and it again timed out. So it is not the firewall. I am beginning to wonder if Charter is redirecting requests or they put configuration files on my system I know nothing about. I really don't know. It should be working.

Ted.
 
Old 12-30-2003, 02:15 AM   #13
chort
Senior Member
 
Registered: Jul 2003
Location: Silicon Valley, USA
Distribution: OpenBSD 4.6, OS X 10.6.2, CentOS 4 & 5
Posts: 3,660

Rep: Reputation: 76
No, you've done something wrong. If named isn't running, you should just get a connection refused, you may not have a route to the loopback adaptor.

What's the output of the following

$ ps -ef | grep named
$ netstat -rna
 
Old 12-30-2003, 10:37 AM   #14
mooreted
Member
 
Registered: May 2003
Posts: 598

Original Poster
Rep: Reputation: 30
Hmm, well I am charting new territory for me with this project. If I get this working I will have learned a thing or two. Thanks for sticking with me.

Here is the output of $ ps -ef | grep named and $ netstat -rna:

root 3960 3920 0 08:34 pts/0 00:00:00 grep named

Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
68.118.56.0 0.0.0.0 255.255.254.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 68.118.56.1 0.0.0.0 UG 0 0 0 eth0


Ted.
 
Old 12-31-2003, 03:37 PM   #15
mooreted
Member
 
Registered: May 2003
Posts: 598

Original Poster
Rep: Reputation: 30
Well, I reinstalled my OS. Didn't set up any firewall. Upgraded to the 2.6.0 kernel then followed the directions for setting up a caching DNS server at TLDP. My config files look exactly like they do in the directions and still no caching is taking place. I will just start putting in IP addresses instead of URLs for problem websites. Either I bit off more than I can chew or it just can't be done with this system. I give.

Thanks for all the help.

Have a good day.

Ted.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
DNS caching under NetBSD e13438 *BSD 0 11-13-2005 03:22 PM
dns caching? codec Linux - Networking 7 07-04-2005 06:02 PM
DNS is not caching Mike Healan Mandriva 4 12-24-2004 08:53 PM
need help to set up caching only dns server to with bogus DNS entries ullas Linux - Networking 1 10-28-2003 01:54 PM
Setting up caching DNS tarballedtux Linux - Networking 2 03-21-2002 09:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration