使用一个命令获取IPv4和IPv6 [英] Get IPv4 and IPv6 with one command
问题描述
我想知道是否仅通过一次命令挖掘就能获得IPv4和IPv6地址,以及如何?
例如: 挖主机名A -上面的命令将给出IPv4
挖掘主机名AAAA -这个命令会给我IPv6地址
我如何仅用一个命令就可以同时获得ipv4和IPv6地址?
我陷入了这个问题,如何仅通过一个命令就可以通过独裁查询获得IPv4和IPv6?
任何人都可以帮助我吗?
如果要查询域的权威服务器,则可以通过ANY
查询获取名称的所有记录:
dig hostname ANY @servername
但是,如果您正在查询缓存服务器,这将无法可靠地工作.当缓存服务器响应ANY
查询时,它将返回当时恰好在缓存中的所有记录.如果名称同时具有A
和AAAA
记录,但是服务器最近只查找了A
记录,则AAAA
记录将不在缓存中,因此不会返回它们./p>
此外,有人提议允许DNS服务器拒绝回答ANY
查询: 解决方案
If you're querying an authoritative server for the domain, you can get all the records for a name with an ANY
query:
dig hostname ANY @servername
However, this won't work reliably if you're querying a caching server. When a caching server responds to an ANY
query, it returns whatever records happen to be in cache at the time. If the name has both A
and AAAA
records, but the server has only looked up the A
records recently, the AAAA
records won't be in the cache, so it won't return them.
Furthermore, there is a proposal to allow DNS servers to refuse to answer ANY
queries: Providing Minimal-Sized Responses to DNS Queries that have QTYPE=ANY. If you query a server that implements this, you may not be able to get both responses with a single query (although one of the suggestions in that draft is that an ANY
query might just return all MX
, A
, and AAAA
, since this is often what clients want). So for best reliability, you should just make two queries.
这篇关于使用一个命令获取IPv4和IPv6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!