需要一个 Linux 命令来查询域名的 DNS 查找时间,同时绕过缓存

需要一个 Linux 命令来查询域名的 DNS 查找时间,同时绕过缓存

我正在寻找一种通过 DNS 服务器查找域名并输出解析时间的工具。我的要求是它应该绕过 DNS 缓存。

有人用过这样的工具吗?

注意:“dig”没有任何绕过缓存的选项,因此在这种情况下它将毫无用处。

答案1

dig 也不使用任何缓存,而是直接查询您配置的解析器。如果该解析器缓存,您可以使用 dig 的 +trace 选项不使用解析器,而是直接从根服务器向下查询 DNS:

dennis@lightning:~$ dig +trace serverfault.com A

; <<>> DiG 9.9.3-rpz2+rl.13214.22-P2-Ubuntu-1:9.9.3.dfsg.P2-4ubuntu1 <<>> +trace serverfault.com A
;; global options: +cmd
.           397719  IN  NS  j.root-servers.net.
<cut more records>
.           518093  IN  RRSIG   NS 8 0 518400 20131210000000 20131202230000 59085 . f0hHbyv9t6RjM+S7xhK0ZfE1QXHTwyM8T8CDlwAwk+HZxTen+t84c41O kOM1n2eceUdZKaZ3e6xXbkbqskqSIMxgGLs4yo1WCqXVsxcwitvnNfIH HIvUZ+FuuPavS3YZFLDh1yFABzUgdjUUhxYj0O8vGM3tyPmqxlz/5tOM bO8=
;; Received 857 bytes from 127.0.1.1#53(127.0.1.1) in 394 ms

com.            172800  IN  NS  m.gtld-servers.net.
<cut more records>
com.            86400   IN  DS  30909 8 2 E2D3C916F6DEEAC73294E8268FB5885044A833FC5459588F4A9184CF C41A5766
com.            86400   IN  RRSIG   DS 8 1 86400 20131210000000 20131202230000 59085 . HIEdgrZDVtt+RismerX3wUwnourQWV1IOZjU9WZ0OGgyWl/SrotZkRoP DkpL4mwQ8DrcLCutcUZQ9jild82LE099JKPSGqOhP0Jo1eElIz7adI83 pVCuWSbZVAr44tbCCG/cUJ4x2/U5EGXObZtwx8xsx92Es9+BYlGxof8h Uao=
;; Received 739 bytes from 198.41.0.4#53(a.root-servers.net) in 389 ms

serverfault.com.    172800  IN  NS  ns1.serverfault.com.
serverfault.com.    172800  IN  NS  ns2.serverfault.com.
CK0POJMG874LJREF7EFN8430QVIT8BSM.com. 86400 IN NSEC3 1 1 0 - CK0Q5NFFJS5FUB0F2DNA098SBN0O663V NS SOA RRSIG DNSKEY NSEC3PARAM
CK0POJMG874LJREF7EFN8430QVIT8BSM.com. 86400 IN RRSIG NSEC3 8 2 86400 20131208054132 20131201043132 22625 com. Zz/lcv0uETfq4C+HNgnwGv4OjC47xg68ynrm+LUSqU1KG3sGHPbLGN0z 42xckt5KmK/uFnTcBATcEDkz/tCGA1ZMDPdjC5oK25T2yekkMVunZEgm uWx4cZw5oYd5DjD46WaMq6gdNUGL1kIk1/WzferodB6XN2AafrXbu3Zr NrQ=
9927MV13364KIN8K2F46QC2KIS54GB78.com. 86400 IN NSEC3 1 1 0 - 992CS48MFUM4P9CUSBGKOON6Q03NL1FA NS DS RRSIG
9927MV13364KIN8K2F46QC2KIS54GB78.com. 86400 IN RRSIG NSEC3 8 2 86400 20131210053605 20131203042605 22625 com. vdWi92PKyDk6b0U9d2Q1zpBRHZRKLS63PuYbdGD4JIRNv6MGNxRq5GUa CGp4CbfWNm03UaVbyel9zu6O6KYNeLHOpKUWNjTKnNHJuNcNBQqkj4V0 5Tpz7TNBZnQRwRixrSGnZmG33qKXjVjRXDWjj0Um5wE3x7sGJ1FoU6vy 3dE=
;; Received 597 bytes from 192.42.93.30#53(g.gtld-servers.net) in 394 ms

serverfault.com.    300 IN  A   198.252.206.16
serverfault.com.    300 IN  NS  ns2.serverfault.com.
serverfault.com.    300 IN  NS  ns1.serverfault.com.
;; Received 128 bytes from 198.252.206.80#53(ns1.serverfault.com) in 100 ms

相关内容