开发者

Domain name existence via "dig"

Would it be possible to check a domain name its existence by checking the output of "dig"? Inside the bin开发者_Python百科d 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


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)


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.


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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜