域名通过“dig”存在

发布于 2024-10-12 09:27:14 字数 643 浏览 6 评论 0原文

是否可以通过检查“dig”的输出来检查域名是否存在? 在绑定源中,我发现了这些常量:

0 DNS_R_NOEROR
1 DNS_R_FORMERR
2 DNS_R_SERVFAIL
3 DNS_R_NXDOMAIN
4 DNS_R_NOTIMP
5 DNS_R_REFUSED
6 DNS_R_YXDOMAIN
7 DNS_R_YXRRSET
8 DNS_R_NXRRSET
9 DNS_R_NOTAUTH
10 DNS_R_NOTZONE
16 DNS_R_BADVERS

<RCODE 11>     # 11 has no macro
<RCODE 12>     # 12 has no macro
<RCODE 13>     # 13 has no macro
<RCODE 14>     # 14 has no macro
<RCODE 15>     # 15 has no macro

在我看来,NOERROR & SERVFAIL 意味着主机名存在(尽管它并不意味着 IP 已链接到它)。 NXDOMAIN 意味着它绝对不存在。

我不喜欢使用 whois,因为它很慢。 dig 速度要快得多,因为我只需要确定主机名尚不存在。

有人可以阐明我的假设和其他宏吗?

谢谢

Would it be possible to check a domain name its existence by checking the output of "dig"?
Inside the bind sources I found these constants:

0 DNS_R_NOEROR
1 DNS_R_FORMERR
2 DNS_R_SERVFAIL
3 DNS_R_NXDOMAIN
4 DNS_R_NOTIMP
5 DNS_R_REFUSED
6 DNS_R_YXDOMAIN
7 DNS_R_YXRRSET
8 DNS_R_NXRRSET
9 DNS_R_NOTAUTH
10 DNS_R_NOTZONE
16 DNS_R_BADVERS

<RCODE 11>     # 11 has no macro
<RCODE 12>     # 12 has no macro
<RCODE 13>     # 13 has no macro
<RCODE 14>     # 14 has no macro
<RCODE 15>     # 15 has no macro

In my opinion NOERROR & SERVFAIL means the hostname exists (although it doesn't mean an ip is linked to it). NXDOMAIN would mean it absolutely not exists.

I prefer not to use whois because it is quite slow. dig is much faster as I just need to be certain that the hostname doesn't exist yet.

Could someone shine their light on my assumptions and the other macros?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

℉絮湮 2024-10-19 09:27:14

好吧,在某些情况下它可能会起作用,但在大多数情况下,您会看到不正确的结果 - 某些域已注册,但在 TLD 名称服务器中没有记录。有些域名配置了记录,但未注册,因为某些注册管理机构配置了通配符域名:

$ dig asdfasdfasdfxvyxv123.de.com A +short 
91.213.214.122

$ whois -h whois.centralnic.com asdfasdfasdfxvyxv123.de.com
DOMAIN NOT FOUND

whois 确实很慢 - 与您的域名提供商联系,大多数注册管理机构提供更快的方法来检查域名是否已注册(即 EPP 协议) )

Well, in some cases it might work, but in most cases you will see incorrect results- some domains are registered but do not have a record in the TLD name server. And some domains have a record configured but are not registered as some registries have wildcard domains configured:

$ dig asdfasdfasdfxvyxv123.de.com A +short 
91.213.214.122

$ whois -h whois.centralnic.com asdfasdfasdfxvyxv123.de.com
DOMAIN NOT FOUND

whois indeed is slow - speak to a/your domain provider, most registries offer faster methods to check if a domain is registered or not (i.e. EPP protocol)

苏大泽ㄣ 2024-10-19 09:27:14

不,你不能。至少,Dig 可以告诉您该域是否有名称服务器记录,但即使响应是否定的,也不意味着该域可用。

唯一的方法是执行 WHOIS 查询。

No, you can't. At least, Dig can tell you if the domain has a nameserver record, but even if the response is negative, it doesn't mean the domain is available.

The only way is to perform a WHOIS query.

陪我终i 2024-10-19 09:27:14

只需询问域的 SOA 记录即可:

$ dig activcloud.eu +short soa
dns112.ovh.net. tech.ovh.net. 2018091203 86400 3600 3600000 300

while

$ dig lmksjdflksd.eu +short soa

不返回任何内容

Just ask for the SOA records of the domain :

$ dig activcloud.eu +short soa
dns112.ovh.net. tech.ovh.net. 2018091203 86400 3600 3600000 300

while

$ dig lmksjdflksd.eu +short soa

returns nothing

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