Sample Header Ad - 728x90

Android won't query DNS server for IPv6 addresses, why?

3 votes
1 answer
1953 views
I have a weird issue; for a single connect request to a server that has a single AAAA record my device runs two A queries instead and fails to connect. My setup is as follows: * LAN (a regular router) without IPv6 connectivity * Android 10 with only WiFi connectivity, having one fe80: and two fd14: addresses * Debian box, wired, running dnsmasq, acting as the DNS server for all devices * dnsmasq will reply that website foo.com has an IPv6 of the Debian box, and no IPv4 I can: * Connect from my phone to the Debian box using literal IPv6 address * Connect from other devices to foo.com * Connect to foo.com from JuiceSSH * Do ping6 foo.com successfully in Termux on the phone What I can't do, I can't connect from my phone to the Debian box via foo.com using regular apps such as Chrome, or my own app. JuiceSSH is the weird exception. I tried making a new app, adding INTERNET permission and this bit of code only:
thread {
    Socket("foo.com", 9000)
}
` This works consistently with the apps such as Chrome in that it doesn't connect and—from what I see in dsmasq logs—performs two A queries (both with NODATA-IPv4 response). It never performs an AAAA query. Inet*Address.getAllByName() behaves in a similar way. I tested with another device running Android 6, same outcome. What's going on here?
Asked by squirrel (131 rep)
Apr 9, 2021, 07:03 PM
Last activity: Jul 20, 2024, 02:45 PM