DnsClient-PS icon indicating copy to clipboard operation
DnsClient-PS copied to clipboard

resolve-dns throw a powershell error with non existent domain

Open wyldspyder opened this issue 2 years ago • 3 comments

As the tile said, the module throw a powershell error and not a "inexistent domain" with an inexistent domain.

Ex:

⮞  resolve-dns xttox.com`
MethodInvocationException: C:\Users\exp1x835\OneDrive - Beneva\Documents\PowerShell\Modules\DnsClient-PS\1.1.1\Public\Resolve-Dns.ps1:78`

Line |
  78 |                  $client.QueryServer($nsList, $qst)
     |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Exception calling "QueryServer" with "2" argument(s): "Query 42931 => xttox.com IN A on
     | 96.45.46.46:53 timed out or is a transient error."

wyldspyder avatar Jun 09 '23 18:06 wyldspyder

Hey @wyldspyder, thanks for reaching out. I can't seem to reproduce this on my machine. I get a normal NXDOMAIN response when looking up that record, not an exception even if I query the same 96.45.46.46 nameserver your client seems to be.

> resolve-dns xttox.com -NameServer 96.45.46.46

NameServer   : 96.45.46.46:53
Additionals  : {}
AllRecords   : {a.gtld-servers.net.}
AuditTrail   :
Answers      : {}
Authorities  : {a.gtld-servers.net.}
ErrorMessage : Non-Existent Domain
HasError     : True
Header       : ;; ->>HEADER<<- opcode: Query, status: Non-Existent Domain, id: 4778
               ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
Questions    : {xttox.com. IN A}
MessageSize  : 100
Settings     : DnsClient.LookupClientSettings

I get essentially the same result from dig.

>dig xttox.com @96.45.46.46

; <<>> DiG 9.17.15 <<>> xttox.com @96.45.46.46
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 42626
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;xttox.com.                     IN      A

;; AUTHORITY SECTION:
com.                    900     IN      SOA     a.gtld-servers.net. nstld.verisign-grs.com. 1686337593 1800 900 604800 86400

;; Query time: 39 msec
;; SERVER: 96.45.46.46#53(96.45.46.46) (UDP)
;; WHEN: Fri Jun 09 12:06:49 Pacific Daylight Time 2023
;; MSG SIZE  rcvd: 100

rmbolger avatar Jun 09 '23 19:06 rmbolger

Hi @rmbolger ! thanks for the fast answer !!

I think I might have an idea but i'm not an expert ont this. As your test, i've tested it on my personal computer and work exactly the same as you. The problem arose when I use it with my work computer, and I know that we can only issue DNS request to specific server only, as any DNS request will be blocked by the firewall, can it be ??

wyldspyder avatar Jun 09 '23 20:06 wyldspyder

That could definitely be it. The error message you got was specifically a "connection timed out" error which means either your machine was being blocked from reaching the designated nameserver or the nameserver itself was offline or not responding.

rmbolger avatar Jun 09 '23 21:06 rmbolger