我可以使用 dig 同时查找 NS 和 A

发布于 2024-10-07 15:50:30 字数 162 浏览 0 评论 0原文

是否可以使用单个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

作死小能手 2024-10-14 15:50:30
dig +short ns google.com a google.com
dig +short ns google.com a google.com
时光磨忆 2024-10-14 15:50:30

不,它不能可靠地完成,至少不能在单个 DNS 查询中完成。 Martin 的答案满足“单个命令”标准,但会导致对 DNS 服务器的两次查询。

ANY 选项(而不是 NSA),但这不是获取两条记录的可靠方法。

如果你问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 of NS or A) 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文