AdguardTeam / AdGuardDNS

Public DNS resolver that protects you from ad trackers
https://adguard-dns.io/
GNU Affero General Public License v3.0
773 stars 60 forks source link

Incorrect Server for IPv6 #157

Closed Ryan-Goldstein closed 3 years ago

Ryan-Goldstein commented 3 years ago

I'm in Philadelphia, and connecting to AdGuard DNS over IPv4 correctly connects me to the New York server, which is the closest location to me. However, when I use my IPv6 address, it's connecting me to the Los Angeles server (2,700+ miles away, on the other side of the country), and that's causing noticeable lag.

IPv4 address: 73.141.87.194 IPv6 address: 2601:41:4300:bbe:8579:db0d:2106:f1c

Using a Geo IP service I found, https://www.maxmind.com/en/geoip-demo, it's correctly resolving both IP addresses to Philadelphia.

Any suggestions on getting AdGuard DNS to use the correct server location via IPv6?

ameshkov commented 3 years ago

The thing is that with Anycast routing your geo-location does not matter, it just does not work like that. For some reason, your network route for IPv6 is shorter to LA than to NY, there's nothing we can do with that.

You can simply use IPv4 instead, just use IP address instead of the domain name: https://94.140.14.14/dns-query

Ryan-Goldstein commented 3 years ago

Thanks for the response, but I don't think that addresses the underlying issue. Maybe it's an EDNS0 problem? I ran some tests to compare results of AdGuard DNS with Cloudflare DNS and Google DNS, all via IPv6:

nslookup google.com 2a10:50c0::ad1:ff
Server:  dns.adguard.com
Address:  2a10:50c0::ad1:ff

Non-authoritative answer:
Name:    google.com
Addresses:  2607:f8b0:4026:803::200e
          216.58.192.110
nslookup google.com 2606:4700:4700::1111
Server:  one.one.one.one
Address:  2606:4700:4700::1111

Non-authoritative answer:
Name:    google.com
Addresses:  2607:f8b0:4006:811::200e
          172.217.10.110
nslookup google.com 2001:4860:4860::8888
Server:  dns.google
Address:  2001:4860:4860::8888

Non-authoritative answer:
Name:    google.com
Addresses:  2607:f8b0:4006:801::200e
          172.217.9.238

The IPs resolved by AdGuard DNS result in an average 83ms ping, whereas the IPs resolved by Cloudflare DNS and Google DNS result in an average 16ms ping. I suspected this might have been due to EDNS0, but the same behavior remains when edns_client_subnet_private is set to 0 in stubby.

Further, from dnsleaktest.com, when using AdGuard DNS through IPv4, the server used is 89.187.179.174, which has an average 18ms ping. When using AdGuard DNS through IPv6, the server used is 84.17.44.182, which has an average 87ms ping. So, in addition to being routed to the wrong CDN servers, every DNS query takes almost 500% longer.

Using IPv4 only does work to have my queries sent to the closer/faster AdGuard DNS New York server and to be routed to nearby CDN locations. However, how would I go about doing that on my iPhone? I've tried using both the AdGuard DNS profiles from https://adguard.com/en/blog/encrypted-dns-ios-14.html and the AdGuard iOS app, but the same issue occurs on my phone.

With the IPv4 address space depleted, the suggested solution of using only IPv4 servers seems a bit regressive. But if that is the best solution to this issue at this time, would you be able to make IPv4-only .mobileconfig profiles that could be used by those experiencing the same issue?

ameshkov commented 3 years ago

No, it definitely has nothing to do with EDNS0, anycast routing takes place before that.

AdGuard iOS app

If you're using the iOS app, you can add it as a custom DNS server.