mr-karan / doggo

:dog: Command-line DNS Client for Humans. Written in Golang
https://doggo.mrkaran.dev/
GNU General Public License v3.0
2.83k stars 100 forks source link

Only works when I explicitly set `@8.8.8.8`? #144

Open Integralist opened 1 month ago

Integralist commented 1 month ago

👋🏻

I've just brew installed the latest release (1.0.4) and I tried the following query, which times out:

$ doggo example.com

time=2024-07-19T11:10:35.565+01:00 level=ERROR msg="Error looking up DNS records" error="context deadline exceeded"

I tried all sorts of different hostnames and they all timeout.

I then checked the debug flag...

$ doggo bbc.co.uk --debug

time=2024-07-19T11:11:51.761+01:00 level=DEBUG msg="LoadNameservers: Initial nameservers" nameservers=[]
time=2024-07-19T11:11:51.762+01:00 level=DEBUG msg="No user specified nameservers, falling back to system nameservers"
time=2024-07-19T11:11:51.762+01:00 level=DEBUG msg="Loaded system nameservers" nameservers="[{Address:8.8.8.8:53 Type:udp} {Address:8.8.4.4:53 Type:udp} {Address:[2001:4860:4860::8888]:53 Type:udp} {Address:[2001:4860:4860::8844]:53 Type:udp}]"
time=2024-07-19T11:11:51.762+01:00 level=DEBUG msg="initiating UDP resolver"
time=2024-07-19T11:11:51.762+01:00 level=DEBUG msg="initiating UDP resolver"
time=2024-07-19T11:11:51.762+01:00 level=DEBUG msg="initiating UDP resolver"
time=2024-07-19T11:11:51.762+01:00 level=DEBUG msg="initiating UDP resolver"
time=2024-07-19T11:11:51.762+01:00 level=DEBUG msg="Attempting to resolve" domain=bbc.co.uk. ndots=0 nameserver=[2001:4860:4860::8844]:53
time=2024-07-19T11:11:51.762+01:00 level=DEBUG msg="Attempting to resolve" domain=bbc.co.uk. ndots=0 nameserver=8.8.8.8:53
time=2024-07-19T11:11:51.762+01:00 level=DEBUG msg="Attempting to resolve" domain=bbc.co.uk. ndots=0 nameserver=8.8.4.4:53
time=2024-07-19T11:11:51.762+01:00 level=DEBUG msg="Attempting to resolve" domain=bbc.co.uk. ndots=0 nameserver=[2001:4860:4860::8888]:53
time=2024-07-19T11:11:56.763+01:00 level=ERROR msg="Error looking up DNS records" error="context deadline exceeded"

OK, interesting. No initial nameservers, but looks like the system nameservers should suffice, but nope, it still times out.

I then try explicitly setting @8.8.8.8 and it works...

$ doggo bbc.co.uk --debug @8.8.8.8

time=2024-07-19T11:13:11.188+01:00 level=DEBUG msg="LoadNameservers: Initial nameservers" nameservers=[8.8.8.8]
time=2024-07-19T11:13:11.188+01:00 level=DEBUG msg="Added nameserver" nameserver="{Address:8.8.8.8:53 Type:udp}"
time=2024-07-19T11:13:11.188+01:00 level=DEBUG msg="LoadNameservers: Final nameservers" nameservers="[{Address:8.8.8.8:53 Type:udp}]"
time=2024-07-19T11:13:11.188+01:00 level=DEBUG msg="initiating UDP resolver"
time=2024-07-19T11:13:11.188+01:00 level=DEBUG msg="Attempting to resolve" domain=bbc.co.uk. ndots=0 nameserver=8.8.8.8:53
NAME        TYPE    CLASS   TTL ADDRESS         NAMESERVER
bbc.co.uk.  A       IN      34s **************  8.8.8.8:53  
bbc.co.uk.  A       IN      34s ************    8.8.8.8:53  
bbc.co.uk.  A       IN      34s *************   8.8.8.8:53  
bbc.co.uk.  A       IN      34s **************  8.8.8.8:53  

What's strange is that if I don't specify 8.8.8.8 then it'll switch to system nameservers, and the first one in the list it tries is...

time=2024-07-19T11:13:24.760+01:00 level=DEBUG msg="Attempting to resolve" domain=bbc.co.uk. ndots=0 nameserver=8.8.8.8:53

...which is the same one it uses when I explicitly set 8.8.8.8 (which is when it works 🤦🏻 )

time=2024-07-19T11:13:11.188+01:00 level=DEBUG msg="Attempting to resolve" domain=bbc.co.uk. ndots=0 nameserver=8.8.8.8:53

I'm not sure what I'm doing wrong here as I have a colleague who is using the same Homebrew installed version and it works fine right out of the box 🤔

mr-karan commented 1 month ago

Can you paste the exact contents of /etc/resolv.conf please?

Integralist commented 1 month ago

👋🏻

Sure thing...

#
# macOS Notice
#
# This file is not consulted for DNS hostname resolution, address
# resolution, or the DNS query routing mechanism used by most
# processes on this system.
#
# To view the DNS configuration used by this system, use:
#   scutil --dns
#
# SEE ALSO
#   dns-sd(1), scutil(8)
#
# This file is automatically generated.
#
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 2001:4860:4860::8888
nameserver 2001:4860:4860::8844
marcaurele commented 4 weeks ago

Same problem on my side, it does not work any more without manually specifying the DNS server with a @ at the end. From the --debug there is not explicit message to understand what's the problem:

$ doggo www.github.com --debug @192.168.78.31
time=2024-08-06T15:49:37.545+02:00 level=DEBUG msg="LoadNameservers: Initial nameservers" nameservers=[192.168.78.31]
time=2024-08-06T15:49:37.545+02:00 level=DEBUG msg="Added nameserver" nameserver="{Address:192.168.78.31:53 Type:udp}"
time=2024-08-06T15:49:37.545+02:00 level=DEBUG msg="LoadNameservers: Final nameservers" nameservers="[{Address:192.168.78.31:53 Type:udp}]"
time=2024-08-06T15:49:37.545+02:00 level=DEBUG msg="initiating UDP resolver"
time=2024-08-06T15:49:37.545+02:00 level=DEBUG msg="Attempting to resolve" domain=www.github.com. ndots=0 nameserver=192.168.78.31:53
NAME            TYPE    CLASS   TTL     ADDRESS         NAMESERVER       
www.github.com. CNAME   IN      3187s   github.com.     192.168.78.31:53    
github.com.     A       IN      37s     140.82.121.4    192.168.78.31:53    

$ doggo www.github.com --debug               
time=2024-08-06T15:49:44.339+02:00 level=DEBUG msg="LoadNameservers: Initial nameservers" nameservers=[]
time=2024-08-06T15:49:44.339+02:00 level=DEBUG msg="No user specified nameservers, falling back to system nameservers"
time=2024-08-06T15:49:44.339+02:00 level=DEBUG msg="Loaded system nameservers" nameservers="[{Address:192.168.78.31:53 Type:udp} {Address:192.168.78.1:53 Type:udp} {Address:10.42.0.1:53 Type:udp}]"
time=2024-08-06T15:49:44.339+02:00 level=DEBUG msg="initiating UDP resolver"
time=2024-08-06T15:49:44.339+02:00 level=DEBUG msg="initiating UDP resolver"
time=2024-08-06T15:49:44.339+02:00 level=DEBUG msg="initiating UDP resolver"
time=2024-08-06T15:49:44.339+02:00 level=DEBUG msg="Attempting to resolve" domain=www.github.com. ndots=0 nameserver=192.168.78.31:53
time=2024-08-06T15:49:44.339+02:00 level=DEBUG msg="Attempting to resolve" domain=www.github.com. ndots=0 nameserver=10.42.0.1:53
time=2024-08-06T15:49:44.339+02:00 level=DEBUG msg="Attempting to resolve" domain=www.github.com. ndots=0 nameserver=192.168.78.1:53
time=2024-08-06T15:49:49.341+02:00 level=ERROR msg="Error looking up DNS records" error="context deadline exceeded"

The 3 servers are in my /etc/resolv.conf file.

Integralist commented 4 weeks ago

This error reminds me of https://github.com/fastly/cli/issues/289

Nu1i commented 1 week ago

I hava same problem!