我可以使用 dig 同时查找 NS 和 A
是否可以使用单个 dig 命令查找域的 A(IP 地址)和 NS(名称服务器)?
我可以使用 dig google.com A +short 或 dig google.com NS +short 但肯定可以只用一个命令来完成它吗?如果没有,是否有类似的命令可以做到这一点?
谢谢
Is it possible to lookup the A (ip address) and NS (nameservers) of a domain using a single dig command?
I can use dig google.com A +short or dig google.com NS +short but surely it's possible to do it with just one command? If not, is there a similar command that might be able to do this?
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不,它不能可靠地完成,至少不能在单个 DNS 查询中完成。 Martin 的答案满足“单个命令”标准,但会导致对 DNS 服务器的两次查询。
有
ANY
选项(而不是NS
或A
),但这不是获取两条记录的可靠方法。如果你问Google的权威服务器你确实应该得到所有的东西,但我怀疑你不会提前知道他们的服务器是什么,否则你不会问这个问题。
如果您询问本地递归服务器,那么您可能取回这两条记录,但前提是它们都在缓存中。递归服务器不需要获取每条记录并为
ANY
查询返回它们,它们可以只发送回它们已经拥有的内容。No, it can't be done reliably, at least not in a single DNS query. Martin's answer satisfies the "single command" criterion, but would result in two queries to the DNS server.
There is the
ANY
option (instead ofNS
orA
) but it's not a reliable way to get both records.If you ask Google's authoritative server you should indeed get everything back, but I suspect you won't know what their server is in advance, otherwise you wouldn't ask this question.
If you ask your local recursive server then you might get back both records, but only if they're both in the cache. Recursive servers aren't required to obtain every record and return them for an
ANY
query, they're allowed to send back just what they already have.