This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

List all devices in Thread network

Hello

In my application (based on ble_thread_dyn_mtd_coap_cli example), I would like to get the list of devices present on the network (ip).

I saw that there was a command to retrieve the RLOC16s of the routers and their children (otThreadGetRouterInfo (...) to get the list of routers and then use otThreadSendDiagnosticGet (...) to get the list of the children of a router).
If I want to get the "Mesh-Local EID" ip address of all the devices on the network, is it a good method to get all the RLOC16 in order to send commands individually to each device so that they send them back to me their mesh-Local EID or is there a simpler method?

How can I determine the IP address of a device just from its RLOC16?

Thank you

Parents
  • Hello,

    As far as I know, the easiest way is to use the CLI commands to find information on the thread nodes in the network:

    https://github.com/openthread/openthread/tree/master/src/cli

    "router table" and "child table" should cover all nodes.

     

    If I want to get the "Mesh-Local EID" ip address of all the devices on the network, is it a good method to get all the RLOC16

     Yes. That is typically what we recommend.

     

    How can I determine the IP address of a device just from its RLOC16?

    Have you tried:

     https://github.com/openthread/openthread/tree/master/src/cli#ipaddr-rloc

    Best regards,

    Edvin

  • Hello Edvin

    Yes, using the otThreadGetRouterInfo (...) and otThreadSendDiagnosticGet (...) functions is the same as using "router table" and "child table" in CLI command(these CLI commands use these ot commands).

    But how can I determine the EID address from these RLOC16s? (the command "ipaddr rloc" that you advised me only displays the RLOC address of the device on which the command is executed ...) 
    I would like to be able to use all the RLOC16s that I obtained with the previous functions in order to obtain the EID addresses of the devices to which they correspond.

    Thank you

  • It is usually a while between the times I look into this, but let me see what I find:

    So the upper left is the leader, and it has ID 12. The right is ID 15, and the bottom is ID 15. Right and bottom are routers.

    So there are multiple ip addresses for each node. One of the addresses is fdde:ad00:beef:0:0:ff:fe00:<RLOC16>.

    You can see this matches the data in the screenshot. In addition, the leader always has the address fdde:ad00:beef:0:0:ff:fe00:fc00

    Additionally, there is one address based on the Ectended MAC:

    fe80:0:0:0:<EXTENDED_MAC_MODIFIED>

    EXTENDED_MAC_MODIFIED is, as you can see, almost identical to the Extended MAC, but you can see that e.g. the leader's MAC address starts with 4274, while the ip address starts with 4074.

    This change applies to all the extended mac addresses => ip address. As far as I can tell, the 2 LSB in the first byte should be 0's, but you need to test with a few addresses to figure this out.(at least the 2nd lsb should be 0.

      

    Does this match your observations? I can recommend to play around with the CLI examples a bit.

    Best regards,

    Edvin

Reply
  • It is usually a while between the times I look into this, but let me see what I find:

    So the upper left is the leader, and it has ID 12. The right is ID 15, and the bottom is ID 15. Right and bottom are routers.

    So there are multiple ip addresses for each node. One of the addresses is fdde:ad00:beef:0:0:ff:fe00:<RLOC16>.

    You can see this matches the data in the screenshot. In addition, the leader always has the address fdde:ad00:beef:0:0:ff:fe00:fc00

    Additionally, there is one address based on the Ectended MAC:

    fe80:0:0:0:<EXTENDED_MAC_MODIFIED>

    EXTENDED_MAC_MODIFIED is, as you can see, almost identical to the Extended MAC, but you can see that e.g. the leader's MAC address starts with 4274, while the ip address starts with 4074.

    This change applies to all the extended mac addresses => ip address. As far as I can tell, the 2 LSB in the first byte should be 0's, but you need to test with a few addresses to figure this out.(at least the 2nd lsb should be 0.

      

    Does this match your observations? I can recommend to play around with the CLI examples a bit.

    Best regards,

    Edvin

Children
Related