Azure IoT Hub Library with OpenThread

Hello Everyone,

We are working on a new product using the nrf52840 and OpenThread.Our current product uses the Azure IoT Hub and we were wondering if we could use the library used by the nrf91.

According to Didrik in a post on Devzone It should be possible to use this library to connect to the Azure IoT Hub.

I have set up a Thread network and added a route for the NAT64 interface. I am able to use the NAT64 interface as a DNS server to get a IPv6 address synthesized from the well-known-prefix and the IPv4 address.

I've done this using the OpenThread CLI example from the nRF Connect SDK.

I've created a project and I've included the Azure IoT Hub library. It runs but is unable to get a ip address for the provided domain.

I've looked at the Azure IoT Hub code and it uses getaddrinfo to get a ip address from a hostname.

What would be the best way to proceed? I can see the OpenThread CLI example uses a different method to retrieve the ip address from the DNS. Is there a way to configure a DNS server used by getaddrinfo?

Parents
  • The answer, from a reply I made down below:
    I was using the default interface to do my DNS requests and connections to the network outside the Thread network. This was fixed when I configured my IPv6 address as "CONFIG_NET_CONFIG_MY_IPV6_ADDR="fd3f:76ab:550:1:2a9d:e83a:3e:84a7""
    I was using my mesh local address instead of my localaddress. Mesh Local can only talk to mesh local prefix addresses. With the correct interface I was able to do DNS requests and connections to NAT64 mapped ipv6 addresses

    We can configure the NAT64 address as DNS Server.

    The Azure IoT Hub library can be used, the azure_iot_hub.c function broker_init needs to be rewritten to resolve to ipv6 addresses.

    I also added SNTP to the project, I did remember from a ESP32 project, MBedTLS would need it. Since we don't have an IPv6 network at home/work. I also had to find NTP servers with only IPv4 addresses so the NAT64 would translate them. Setting the server "eu.pool.ntp.org" in "nrf\lib\date_time\date_time_ntp.c" worked perfectly.

    And using the correct MBedTLS config we can create tls connections to the Azure IoT Hub. Here we need to enable the CBC ciphers in MBedTLS so we can use the cipher "MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256".

    The same is true for using the Azure IoT Hub DPS. After fiddling with my certificates, I got that working.

    Thanks everyone for your help!

Reply
  • The answer, from a reply I made down below:
    I was using the default interface to do my DNS requests and connections to the network outside the Thread network. This was fixed when I configured my IPv6 address as "CONFIG_NET_CONFIG_MY_IPV6_ADDR="fd3f:76ab:550:1:2a9d:e83a:3e:84a7""
    I was using my mesh local address instead of my localaddress. Mesh Local can only talk to mesh local prefix addresses. With the correct interface I was able to do DNS requests and connections to NAT64 mapped ipv6 addresses

    We can configure the NAT64 address as DNS Server.

    The Azure IoT Hub library can be used, the azure_iot_hub.c function broker_init needs to be rewritten to resolve to ipv6 addresses.

    I also added SNTP to the project, I did remember from a ESP32 project, MBedTLS would need it. Since we don't have an IPv6 network at home/work. I also had to find NTP servers with only IPv4 addresses so the NAT64 would translate them. Setting the server "eu.pool.ntp.org" in "nrf\lib\date_time\date_time_ntp.c" worked perfectly.

    And using the correct MBedTLS config we can create tls connections to the Azure IoT Hub. Here we need to enable the CBC ciphers in MBedTLS so we can use the cipher "MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256".

    The same is true for using the Azure IoT Hub DPS. After fiddling with my certificates, I got that working.

    Thanks everyone for your help!

Children
Related