大网数据广告活动
服务器运维问答

Linux daemon to "persist" DNS answer during DNS fail

· 52CE 我爱测

Is there a tool for Linux that can "persist" IP address during DNS server fail? So domain can be still resolvable on this machine despite of remote DNS server temporary fail. The scenario is that I have a machine with my web appl…

问题原文

原帖链接 · krzys · CC BY-SA 3.0

Is there a tool for Linux that can "persist" IP address during DNS server fail? So domain can be still resolvable on this machine despite of remote DNS server temporary fail.

The scenario is that I have a machine with my web application deployed on it. The application has to connect to remote resource. This resource is not under my control - it is third party Web Service provided by other company, but it is under my client's domain name. Client's DNS servers fail from time to time, so my application cannot resolve domain name, but this third party WS is still available (client's DNS fail is irrelevant to it), so I could reach it by IP and do my job.

So I am looking for tool (DNS cache?) that will resolve domain names through DNS as long as DNS server is up and will return last obtained value when DNS server is down. Reducing DNS requests count is not what I am interested in this scenario, so "classic" DNS cache is not a solution here (I think).


EDIT:

Scenario with local DNS cache that will not work for me:
1. remote DNS is working well
2. local DNS cache is caching the response from remote DNS
3. before TTL of response expires, remote DNS collapses
4. until TTL of response expires, cache provides cached response; so far, so good
5. TTL of response expires, cache flushes entry and cannot obtain new response, because remote DNS is still down; this is not good

已采纳解答

原帖链接 · Andrew B · CC BY-SA 3.0

As others have suggested, the closest you're going to come is an on-server cache, either nscd or a local recursive server. That said, there are a number of problems with this approach:

  • By default, these solutions are not configured to remember names indefinitely (as you are asking), and will expire cached entries per the TTL associated with the individual DNS records. Many records have short TTLs in the neighborhood of five minutes.
  • The software may not allow you to enforce a "minimum TTL" policy that prevents the data from expiring.
  • Even if the software does allow you to enforce a minimum TTL, this introduces its own problems. Some records have short TTLs for a reason. Ignoring those short TTLs may cause unexpected issues.

Ultimately what you're asking for is for nameservers to remember the last known non-error response, which is not a feature that currently exists in the DNS space. There is currently a draft standard in the works to address this due to the increasing popularity of targeting authoritative DNS systems with DDoS attacks. We may start seeing implementations of this in the near future once it moves past the draft status.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-10-17)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。