Static IP (not static dynamic) [RESOLVED]

There is no official static IP support at present, and no workaround on the photon. I’m open to suggestions about how this could work. E.g. how would the static IP be setup - as part of WiFi setup?

I can imagine adding a ‘d’ (for DNS) command to serial. DNS is enabled by default. The UI might look like this:

(type ‘d’)
DNS setting (1) - 0=static IP, 1=dynamic IP [return to cancel]:
(type 1, then return)
Dynamic IP enabled

(type ‘d’)
DNS setting (1) - 0=static IP, 1=dynamic IP [return to cancel]:
(type 0, then return)

Static IP enabled
IP Address (0.0.0.0) :
(type in address, press return - 192.168.0.1)
Network Mask (0.0.0.0) :
(type in netmask, press return - 255.255.255.0)
Gateway Address (0.0.0.0) :
(type in address, press return - 192.168.0.254)
DNS Server (0.0.0.0) :
(type in DNS address, press return - 8.8.8.8)
Static IP Configured!
IP Address: 192.168.0.1
Subnet: 255.255.255.0
Gateway: 192.168.0.254
DNS: 8.8.8.8


This gets more complex on the photon when we introduce IPv6 support, but this could be a starting point. Thoughts?

@mdma, using DHCP for initial configuration is most likely fine. Is it, however, possible to set a static IP from the user code?

i quite like @mdma’s proposal for static ip in the wifi setup, but i’m with @peekay123 - its more important to be able to set it in the user program than for initial config.

ipv6 is a whole other boardgame, are people even using static ip’s for ipv6, its pretty reliant on icmp and dns.

Sure. We’d have to build the function in HAL first to allow static config to be set, so it could be done from user code. I’ll see if we can’t squeeze this in this sprint.

3 Likes

For Photon the topic carries on here
I need to set a static IP on a Photon

is this [RESOLVED] - did the functionality get added in the last sprint? which branch, and is it documented?

[RESOLVED] goes for the OPs question dealing with the Core, which is still running the “old” system firmware, so no it’s not yet baked in, but the shown solution does work for the OP.

For the Photon, the respective thread is not marked solved.

given that i’m the op, i wouldn’t class it as solved, the hack i found is pretty nasty, and not user-configurable

Oops, should have checked :blush:

In this case, I'll just take the liberty to "interpret" @mdma's answer from the Photon thread, till he might provide an explicit statement for the Core, that a better solution will be on the ToDo for the next (or next but one) FW release, whenever this will be available.


But since you are OP, you can remove the [RESOLVED], if you don't see it as such

Are you asking how to set up a static IP from within the Application or how to provide a generic interface Applications can use to allow the end-user to configure their IP parameters?

In the former case, it seems to me that providing appropriate optional parameters to the initialization calls should work just fine for statics for both IPv4 and IPv6.

In the latter case, how about extending the interface when you first do the cloud linkup using the Particle App on the phone. Add to the phone UI the option to set up a static set of IP parameters for v4, v6, or both.

Yes, many people use static IPv6 addresses, especially on routers and things they need to be able to reach reliably (e.g. servers, web hosts, etc.)

For IoT, predictable IPv6 address is probably more important than static, but I can see valid use cases for both.

I tried for a long time to set a static IP on the Photon, but in the end, I solved the problem by adding an inexpensive processor with full WiFi Access Point features. The cost for the additional processor was $5.

I probably could have used one of the Ardrino processors with both access point and beam break functionality all in one, but I find the particle processors easier to program.

My project uses two WiFi connected Photons and an iPhone. Frankly, the biggest issue I had was with Apple. In the process of trying to provide softAP inside the iPhone, I found security breaches and eventually Apple removed any IP setting from within an app. Now I allow the Photons to receive IP addresses from the AP and use broadcast and unicast UDP messages to associate the different devices using a proprietary protocol.