DNS resolve for IPv4 adresses

Skip to first unread message

Jon Rhees

Feb 16, 2022, 1:37:45 PM2/16/22
to openthread-users
Hi, I am using the `dns resolve` command and would like to resolve to an ipv4 AAAA resord instead of the ipv6 record, since my BR is on a network without ipv6 connectivity.

For example, 
> dns resolve time.google.com fdaa:bb:1::2
DNS response for time.google.com. - 2001:4860:4806:0:0:0:0:0 TTL:1865 2001:4860:4806:8:0:0:0:0 TTL:1865 2001:4860:4806:4:0:0:0:0 TTL:1865 2001:4860:4806:c:0:0:0:0 TTL:1865

Unfortunately, these resolved ipv6 addresses are not useful to the device. Is there a way to query for ipv4 records (e.g., with the 64:ff9b prefix) instead?



Jonathan Hui

Feb 18, 2022, 6:09:26 PM2/18/22
to Jon Rhees, Abtin Keshavarzian, openthread-users
This is currently expected behavior. The current DNS Client implementation will first send a query for AAAA records (see src/core/net/dns_client.cpp). Only if the response does not contain any AAAA records will the DNS Client even consider sending a query for A records (see src/core/net/dns_client.cpp). Of course, the fact that an IPv6 address was returned does not mean you can actually connect to it.

I think it would be useful to allow the user to specify what DNS record types to query for. There will be cases where the returned IPv6 addresses do not work and it would be desirable to use the IPv4 addresses if NAT64 is available.

+Abtin Keshavarzian , thoughts?

Jonathan Hui

You received this message because you are subscribed to the Google Groups "openthread-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openthread-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openthread-users/de1da2bb-d069-4500-bad1-3256a78fc9c3n%40googlegroups.com.

Abtin Keshavarzian

Feb 18, 2022, 10:04:21 PM2/18/22
to Jonathan Hui, Jon Rhees, openthread-users
Yes. What Jonathan mentioned is correct and the currently supported behavior.

We do have mechanism in OT DNS client to query for A records, but this is done only when there was no response to AAAA record and that `OPENTHREAD_CONFIG_DNS_CLIENT_NAT64_ENABLE` is enabled and the DNS conifg allows NAT64 translation for the query.

I agree it may be useful to extend the API to allow user to directly request A records. We can consider adding this later.

Abtin Keshavarzian

Feb 25, 2022, 4:49:43 PM2/25/22
to openthread-users
Submitted OT PR#7411 related to this.
Reply all
Reply to author
0 new messages