Static IP

386 views
Skip to first unread message

Gleb Billig

unread,
Mar 14, 2018, 4:32:25 PM3/14/18
to openthread-users
Hello,

I am running OpenThread on the nRF52840 development kit, in a NCP configuration using a Raspberry Pi 3 Model B as the host. I am able to use wpantund to create a Thread network. I was wondering if there is a way to have a static IP address, so that every time I create the network, the MeshLocalAddress is the same?

I tried using the following command:
wpanctl set IPv6:MeshLocalAddress fdde:adbe:effe:0:1a6f:7591:fbd9:7178:5683

And received the error: set failed with error 2. InvalidArgument
My panid, xpanid, and network name are all constant throughout my testing.

Could someone tell if how I can achieve static IP?

Thank you,
Gleb Billig

Jeff Bumgardner

unread,
Mar 14, 2018, 4:59:48 PM3/14/18
to Gleb Billig, openthread-users
Hi Gleb, I think you need to use "setprop" instead of "set".

--
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 post to this group, send email to openthre...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openthread-users/97e2049e-9408-4450-903f-d4e8fc234ed2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gleb Billig

unread,
Mar 14, 2018, 5:16:07 PM3/14/18
to openthread-users
I've tried both set and setprop, with the same result. Any other ideas?

Jonathan Hui

unread,
Mar 14, 2018, 5:23:59 PM3/14/18
to Gleb Billig, openthread-users
As currently implemented, the Mesh Local Address is not configurable by the user - there is neither an API nor a Spinel property to set to set the Mesh Local Prefix.

Thread relies on the uniqueness of the Mesh Local Address for a variety of functions (e.g. handling multiple address notification during address resolution, IPv6 address duplicate address detection, etc.).  For this reason the Thread 1.1.1 specification requires that Mesh Local Address to be generated at random.  Providing an API that allows the user to manually configure the ML-EID runs the risk of not properly selecting the value at random, which has adverse effects with any other device that share the same ML-EID.

Thread allows a device to manually configure additional IPv6 addresses and wpantund + OpenThread should support that.  Can you try adding another IPv6 address to the linux network interface?

--
Jonathan Hui

To unsubscribe from this group and stop receiving emails from it, send an email to openthread-users+unsubscribe@googlegroups.com.
To post to this group, send email to openthread-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openthread-users/e85efa45-32d0-4f34-9cfd-a8ed430d03bb%40googlegroups.com.

Gleb Billig

unread,
Mar 14, 2018, 11:10:45 PM3/14/18
to openthread-users
I see. I added another IPv6 address using ip -f inet6 addr add fdde:adbe:effe:0:1111:2222:3333:4444/64 dev wpan0, and it shows that it was successfully added when I run ifconfig. My goal was to create a static IP so that an end device can send CoAP requests to a hardcoded IP address. However, with this approach, it doesn't seem to work. If I use the MeshLocalAddress then the requests are received, but if I use the second IP address they aren't.

Could you recommend a way to programmatically determine the IP address of the device that is in leader state from an end device that is in child state?

Thanks!

Jonathan Hui

unread,
Mar 15, 2018, 12:02:59 PM3/15/18
to Gleb Billig, openthread-users
I just tried this approach using the latest master on both wpantund and openthread and it worked for me.

Few things to confirm:

1) After adding the IPv6 address to the wpan0 interface, do you see the following wpantund log?
wpantund[44446]: Adding address "fd47:dcae:f21a:0:1111:2222:3333:4444/64" to NCP

2) From another Thread devices, are you able to ping the IPv6 address that you added to the wpan0 interface?

3) Are you able to send raw UDP messages to the IPv6 address that you added?  You can use netcat on linux and the CLI UDP example in OpenThread to test this.

--
Jonathan Hui

To unsubscribe from this group and stop receiving emails from it, send an email to openthread-users+unsubscribe@googlegroups.com.
To post to this group, send email to openthread-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openthread-users/020d29d9-0963-45f9-9915-ec324262110a%40googlegroups.com.

Gleb Billig

unread,
Mar 15, 2018, 1:32:51 PM3/15/18
to openthread-users
I am using the latest-release build of OpenThread. In the wpantund log, I see:
wpantund[846]: "fdde:adbe:effe:0:1111:2222:3333:4444" was added to "wpan0"

However, these lines also follow:
wpantund[846]: SpinelNCPTaskSendCommand.cpp:305: Requirement Failed ((mRetVal == kWPANTUNDStatus_Ok) || (mRetVal == kWPANTUNDStatus_Busy))
wpantund[846]: SendCommand task encountered an error: 16 (0x00000010)

Regarding 2 and 3, I can ping and send UDP packets to the MeshLocal IPv6 address, but no connection when I use the IPv6 address that I added.

Jonathan Hui

unread,
Mar 15, 2018, 3:10:22 PM3/15/18
to Gleb Billig, openthread-users
Can you try using the latest master branch?

--
Jonathan Hui

To unsubscribe from this group and stop receiving emails from it, send an email to openthread-users+unsubscribe@googlegroups.com.
To post to this group, send email to openthread-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openthread-users/9c7d4652-52d5-4ac4-9dab-e6a627dcdf69%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages