域名通过“dig”存在
是否可以通过检查“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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
好吧,在某些情况下它可能会起作用,但在大多数情况下,您会看到不正确的结果 - 某些域已注册,但在 TLD 名称服务器中没有记录。有些域名配置了记录,但未注册,因为某些注册管理机构配置了通配符域名:
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:
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)
不,你不能。至少,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.
只需询问域的 SOA 记录即可:
while
不返回任何内容
Just ask for the SOA records of the domain :
while
returns nothing