检查名称服务器的剩余 TTL

检查名称服务器的剩余 TTL

是否可以检查像 8.8.8.8 这样的名称服务器从我的名称服务器更新其记录之前还剩多少时间?

答案1

您可以使用dig检查记录的 TTL - 如下所示:

; <<>> DiG 9.7.3 <<>> @8.8.8.8 www.serverfault.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 3937
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.serverfault.com.       IN  A

;; ANSWER SECTION:
www.serverfault.com.    1800    IN  CNAME   serverfault.com.
serverfault.com.    1800    IN  A   64.34.119.12

;; Query time: 88 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Thu Feb 23 23:15:23 2012
;; MSG SIZE  rcvd: 67

具体来说,你需要注意答案中的值(在本例中为 1800)

;; ANSWER SECTION:
www.serverfault.com.    1800    IN  CNAME   serverfault.com.
serverfault.com.    1800    IN  A   64.34.119.12

1800 是 TTL 到期前以及名称服务器 (8.8.8.8) 上刷新记录的秒数。

如果你运行该命令几次,你会看到 TTL 数字下降,因此截至撰写本文时,TTL 现在是这样(1659 秒)

;; ANSWER SECTION:
www.serverfault.com.    1659    IN  CNAME   serverfault.com.
serverfault.com.    1659    IN  A   64.34.119.12

答案2

对于 Windows(本机),您可以使用nslookup

C:\>nslookup -debug www.serverfault.com 8.8.8.8

Got answer:
     HEADER:
         opcode = QUERY, id = 4, rcode = NOERROR
         header flags:  response, want recursion, recursion avail.
         questions = 1,  answers = 2,  authority records = 0,  additional = 0
    QUESTIONS:
        www.serverfault.com, type = A, class = IN
    ANSWERS:
    ->  www.serverfault.com
        canonical name = serverfault.com
        ttl = 1791 (29 mins 51 secs)**
    ->  serverfault.com
        internet address = 64.34.119.12
        ttl = 1791 (29 mins 51 secs)**

相关内容