开发者

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

开发者 https://www.devze.com 2023-01-29 22:44 出处:网络
Is it possible to lookup the A (ip address) and NS (nameservers) of a domain using a single dig command?

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

精彩评论

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