2

I want to configure BIND as DNS forwarder and utilize caching too.

How can I configure it to serve cached results (even if beyond TTL) if forwarder fails?

This questions was already asked here but there was no answer posted - How to make BIND return old cached enties if all forwarders are failed?

Reason I need to do this, I have very bad ISP (and don't have better alternative available in my area). Often, all DNS lookup requests fails, I tried many free dns providers, they all fail during that period. Internet connectivity is not down, only DNS queries fails.

That's the reason behind my requirement, so when that happens, I can still continue doing my work, with cached DNS results (obviously which already exists in cache).

3

Using expired data is a really strong "must not" in the standards, so it would surprise me greatly if it's possible to get BIND to do that at all. You may want to look into alternative resolvers more closely aimed at personal use, or (since it sounds like your ISP intermittently blocks traffic to port 53) try getting a VPN tunnel and have your BIND use that.

0

Calle is correct, you aren't going to get BIND to violate TTL (aside from lowering the maximum, which doesn't help here). That said, if your ISP is so bad that you can't reliably hit the forwarders, I'm not really sure what the value in using forwarders is supposed to be.

Many domains offer more authoritative nameservers than the number of forwarders that typically end up being configured (2). This in turn means more more opportunities for the query to get a response in a scenario where you're seeing packet loss. It seems to me that you get more mileage out of doing the recursion yourself than using a forwarder config.

You might also want to try a newer version of BIND that supports the prefetch feature. Combined with doing your own recursion, the server will automatically try to perform a refresh against all nameservers for the record immediately prior to the record expiring from cache. This only happens if a query arrives shortly before the record is due to expire, but it may still be of help here.

prefetch

When a query is received for cached data which is to expire shortly, named can refresh the data from the authoritative server immediately, ensuring that the cache always has an answer available.

The prefetch specifies the "trigger" TTL value at which prefetch of the current query will take place: when a cache record with a lower TTL value is encountered during query processing, it will be refreshed. Valid trigger TTL values are 1 to 10 seconds. Values larger than 10 seconds will be silently reduced to 10. Setting a trigger TTL to zero (0) causes prefetch to be disabled. The default trigger TTL is 2.

An optional second argument specifies the "eligibility" TTL: the smallest original TTL value that will be accepted for a record to be eligible for prefetching. The eligibility TTL must be at least six seconds longer than the trigger TTL; if it isn't, named will silently adjust it upward. The default eligibility TTL is 9.

ftp://ftp.isc.org/isc/bind9/cur/9.10/doc/arm/Bv9ARM.ch06.html

0

BIND is DNS server, it follows standards and obeys TTL rules. What you need is caching proxy with DNS cache support. For instance, Squid with positive_dns_ttl set to some large value could work out, or any other proxy that you prefer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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