我将很快为我们的网站移动服务器。与其因为他们的 DNS 客户端缓存条目“很长时间”而让客户端长时间“停机”,我可以提示 DNS 服务器它应该“经常”检查 IP 地址。
这是生存时间(TTL)吗?最小TLL?
我发现了一篇类似的帖子,但我的用户无法发表评论。
我想知道为什么dig @8.8.8.8 domain.com在几秒钟内多次运行时会打印出不同的“倒计时”,就好像该域以不同的 TTL 缓存在 8.8.8.8 内的不同位置一样。
例如,
dione@saturno:~$ dig serverfault.com @8.8.8.8 +noall +answer
; <<>> DiG 9.9.5-3ubuntu0.1-Ubuntu <<>> serverfault.com @8.8.8.8 +noall +answer
;; global options: +cmd
serverfault.com. 39 IN A 198.252.206.140
dione@saturno:~$ dig serverfault.com @8.8.8.8 +noall +answer
; <<>> DiG 9.9.5-3ubuntu0.1-Ubuntu <<>> serverfault.com @8.8.8.8 +noall +answer
;; global options: +cmd
serverfault.com. 288 IN A 198.252.206.140
dione@saturno:~$ dig serverfault.com @8.8.8.8 +noall +answer
; <<>> DiG 9.9.5-3ubuntu0.1-Ubuntu <<>> serverfault.com @8.8.8.8 +noall +answer
;; global options: +cmd …Run Code Online (Sandbox Code Playgroud) 我已经在我的公司中配置了许多服务器来与 NSCD 一起工作以进行主机的本地缓存,以便降低到本地 DNS 服务器的流量并在可能的情况下返回更快的 DNS 响应。
我已经这样配置了nscd,并且只将它用于缓存主机:
logfile /var/log/nscd.log
debug-level 9
server-user nscd
paranoia no
enable-cache hosts yes
#positive-time-to-live hosts 3600
positive-time-to-live hosts 86400
negative-time-to-live hosts 20
suggested-size hosts 211
check-files hosts yes
persistent hosts yes
shared hosts yes
#max-db-size hosts 67108864
max-db-size hosts 536870912
Run Code Online (Sandbox Code Playgroud)
您可以看到我已将 Positive-TTL 配置为 24 小时。
我的问题是,使用的是哪个 TTL?是在此处配置的还是在 DNS 中按域配置的?
我的猜测是更短的 TTL 发生了,但我可能是错的,你能解释一下这个问题吗?
当我运行时ping google.com,我得到一个ttl值55:
64 bytes from 173.194.127.103: icmp_seq=68 ttl=55 time=16.4 ms
Run Code Online (Sandbox Code Playgroud)
当我运行时dig google.com @ns1.google.com.,它的TTL值为300。
google.com. 300 IN A 173.194.127.34
Run Code Online (Sandbox Code Playgroud)
为什么我会得到两个不同的值TTL,哪个值在什么情况下是相关的?