I've been having an issue with DNS lookup for IPv6 addresses that I can't seem to find good information about.
I'm trying to lookup an IPv6 address using InetAddress.getByName("ipv6.local.com")
. It throws an UnknownHostException
error.
The weird part is I know the DNS server can be contacted because this works:
InetAddress.getByName("ipv4.local.com")
I also know the IPv6 record is working because I can run:
nslookup ipv6.local.com
and it properly returns 3ffe:b00:0:1:4678:3eff:fe36:16e8
.
Likewise, if I run the following in C++, I get a result with the above address as well:
int errorCode = getaddrinfo("ipv6.local.com", "4242", &hints, &res);
I have also tried Inet6Address.getByName()
, but this also throws UnknownHostException
. So why do getaddrinfo()
and nslookup
work and not InetAddress.getByName()
?
I am attempting the DNS lookup from an Android device (Galaxy Tab S2 8") running Android 6.0.1 on the same network as the DNS server. The DNS server has a record "ipv4.local.com"
pointing to 192.168.0.190
, and a record "ipv6.local.com"
pointing to 3ffe:b00:0:1:4678:3eff:fe36:16e8
.
The DNS server is explicitly set in Wi-Fi settings on the Android device, and is running on 192.168.0.182
.
Any ideas?