TimothyYe / godns

A dynamic DNS client tool that supports AliDNS, Cloudflare, Google Domains, DNSPod, HE.net & DuckDNS & DreamHost, etc, written in Go.
https://timothyye.github.io/godns/
Apache License 2.0
1.5k stars 221 forks source link

The strange NXDOMAIN info given by godns. #93

Closed hongyi-zhao closed 3 years ago

hongyi-zhao commented 3 years ago

I use godns from one of the intranet machine running Ubuntu 20.04 to update the IP address on my router to the remote DDNS server. I noticed the following info:

[GoDNS] 2021/01/27 08:37:59 GoDNS started, entering main loop...
[GoDNS] 2021/01/27 08:37:59 Creating DNS handler with provider: DNSPod
[GoDNS] 2021/01/27 08:37:59 Checking IP for domain hyddns.xyz 
[GoDNS] 2021/01/27 08:38:05 currentIP is: 106.9.179.116
[GoDNS] 2021/01/27 08:38:06 NXDOMAIN
[GoDNS] 2021/01/27 08:38:06 IP is the same as cached one. Skip update.
[GoDNS] 2021/01/27 08:38:06 Going to sleep, will start next checking in 30 seconds...

My domain is hyddns.xyz, but godns will give the info of NXDOMAIN. OTOH, I also tested with dig as shown below on my domain:

$ dig hyddns.xyz -t NS 

; <<>> DiG 9.16.1-Ubuntu <<>> hyddns.xyz -t NS
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 16567
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;hyddns.xyz.            IN  NS

;; ANSWER SECTION:
hyddns.xyz.     21589   IN  NS  donald.dnspod.net.
hyddns.xyz.     21589   IN  NS  myrtle.dnspod.net.

;; Query time: 72 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Wed Jan 27 08:45:01 CST 2021
;; MSG SIZE  rcvd: 91

So, I'm very confused why godns gives NXDOMAIN message. Any hints will be highly appreciated.

Regards, HY

TimothyYe commented 3 years ago

Thanks, would you also show me your configuration here? You can replace sensitive information like passwords & tokens with other characters.

hongyi-zhao commented 3 years ago

See the following fore detailed info:

{
  "provider": "DNSPod",
  "password": "",
  "login_token": "my-id,my-token",
  "domains": [
    {
      "domain_name": "hyddns.xyz",
      "sub_domains": [
        "www",
        "free"
      ]
    }
  ],
  "ip_url": "https://api.ipify.org",
  "ipv6_url": "https://api-ipv6.ip.sb/ip",
  "ip_type": "IPv4",
  "interval": 30,
  "resolver": "8.8.8.8",
  "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36",
  "-socks5_proxy": "127.0.0.1:18888",
  "-use_proxy": true
}

NB. I use the socks5_proxy relative setting with/without the leading - to disable/enable it conveniently considering that json in nature doesn't support comments.

TimothyYe commented 3 years ago

I checked the configuration, it's ok.

The NXDOMAIN is returned from the DNS resolver when a request to resolve a domain is sent to the DNS and cannot be resolved to an IP address. An NXDOMAIN error message means that the domain does not exist.

I think ... maybe your domain or sub-domain is newly created and it needs some time to take effect. During this period, the DNS server may return this kind of error since this domain/sub-domain is not ready yet.

hongyi-zhao commented 3 years ago

See the following search result for my domain name given by https://jp.godaddy.com:

Domain Name: HYDDNS.XYZ
Registry Domain ID: D218922378-CNIC
Registrar WHOIS Server: whois.dnspod.com
Registrar URL: http://www.dnspod.cn
Updated Date: 2021-01-24T04:06:10.0Z
Creation Date: 2021-01-24T03:51:16.0Z
Registry Expiry Date: 2022-01-24T23:59:59.0Z
Registrar: DNSPod, Inc.
Registrar IANA ID: 1697
Domain Status: serverTransferProhibited https://icann.org/epp#serverTransferProhibited
Domain Status: addPeriod https://icann.org/epp#addPeriod
Registrant Organization: zhaohongsheng
Registrant State/Province: he bei sheng
Registrant Country: CN
Registrant Email: Please query the RDDS service of the Registrar of Record identified in this output for information on how to contact the Registrant, Admin, or Tech contact of the queried domain name.
Admin Email: Please query the RDDS service of the Registrar of Record identified in this output for information on how to contact the Registrant, Admin, or Tech contact of the queried domain name.
Tech Email: Please query the RDDS service of the Registrar of Record identified in this output for information on how to contact the Registrant, Admin, or Tech contact of the queried domain name.
Name Server: DONALD.DNSPOD.NET
Name Server: MYRTLE.DNSPOD.NET
DNSSEC: unsigned
Billing Email: Please query the RDDS service of the Registrar of Record identified in this output for information on how to contact the Registrant, Admin, or Tech contact of the queried domain name.
Registrar Abuse Contact Email: abuse@dnspod.com
Registrar Abuse Contact Phone: +86.95716
URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/
>>> Last update of WHOIS database: 2021-01-28T09:52:02.0Z <<<
For more information on Whois status codes, please visit https://icann.org/epp
>>> IMPORTANT INFORMATION ABOUT THE DEPLOYMENT OF RDAP: please visit
https://www.centralnic.com/support/rdap <<<
The Whois and RDAP services are provided by CentralNic, and contain
information pertaining to Internet domain names registered by our
our customers. By using this service you are agreeing (1) not to use any
information presented here for any purpose other than determining
ownership of domain names, (2) not to store or reproduce this data in
any way, (3) not to use any high-volume, automated, electronic processes
to obtain data from this service. Abuse of this service is monitored and
actions in contravention of these terms will result in being permanently
blacklisted. All data is (c) CentralNic Ltd (https://www.centralnic.com)
Access to the Whois and RDAP services is rate limited. For more
information, visit https://registrar-console.centralnic.com/pub/whois_guidance.

And also see the result given by whois:

werner@X10DAi:~$ whois hyddns.xyz
Domain Name: HYDDNS.XYZ
Registry Domain ID: D218922378-CNIC
Registrar WHOIS Server: whois.dnspod.com
Registrar URL: http://www.dnspod.cn
Updated Date: 2021-01-24T04:06:10.0Z
Creation Date: 2021-01-24T03:51:16.0Z
Registry Expiry Date: 2022-01-24T23:59:59.0Z
Registrar: DNSPod, Inc.
Registrar IANA ID: 1697
Domain Status: serverTransferProhibited https://icann.org/epp#serverTransferProhibited
Domain Status: addPeriod https://icann.org/epp#addPeriod
Registrant Organization: zhaohongsheng
Registrant State/Province: he bei sheng
Registrant Country: CN
Registrant Email: Please query the RDDS service of the Registrar of Record identified in this output for information on how to contact the Registrant, Admin, or Tech contact of the queried domain name.
Admin Email: Please query the RDDS service of the Registrar of Record identified in this output for information on how to contact the Registrant, Admin, or Tech contact of the queried domain name.
Tech Email: Please query the RDDS service of the Registrar of Record identified in this output for information on how to contact the Registrant, Admin, or Tech contact of the queried domain name.
Name Server: DONALD.DNSPOD.NET
Name Server: MYRTLE.DNSPOD.NET
DNSSEC: unsigned
Billing Email: Please query the RDDS service of the Registrar of Record identified in this output for information on how to contact the Registrant, Admin, or Tech contact of the queried domain name.
Registrar Abuse Contact Email: abuse@dnspod.com
Registrar Abuse Contact Phone: +86.95716
URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/
>>> Last update of WHOIS database: 2021-01-28T09:55:34.0Z <<<

For more information on Whois status codes, please visit https://icann.org/epp

>>> IMPORTANT INFORMATION ABOUT THE DEPLOYMENT OF RDAP: please visit
https://www.centralnic.com/support/rdap <<<

The Whois and RDAP services are provided by CentralNic, and contain
information pertaining to Internet domain names registered by our
our customers. By using this service you are agreeing (1) not to use any
information presented here for any purpose other than determining
ownership of domain names, (2) not to store or reproduce this data in
any way, (3) not to use any high-volume, automated, electronic processes
to obtain data from this service. Abuse of this service is monitored and
actions in contravention of these terms will result in being permanently
blacklisted. All data is (c) CentralNic Ltd (https://www.centralnic.com)

Access to the Whois and RDAP services is rate limited. For more
information, visit https://registrar-console.centralnic.com/pub/whois_guidance.
TimothyYe commented 3 years ago

I mean the DNS record may just be created, then you run GoDNS, the DNS resolver cannot resolve it immediately, because it is not available yet.

hongyi-zhao commented 3 years ago

Why can I resolve the host on my domain successfully:

$ dig free.hyddns.xyz +short @8.8.8.8
106.9.177.227
TimothyYe commented 3 years ago

Does GoDNS output NXDOMAIN every time, or you just saw it once?

TimothyYe commented 3 years ago

Actually, this NXDOMAIN is displayed by this line of code: https://github.com/TimothyYe/godns/blob/master/handler/dnspod/dnspod_handler.go#L68

hongyi-zhao commented 3 years ago

Does GoDNS output NXDOMAIN every time, or you just saw it once?

Every time for the checking.

TimothyYe commented 3 years ago

How about changing "resolver": "8.8.8.8" to 114.114.114.114 ?

hongyi-zhao commented 3 years ago

It can't fix the problem:

$ git diff
diff --git a/Public/repo/github.com/TimothyYe/config.json b/Public/repo/github.com/TimothyYe/config.json
index 398a77a1..31ab8ae8 100644
--- a/Public/repo/github.com/TimothyYe/config.json
+++ b/Public/repo/github.com/TimothyYe/config.json
@@ -15,7 +15,7 @@
   "ipv6_url": "https://api-ipv6.ip.sb/ip",
   "ip_type": "IPv4",
   "interval": 30,
-  "resolver": "8.8.8.8",
+  "resolver": "114.114.114.114",
   "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36",
   "-socks5_proxy": "127.0.0.1:18888",
   "-use_proxy": true

$ bash godns.git.bash 
[GoDNS] 2021/01/28 21:23:14 GoDNS started, entering main loop...
[GoDNS] 2021/01/28 21:23:14 Creating DNS handler with provider: DNSPod
[GoDNS] 2021/01/28 21:23:14 Checking IP for domain hyddns.xyz 
[GoDNS] 2021/01/28 21:23:24 currentIP is: 106.9.177.227
[GoDNS] 2021/01/28 21:23:26 NXDOMAIN
[GoDNS] 2021/01/28 21:23:26 IP is the same as cached one. Skip update.
[GoDNS] 2021/01/28 21:23:26 Going to sleep, will start next checking in 30 seconds...
[GoDNS] 2021/01/28 21:23:56 Checking IP for domain hyddns.xyz 
[GoDNS] 2021/01/28 21:23:57 currentIP is: 106.9.177.227
[GoDNS] 2021/01/28 21:23:57 NXDOMAIN
[GoDNS] 2021/01/28 21:23:57 IP is the same as cached one. Skip update.
[GoDNS] 2021/01/28 21:23:57 Going to sleep, will start next checking in 30 seconds...
^C
TimothyYe commented 3 years ago

Looks weird, I use my own domain to test, but cannot reproduce this issue:

image

hongyi-zhao commented 3 years ago

Which tool do you use to manage the terminal session as shown above?

TimothyYe commented 3 years ago

Tmux

hongyi-zhao commented 3 years ago

Thanks. I've heard about Tmux for a long time, but never tried till now.