开发者

Can I lookup NS and A at the same time using dig

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开发者_StackOverflow中文版 a similar command that might be able to do this?

Thank you


dig +short ns google.com a google.com


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜