本文介绍了使用一个命令获取IPv4和IPv6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否仅通过一次命令挖掘就能获得IPv4和IPv6地址,以及如何?

例如:挖主机名A-上面的命令将给出IPv4

挖掘主机名AAAA-这个命令会给我IPv6地址

我如何仅用一个命令就可以同时获得ipv4和IPv6地址?

我陷入了这个问题,如何仅通过一个命令就可以通过独裁查询获得IPv4和IPv6?

任何人都可以帮助我吗?

解决方案

如果要查询域的权威服务器,则可以通过ANY查询获取名称的所有记录:

dig hostname ANY @servername

但是,如果您正在查询缓存服务器,这将无法可靠地工作.当缓存服务器响应ANY查询时,它将返回当时恰好在缓存中的所有记录.如果名称同时具有AAAAA记录,但是服务器最近只查找了A记录,则AAAA记录将不在缓存中,因此不会返回它们./p>

此外,有人提议允许DNS服务器拒绝回答ANY查询:为具有QTYPE = ANY 的DNS查询提供最小尺寸的响应.如果您查询实现此功能的服务器,则可能无法通过单个查询获得两个响应(尽管该草案中的建议之一是ANY查询可能只返回所有MXA,和AAAA,因为这通常是客户想要的).因此,为了获得最佳可靠性,您应该只进行两个查询.

I would like to know if is possible to get IPv4 and IPv6 address with just one command dig, and how?

For example:dig hostname A- the command above will give the IPv4

dig hostname AAAA- and this command will give me the IPv6 address

How can i get both addres, Ipv4 and IPv6, with just one command?

I got stuck in this problem, how can i get IPv4 and IPv6 with a authoritarian query, but with just one command?

Anyone can help me???

解决方案

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 15:58