Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using bind-9.3.6-4 in my CentOS 5. How can I allow bind to cache lookup queries so that if there are similar queries it should check from my cache instead doing a lookup from the DNS servers mentioned in the "forwarders"?

share|improve this question
What makes you think it's not cacheing now? – MadHatter Oct 13 '11 at 14:53
@MadHatter I am firing some curl request to a particular domain and often I am getting "name lookup timed out" error. When I am executing nslookup for that domain at that instant it is taking more time to resolve. If it is fetching it from cache, how do I verify? – Supratik Oct 14 '11 at 13:46
up vote 2 down vote accepted

An out of the box bind install via yum should be a caching.

There are three kinds of name servers - caching, resolving, and authoritative. Bind acts as all three out of the box, but you'll need to tell it what you want it to be authoritative for. You can use dig to query the server - the answer will have a decrementing counter in it that shows how long it will be before the cache expires. This is the TTL of the record and it should show the time left in the cache.

Here is sample output for a simple dig for google .com against a local name server.

$ dig

; <<>> DiG 9.7.3 <<>>
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 53888
;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 0

;                    IN      A

;; ANSWER SECTION:             291     IN      A             291     IN      A             291     IN      A             291     IN      A             291     IN      A

;; Query time: 32 msec
;; WHEN: Tue Nov 29 14:54:02 2011
;; MSG SIZE  rcvd: 108

The 291 shows that this server has 291 seconds left to go before it resolves again, showing that the SERVER in the bottom lines will give out the same answer until has expired from the cache.

I think a look at the dig documentation would do you well - it will allow you to ask an appropriate followup question.

share|improve this answer
Thanks for the suggestion, my confusion is cleared now. – Supratik Nov 30 '11 at 13:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.