LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-11-2013, 06:12 PM   #1
kikookik
LQ Newbie
 
Registered: Aug 2012
Posts: 8

Rep: Reputation: Disabled
How to optimize dns requests


Hi;

I want to optimize the call to remote dns server to resolve domain names each time needed. What i want to do is that if the hostname is requested for the first time than call the remote dns (for example 8.8.8.8) to resolve it, once called then recorded for later use in such way when next time the seem domain name is requested for resolve than the cached ip is grabbed without need to call remote dns to maximize speed to optimize network traffic.

Do someone can help me to achieve this goal ?

OS : ubuntu

Regards
 
Old 03-11-2013, 06:24 PM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
https://help.ubuntu.com/10.04/server...iguration.html
 
1 members found this post helpful.
Old 03-11-2013, 06:36 PM   #3
kikookik
LQ Newbie
 
Registered: Aug 2012
Posts: 8

Original Poster
Rep: Reputation: Disabled
Thank you
 
Old 03-12-2013, 06:38 AM   #4
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
You're very welcome.

https://help.ubuntu.com/community/BIND9ServerHowto
performance - Best way to set up DNS caching? - Ask Ubuntu
 
1 members found this post helpful.
Old 03-12-2013, 04:03 PM   #5
kikookik
LQ Newbie
 
Registered: Aug 2012
Posts: 8

Original Poster
Rep: Reputation: Disabled
Hi again, i managed to get bind9 working. But it doesn't seem to use the cache, a reply from two succesfull dig mail.com give :

Code:
; <<>> DiG 9.8.1-P1 <<>> mail.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37152
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;mail.com.                      IN      A

;; ANSWER SECTION:
mail.com.               17208   IN      A       213.165.66.221

;; Query time: 233 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Mar 12 20:47:33 2013
;; MSG SIZE  rcvd: 42
Code:
; <<>> DiG 9.8.1-P1 <<>> mail.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6133
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;mail.com.                      IN      A

;; ANSWER SECTION:
mail.com.               16432   IN      A       213.165.66.221

;; Query time: 90 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Tue Mar 12 21:00:29 2013
;; MSG SIZE  rcvd: 42
~80 msec is so long if it uses cache because if it does then it should be no delay 0 msec. Here is my configuration file content :

File : /etc/bind/named.conf.options

Code:
options {
        directory "/var/cache/bind";

        // If there is a firewall between you and nameservers you want
        // to talk to, you may need to fix the firewall to allow multiple
        // ports to talk.  See http://www.kb.cert.org/vuls/id/800113

        // If your ISP provided one or more IP addresses for stable
        // nameservers, you probably want to use them as forwarders.
        // Uncomment the following block, and insert the addresses replacing
        // the all-0's placeholder.
        // forward only ;
        forwarders {
                208.67.220.220;
                208.67.222.222;
                8.8.8.8;
        };
        allow-query { clients ; } ;
        // max-cache-size is in bytes : echo '2 * 1024^2' | bc
        max-cache-size 2097152 ;
        empty-zones-enable yes;

        //========================================================================
        // If BIND logs error messages about the root key being expired,
        // you will need to update your keys.  See https://www.isc.org/bind-keys
        //========================================================================
        dnssec-validation auto;

        auth-nxdomain no;    # conform to RFC1035
        listen-on-v6 { any; };
};
Thank you
 
Old 03-14-2013, 06:05 AM   #6
kikookik
LQ Newbie
 
Registered: Aug 2012
Posts: 8

Original Poster
Rep: Reputation: Disabled
any idea ?
 
Old 03-14-2013, 06:43 AM   #7
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,070

Rep: Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897
Quote:
Originally Posted by kikookik View Post

~80 msec is so long if it uses cache because if it does then it should be no delay 0 msec.
Well, that's an unreasonable expectation. If the computer has to do something, it will take a finite amount of time to do it. 0 ms is not an amount of time in which the computer can search its database for a matching entry, unless you have a computer which is infinitely fast, and you don't.

Now 80 ms is longer than a resolve should take if it does come from cache, but that could come about because the computer is slow, overloaded or whatever, but it is faster than your non-cached hit took. Maybe that's just down to cache not being used, maybe its down to the computer being slow (eg, your caching program or its data being swapped out at the time that you make your query), it really isn't apparent fom the evidence that you have presented, so far.

Quote:
Here is my configuration file content...


208.67.220.220;
208.67.222.222;
8.8.8.8;
I'm assuming that the 208.67.y.z entries are things that you have added, and that they are probably your ISP's DNS servers? Be aware, if this is the case, that many ISP's servers are indifferent in performance, at best. You might be better with Google's server at the top of the list, although that might not be the absolute fastest, either, so if you are really keen to achieve the best results, you may still have work to do here.
 
  


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
Help in stopping DNS requests (DNS Amplification) accessthecloud Linux - Server 2 02-18-2013 03:43 PM
forward DNS requests Gil@LQ Linux - Networking 3 09-02-2012 07:51 AM
can a local DNS Server be used to handle dns requests going out to the internet baronobeefdip Linux - Server 1 07-03-2012 03:19 AM
DNS requests go to loopback?? curiouspenguin Linux - Networking 5 09-20-2006 03:42 PM
foward dns requests ? black1 Linux - Networking 1 03-06-2006 03:52 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:30 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