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

  • 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

  • I see that the extended mac address is a non-routable address, so it can only be used between neighbours. The RLOC address is described here:
    https://openthread.io/guides/thread-primer/ipv6-addressing#routing-locator-rloc

  • Yes the only solution to have routable addresses is to either use the Mesh-Local EID addresses or the RLOC addresses but since the RLOC addresses are likely to change during the life of the Thread network, it is necessary that I use the EID addresses...

    The RLOC addresses of the routers I can get them quite easily by executing the otThreadGetRouterInfo (...) commands (or the CLI command "router table") but on the other hand I have a problem to retrieve the RLOCs of the children... In fact , I send the command otThreadSendDiagnosticGet (...) to each router so that it sends me its list of children (RLOC16). The problem I have is that the command only works once and after that it no longer works ... This command is the same as using the CLI command "networkdiagnostic get ..." which also does not works only once ...

    My strategy at the beginning was to retrieve the RLOC16s of all devices on the network to then determine their RLOC address and then send a custom frame to each device individually to send me their EID address. So I would also like to know if it is a good approach to do it like this or if there is a way to retrieve EID addresses more easily?

Related