AdguardTeam / AdGuardHome

Network-wide ads & trackers blocking DNS server
https://adguard.com/adguard-home/overview.html
GNU General Public License v3.0
25.54k stars 1.83k forks source link

DoH upstream servers aren't resolved if there's no internet connection at startup #6321

Closed rafaeldamasceno closed 9 months ago

rafaeldamasceno commented 1 year ago

Prerequisites

Platform (OS and CPU architecture)

Linux, AMD64 (aka x86_64)

Installation

Docker

Setup

On one machine

AdGuard Home version

v0.107.39

Action

After having the container started with no internet connection and acquiring it later on, DNS queries yield no result when upstream servers are DoH. Trying to get queries in any way didn't work. I tried both in browser as well as using dig locally. The AGH web interface worked just fine.

Expected result

After reacquiring a connection, DoH upstream servers are resolved and DNS queries were correctly answered to.

Actual result

DoH upstream servers keep not being resolved after reacquiring internet connection and DNS queries returned no result.

Additional information and/or screenshots

Restarting the container makes AGH work again. I have a simple compose file with the web interface and DNS ports open. The upstream servers are Cloudfare and Google's DoH servers and the bootstrap are both their primary DNS servers. If I set the upstream servers to the DNS servers, then everything works as soon as the connection is back. There should be a mechanism to check this and try to resolve DoH servers again when possible.

This is the log after one of the restarts. I don't have debug mode on, but I can try if really needed. I trimmed around 10k entries that were more of the same.

{"log":"2023/10/17 10:38:18.380212 [info] AdGuard Home, version v0.107.39\n","stream":"stderr","time":"2023-10-17T10:38:18.388176005Z"}
{"log":"2023/10/17 10:38:18.381486 [info] tls: using default ciphers\n","stream":"stderr","time":"2023-10-17T10:38:18.392477001Z"}
{"log":"2023/10/17 10:38:18.386007 [info] safesearch default: disabled\n","stream":"stderr","time":"2023-10-17T10:38:18.392493822Z"}
{"log":"2023/10/17 10:38:18.392076 [info] Initializing auth module: /opt/adguardhome/work/data/sessions.db\n","stream":"stderr","time":"2023-10-17T10:38:18.392501564Z"}
{"log":"2023/10/17 10:38:18.392492 [info] auth: initialized.  users:1  sessions:1\n","stream":"stderr","time":"2023-10-17T10:38:18.392655357Z"}
{"log":"2023/10/17 10:38:18.392506 [info] AdGuard Home updates are disabled\n","stream":"stderr","time":"2023-10-17T10:38:18.392670247Z"}
{"log":"2023/10/17 10:38:18.392509 [info] web: initializing\n","stream":"stderr","time":"2023-10-17T10:38:18.39267531Z"}
{"log":"2023/10/17 10:38:19.371032 [info] dnsproxy: cache: enabled, size 4096 b\n","stream":"stderr","time":"2023-10-17T10:38:19.371146421Z"}
{"log":"2023/10/17 10:38:19.371052 [info] dnsproxy: max goroutines is set to 300\n","stream":"stderr","time":"2023-10-17T10:38:19.371177491Z"}
{"log":"2023/10/17 10:38:19.371357 [info] AdGuard Home is available at the following addresses:\n","stream":"stderr","time":"2023-10-17T10:38:19.371412857Z"}
{"log":"2023/10/17 10:38:19.371459 [info] go to http://127.0.0.1:80\n","stream":"stderr","time":"2023-10-17T10:38:19.372052646Z"}
{"log":"2023/10/17 10:38:19.371466 [info] go to http://172.18.0.2:80\n","stream":"stderr","time":"2023-10-17T10:38:19.372068756Z"}
{"log":"2023/10/17 10:38:19.371501 [info] clients: processing addresses\n","stream":"stderr","time":"2023-10-17T10:38:19.372073152Z"}
{"log":"2023/10/17 10:38:20.635389 [info] dnsproxy: starting dns proxy server\n","stream":"stderr","time":"2023-10-17T10:38:20.635489796Z"}
{"log":"2023/10/17 10:38:20.635636 [info] Ratelimit is enabled and set to 20 rps\n","stream":"stderr","time":"2023-10-17T10:38:20.635683047Z"}
{"log":"2023/10/17 10:38:20.635727 [info] The server is configured to refuse ANY requests\n","stream":"stderr","time":"2023-10-17T10:38:20.635768013Z"}
{"log":"2023/10/17 10:38:20.635794 [info] dnsproxy: cache: enabled, size 4194304 b\n","stream":"stderr","time":"2023-10-17T10:38:20.635821024Z"}
{"log":"2023/10/17 10:38:20.635850 [info] dnsproxy: max goroutines is set to 300\n","stream":"stderr","time":"2023-10-17T10:38:20.63588052Z"}
{"log":"2023/10/17 10:38:20.635984 [info] dnsproxy: creating udp server socket 0.0.0.0:53\n","stream":"stderr","time":"2023-10-17T10:38:20.636021804Z"}
{"log":"2023/10/17 10:38:20.636224 [info] dnsproxy: listening to udp://[::]:53\n","stream":"stderr","time":"2023-10-17T10:38:20.63626785Z"}
{"log":"2023/10/17 10:38:20.636302 [info] dnsproxy: creating tcp server socket 0.0.0.0:53\n","stream":"stderr","time":"2023-10-17T10:38:20.636344976Z"}
{"log":"2023/10/17 10:38:20.636460 [info] dnsproxy: listening to tcp://[::]:53\n","stream":"stderr","time":"2023-10-17T10:38:20.63649765Z"}
{"log":"2023/10/17 10:38:20.636594 [info] dnsproxy: entering udp listener loop on [::]:53\n","stream":"stderr","time":"2023-10-17T10:38:20.636630784Z"}
{"log":"2023/10/17 10:38:20.636710 [info] dnsproxy: entering tcp listener loop on [::]:53\n","stream":"stderr","time":"2023-10-17T10:38:20.636798949Z"}
{"log":"2023/10/17 10:38:30.684759 [error] upstream https://dns.google:443/dns-query failed to exchange ;ptbtime3.ptb.de.\u0009IN\u0009 A in 10.001456727s. Cause: requesting https://dns.google:443/dns-query: Get \"https://dns.google:443/dns-query?dns=AAABIAABAAAAAAABCHB0YnRpbWUzA3B0YgJkZQAAAQABAAApCAAAAIAAAAA\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)\n","stream":"stderr","time":"2023-10-17T10:38:30.684871172Z"}
{"log":"2023/10/17 10:38:33.994276 [error] upstream https://dns.google:443/dns-query failed to exchange ;d6a1377eb0a7e92d65666e691abe9b57e89ea05f60fba16b93c96c12cc9ba30.us-east-1.prod.service.minerva.devices.a2z.com.rosetta.\u0009IN\u0009 A in 10.001019718s. Cause: requesting https://dns.google:443/dns-query: Get \"https://dns.google:443/dns-query?dns=AAABIAABAAAAAAABP2Q2YTEzNzdlYjBhN2U5MmQ2NTY2NmU2OTFhYmU5YjU3ZTg5ZWEwNWY2MGZiYTE2YjkzYzk2YzEyY2M5YmEzMAl1cy1lYXN0LTEEcHJvZAdzZXJ2aWNlB21pbmVydmEHZGV2aWNlcwNhMnoDY29tB3Jvc2V0dGEAAAEAAQAAKQgAAACAAAAA\": all dialers failed: dial tcp 10.0.0.1:443: i/o timeout\n","stream":"stderr","time":"2023-10-17T10:38:33.994444462Z"}
{"log":"2023/10/17 10:38:35.883827 [error] upstream https://dns.google:443/dns-query failed to exchange ;www.google.com.\u0009IN\u0009 A in 10.000994111s. Cause: requesting https://dns.google:443/dns-query: Get \"https://dns.google:443/dns-query?dns=AAABIAABAAAAAAABA3d3dwZnb29nbGUDY29tAAABAAEAACkIAAAAgAAAAA\": all dialers failed: dial tcp 10.0.0.1:443: i/o timeout\n","stream":"stderr","time":"2023-10-17T10:38:35.88397766Z"}
{"log":"2023/10/17 10:38:40.685606 [error] upstream https://dns.cloudflare.com:443/dns-query failed to exchange ;ptbtime3.ptb.de.\u0009IN\u0009 A in 10.000800161s. Cause: requesting https://dns.cloudflare.com:443/dns-query: Get \"https://dns.cloudflare.com:443/dns-query?dns=AAABIAABAAAAAAABCHB0YnRpbWUzA3B0YgJkZQAAAQABAAApCAAAAIAAAAA\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)\n","stream":"stderr","time":"2023-10-17T10:38:40.685695116Z"}
{"log":"2023/10/17 10:38:41.074191 [error] upstream https://dns.google:443/dns-query failed to exchange ;clients3.google.com.\u0009IN\u0009 A in 20.00053443s. Cause: requesting https://dns.google:443/dns-query: Get \"https://dns.google:443/dns-query?dns=AAABIAABAAAAAAABCGNsaWVudHMzBmdvb2dsZQNjb20AAAEAAQAAKQgAAACAAAAA\": all dialers failed: dial tcp 10.0.0.1:443: i/o timeout\n","stream":"stderr","time":"2023-10-17T10:38:41.074298896Z"}
{"log":"2023/10/17 10:38:41.074213 [error] upstream https://dns.google:443/dns-query failed to exchange ;android.googleapis.com.rosetta.\u0009IN\u0009 A in 20.000576754s. Cause: requesting https://dns.google:443/dns-query: Get \"https://dns.google:443/dns-query?dns=AAABIAABAAAAAAABB2FuZHJvaWQKZ29vZ2xlYXBpcwNjb20Hcm9zZXR0YQAAAQABAAApCAAAAIAAAAA\": all dialers failed: dial tcp 10.0.0.1:443: i/o timeout\n","stream":"stderr","time":"2023-10-17T10:38:41.07433037Z"}
{"log":"2023/10/17 10:38:41.302970 [error] upstream https://dns.cloudflare.com:443/dns-query failed to exchange ;connectivitycheck.gstatic.com.\u0009IN\u0009 A in 10.000846262s. Cause: requesting https://dns.cloudflare.com:443/dns-query: Get \"https://dns.cloudflare.com:443/dns-query?dns=AAABIAABAAAAAAABEWNvbm5lY3Rpdml0eWNoZWNrB2dzdGF0aWMDY29tAAABAAEAACkIAAAAgAAAAA\": all dialers failed: dial tcp 10.0.0.1:443: i/o timeout\n","stream":"stderr","time":"2023-10-17T10:38:41.30306418Z"}
{"log":"2023/10/17 10:38:43.996432 [error] upstream https://dns.cloudflare.com:443/dns-query failed to exchange ;www.googleapis.com.rosetta.\u0009IN\u0009 A in 10.000663093s. Cause: requesting https://dns.cloudflare.com:443/dns-query: Get \"https://dns.cloudflare.com:443/dns-query?dns=AAABIAABAAAAAAABA3d3dwpnb29nbGVhcGlzA2NvbQdyb3NldHRhAAABAAEAACkIAAAAgAAAAA\": all dialers failed: dial tcp 10.0.0.1:443: i/o timeout\n","stream":"stderr","time":"2023-10-17T10:38:43.996517935Z"}
{"log":"2023/10/17 10:38:47.949145 [error] upstream https://dns.cloudflare.com:443/dns-query failed to exchange ;connectivitycheck.gstatic.com.\u0009IN\u0009 A in 10.000372475s. Cause: requesting https://dns.cloudflare.com:443/dns-query: Get \"https://dns.cloudflare.com:443/dns-query?dns=AAABIAABAAAAAAABEWNvbm5lY3Rpdml0eWNoZWNrB2dzdGF0aWMDY29tAAABAAEAACkIAAAAgAAAAA\": all dialers failed: dial tcp 10.0.0.1:443: i/o timeout\n","stream":"stderr","time":"2023-10-17T10:38:47.94949884Z"}
{"log":"2023/10/17 10:38:50.817245 [error] upstream https://dns.cloudflare.com:443/dns-query failed to exchange ;hawkbit.devolo.net.\u0009IN\u0009 A in 20.000200091s. Cause: requesting https://dns.cloudflare.com:443/dns-query: Get \"https://dns.cloudflare.com:443/dns-query?dns=AAABIAABAAAAAAABB2hhd2tiaXQGZGV2b2xvA25ldAAAAQABAAApCAAAAIAAAAA\": all dialers failed: dial tcp 10.0.0.1:443: i/o timeout\n","stream":"stderr","time":"2023-10-17T10:38:50.817364945Z"}
{"log":"2023/10/17 10:38:51.071761 [error] upstream https://dns.google:443/dns-query failed to exchange ;pt.tv.global.mi.com.\u0009IN\u0009 A in 30.002141209s. Cause: requesting https://dns.google:443/dns-query: Get \"https://dns.google:443/dns-query?dns=AAABIAABAAAAAAABAnB0AnR2Bmdsb2JhbAJtaQNjb20AAAEAAQAAKQgAAACAAAAA\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)\n","stream":"stderr","time":"2023-10-17T10:38:51.071884119Z"}
{"log":"2023/10/17 10:38:51.071804 [error] upstream https://dns.google:443/dns-query failed to exchange ;es.tv.global.mi.com.\u0009IN\u0009 A in 30.002225563s. Cause: requesting https://dns.google:443/dns-query: Get \"https://dns.google:443/dns-query?dns=AAABIAABAAAAAAABAmVzAnR2Bmdsb2JhbAJtaQNjb20AAAEAAQAAKQgAAACAAAAA\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)\n","stream":"stderr","time":"2023-10-17T10:38:51.071909502Z"}
{"log":"2023/10/17 10:38:51.075209 [error] upstream https://dns.google:443/dns-query failed to exchange ;voilatile-pa.googleapis.com.rosetta.\u0009IN\u0009 A in 30.001608419s. Cause: requesting https://dns.google:443/dns-query: Get \"https://dns.google:443/dns-query?dns=AAABIAABAAAAAAABDHZvaWxhdGlsZS1wYQpnb29nbGVhcGlzA2NvbQdyb3NldHRhAAABAAEAACkIAAAAgAAAAA\": all dialers failed: dial tcp 10.0.0.1:443: i/o timeout\n","stream":"stderr","time":"2023-10-17T10:38:51.075394195Z"}
{"log":"2023/10/17 10:38:51.075237 [error] upstream https://dns.google:443/dns-query failed to exchange ;www.google.com.\u0009IN\u0009 A in 30.001546541s. Cause: requesting https://dns.google:443/dns-query: Get \"https://dns.google:443/dns-query?dns=AAABIAABAAAAAAABA3d3dwZnb29nbGUDY29tAAABAAEAACkIAAAAgAAAAA\": all dialers failed: dial tcp 10.0.0.1:443: i/o timeout\n","stream":"stderr","time":"2023-10-17T10:38:51.075415804Z"}
{"log":"2023/10/17 10:38:51.075241 [error] upstream https://dns.google:443/dns-query failed to exchange ;android.googleapis.com.\u0009IN\u0009 A in 30.001706866s. Cause: requesting https://dns.google:443/dns-query: Get \"https://dns.google:443/dns-query?dns=AAABIAABAAAAAAABB2FuZHJvaWQKZ29vZ2xlYXBpcwNjb20AAAEAAQAAKQgAAACAAAAA\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)\n","stream":"stderr","time":"2023-10-17T10:38:51.075420515Z"}
{"log":"2023/10/17 10:38:51.075346 [error] upstream https://dns.google:443/dns-query failed to exchange ;android.clients.google.com.rosetta.\u0009IN\u0009 A in 30.001848162s. Cause: requesting https://dns.google:443/dns-query: Get \"https://dns.google:443/dns-query?dns=AAABIAABAAAAAAABB2FuZHJvaWQHY2xpZW50cwZnb29nbGUDY29tB3Jvc2V0dGEAAAEAAQAAKQgAAACAAAAA\": all dialers failed: dial tcp 10.0.0.1:443: i/o timeout\n","stream":"stderr","time":"2023-10-17T10:38:51.075424317Z"}
{"log":"2023/10/17 10:38:51.110510 [error] upstream https://dns.google:443/dns-query failed to exchange ;a30f6tqw0oh1x0-ats.iot.eu-west-1.amazonaws.com.\u0009IN\u0009 A in 30.001768848s. Cause: requesting https://dns.google:443/dns-query: Get \"https://dns.google:443/dns-query?dns=AAABIAABAAAAAAABEmEzMGY2dHF3MG9oMXgwLWF0cwNpb3QJZXUtd2VzdC0xCWFtYXpvbmF3cwNjb20AAAEAAQAAKQgAAACAAAAA\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)\n","stream":"stderr","time":"2023-10-17T10:38:51.110592902Z"}
{"log":"2023/10/17 10:38:51.285527 [error] upstream https://dns.cloudflare.com:443/dns-query failed to exchange ;android.googleapis.com.\u0009IN\u0009 A in 10.000585945s. Cause: requesting https://dns.cloudflare.com:443/dns-query: Get \"https://dns.cloudflare.com:443/dns-query?dns=AAABIAABAAAAAAABB2FuZHJvaWQKZ29vZ2xlYXBpcwNjb20AAAEAAQAAKQgAAACAAAAA\": all dialers failed: dial tcp 10.0.0.1:443: i/o timeout\n","stream":"stderr","time":"2023-10-17T10:38:51.285598551Z"}
{"log":"2023/10/17 10:38:51.300872 [error] upstream https://dns.google:443/dns-query failed to exchange ;connectivitycheck.gstatic.com.\u0009IN\u0009 A in 30.001932769s. Cause: requesting https://dns.google:443/dns-query: Get \"https://dns.google:443/dns-query?dns=AAABIAABAAAAAAABEWNvbm5lY3Rpdml0eWNoZWNrB2dzdGF0aWMDY29tAAABAAEAACkIAAAAgAAAAA\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)\n","stream":"stderr","time":"2023-10-17T10:38:51.300967058Z"}
{"log":"2023/10/17 10:38:51.321975 [error] upstream https://dns.cloudflare.com:443/dns-query failed to exchange ;connectivitycheck.gstatic.com.rosetta.\u0009IN\u0009 A in 10.000272729s. Cause: requesting https://dns.cloudflare.com:443/dns-query: Get \"https://dns.cloudflare.com:443/dns-query?dns=AAABIAABAAAAAAABEWNvbm5lY3Rpdml0eWNoZWNrB2dzdGF0aWMDY29tB3Jvc2V0dGEAAAEAAQAAKQgAAACAAAAA\": all dialers failed: dial tcp 10.0.0.1:443: i/o timeout\n","stream":"stderr","time":"2023-10-17T10:38:51.322021692Z"}
{"log":"2023/10/17 10:38:51.685143 [error] upstream https://dns.google:443/dns-query failed to exchange ;ptbtime3.ptb.de.\u0009IN\u0009 A in 30.002218199s. Cause: requesting https://dns.google:443/dns-query: Get \"https://dns.google:443/dns-query?dns=AAABIAABAAAAAAABCHB0YnRpbWUzA3B0YgJkZQAAAQABAAApCAAAAIAAAAA\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)\n","stream":"stderr","time":"2023-10-17T10:38:51.685212755Z"}
{"log":"2023/10/17 10:38:51.700415 [error] upstream https://dns.google:443/dns-query failed to exchange ;footprints-pa.googleapis.com.rosetta.\u0009IN\u0009 A in 30.001194596s. Cause: requesting https://dns.google:443/dns-query: Get \"https://dns.google:443/dns-query?dns=AAABIAABAAAAAAABDWZvb3RwcmludHMtcGEKZ29vZ2xlYXBpcwNjb20Hcm9zZXR0YQAAAQABAAApCAAAAIAAAAA\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)\n","stream":"stderr","time":"2023-10-17T10:38:51.700467077Z"}
{"log":"2023/10/17 10:38:51.899298 [error] upstream https://dns.google:443/dns-query failed to exchange ;mtalk.google.com.rosetta.\u0009IN\u0009 A in 30.001345619s. Cause: requesting https://dns.google:443/dns-query: Get \"https://dns.google:443/dns-query?dns=AAABIAABAAAAAAABBW10YWxrBmdvb2dsZQNjb20Hcm9zZXR0YQAAAQABAAApCAAAAIAAAAA\": context deadline exceeded\n","stream":"stderr","time":"2023-10-17T10:38:51.899407289Z"}
{"log":"2023/10/17 10:38:52.686140 [error] upstream https://dns.google:443/dns-query failed to exchange ;ptbtime3.ptb.de.\u0009IN\u0009 A in 30.003201183s. Cause: requesting https://dns.google:443/dns-query: Get \"https://dns.google:443/dns-query?dns=AAABIAABAAAAAAABCHB0YnRpbWUzA3B0YgJkZQAAAQABAAApCAAAAIAAAAA\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)\n","stream":"stderr","time":"2023-10-17T10:38:52.686213704Z"}
{"log":"2023/10/17 10:38:53.989023 [error] upstream https://dns.google:443/dns-query failed to exchange ;www.googleapis.com.\u0009IN\u0009 A in 30.001944766s. Cause: requesting https://dns.google:443/dns-query: Get \"https://dns.google:443/dns-query?dns=AAABIAABAAAAAAABA3d3dwpnb29nbGVhcGlzA2NvbQAAAQABAAApCAAAAIAAAAA\": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)\n","stream":"stderr","time":"2023-10-17T10:38:53.989107167Z"}
{"log":"2023/10/17 10:38:53.993210 [error] upstream https://dns.google:443/dns-query failed to exchange ;device-metrics-us-2.amazon.com.rosetta.\u0009IN\u0009 A in 30.000579039s. Cause: requesting https://dns.google:443/dns-query: Get \"https://dns.google:443/dns-query?dns=AAABIAABAAAAAAABE2RldmljZS1tZXRyaWNzLXVzLTIGYW1hem9uA2NvbQdyb3NldHRhAAABAAEAACkIAAAAgAAAAA\": context deadline exceeded\n","stream":"stderr","time":"2023-10-17T10:38:53.993254689Z"}
rafaeldamasceno commented 11 months ago

Hey @ainar-g, sorry to be tagging you like this but I see a lot of issues have been triaged since this one was posted. Could you take a look? Thanks!

ainar-g commented 11 months ago

Hello and sorry for missing this earlier. Does the issue also persist if you use DoT?

@EugeneOne1, please inspect the bootstrap logic.

EugeneOne1 commented 11 months ago

@rafaeldamasceno, we have a few guesses, but we'd still like to take a look at the verbose log. Could you please collect it and send it to devteam@adguard.com?

Also, do you have any entries in the container's /etc/hosts file?

rafaeldamasceno commented 11 months ago

I've sent the log by email with the issue number in the subject. This scenario keeps occurring for me in case of power loss. My ISP router takes a lot more time to boot than the server/routers in which AdGuard Home is running.

For this test, my upstream DNS list was https://dns.google/dns-query https://dns.cloudflare.com/dns-query and my bootstrap DNS were 8.8.8.8 1.1.1.1. I have not changed anything in the container, including the hosts file. The only thing I have set up are volumes for the work and conf directories and open ports for DNS and the web interface.

Here's a timeline of what happens in the logs: 14:27:11 - started the container with no internet connection 14:29:01 - host reacquired internet connection (as evidenced by the stop of connect: no route to host logs) 14:29:27 - I perform a dig test in the host with the results shown right under

$ dig @127.0.0.1 amazon.com
;; communications error to 127.0.0.1#53: timed out
;; communications error to 127.0.0.1#53: timed out
;; communications error to 127.0.0.1#53: timed out

; <<>> DiG 9.18.20 <<>> @127.0.0.1 amazon.com
; (1 server found)
;; global options: +cmd
;; no servers could be reached

$ dig @8.8.8.8 amazon.com

; <<>> DiG 9.18.20 <<>> @8.8.8.8 amazon.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 32461
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;amazon.com.                    IN      A

;; ANSWER SECTION:
amazon.com.             509     IN      A       205.251.242.103
amazon.com.             509     IN      A       52.94.236.248
amazon.com.             509     IN      A       54.239.28.85

;; Query time: 37 msec
;; SERVER: 8.8.8.8#53(8.8.8.8) (UDP)
;; WHEN: Tue Dec 19 14:29:35 WET 2023
;; MSG SIZE  rcvd: 87

This test proves that AdGuard Home isn't responsive and the host does have internet connection. The web interface for AdGuard is responsive at all times. Additionally, I haven't been able to take the time to test it for DoT.

EugeneOne1 commented 11 months ago

@rafaeldamasceno, we've received the logs, thank you. So far, I can tell that we should definitely implement some mechanism for updating the resolved upstream addresses, since the current one indeed only bootstraps the URLs until the first success. If you don't mind, we'd like to confirm the assumption by asking you to reapply the upstream configuration via the web UI (Settings → DNS Settings) instead of restarting the AdGuard Home. This should restart the bootstrapping.

However, I'm quite curious about the bootstrap results. Do you have any idea why do the bootstrap servers resolve the dns.google into some kind of private address (10.0.0.1)? Do they return the same address after AdGuard Home restart and if it's actually reachable?

rafaeldamasceno commented 11 months ago

Reapplying the upstream configuration does indeed work when the container has the connection reestablished. Testing this now has made me realize it isn't as immediate as I thought like with the host.

As far as why Docker is resolving these names with internal network addresses, I have absolutely no idea... What I can tell you is it doesn't happen if it has internet connection at first bootstrap:

2023/12/19 17:31:17.231061 1#14 [debug] parallel lookup: lookup for dns.google succeeded in 9.742255ms: [8.8.8.8 8.8.4.4 2001:4860:4860::8888 2001:4860:4860::8844]
2023/12/19 17:31:17.810968 1#74 [debug] parallel lookup: lookup for dns.cloudflare.com succeeded in 10.61866ms: [2606:4700::6810:84e5 2606:4700::6810:85e5 104.16.133.229 104.16.132.229]

I've also tested DoT and the exact same behavior occurs (it resolves the Docker internal network address, then doesn't resolve anything until restarted/bootstrap is triggered).

rafaeldamasceno commented 11 months ago

One additional thing I just tested was whether or not having fallback DNS would help with this issue: it doesn't. I've put the same regular DNS in the fallback and bootstrap lists and it still tries to resolve with the failing DoH/DoT servers.

My suggestion would be that instead of a update mechanism (which by all means sounds good and would also help with network disconnections), perhaps checking if the DoH/DoT servers are actually able to resolve stuff would be more important, both for the bootstrap and for using the fallback DNS.

qingxiaoxinrou commented 11 months ago

I have a similar but not entirely the same problem as this one. I wonder if ADGUARDHOME can be implemented upstream, such as https://dns.google:443/dns-query When the TTL for the domain name dns.google is about to expire, I can resolve my issue by re resolving it

EugeneOne1 commented 10 months ago

@rafaeldamasceno, hello again. We've finally implemented caching of the bootstrap results, so that now AdGuard Home respects TTLs of received upstream addresses. Could you please try the latest edge build and let us know if the situation improves there?

rafaeldamasceno commented 10 months ago

Hello @EugeneOne1, I've tested it for DoH and it seems to be working fine with the previous scenario :) As soon as internet connectivity is restored, it starts resolving domains again as well. Thanks for all the support.

EugeneOne1 commented 9 months ago

@rafaeldamasceno, great to hear that. We'll close this for now then.