Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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; };
};
~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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.