mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 00:55:52 +03:00
[GH-ISSUE #1578] Question: Saving Static IP #1345
Labels
No labels
📶 WiFi
🕸️ HTTP
Branch
DEV Help Wanted
Discussion
Documentation
ESP32
Example
Good First Issue
Hotfix
In Progress
Incomplete
Needs Feeback
Priority
QA
Question
Task
Upstream/Dependancy
bug
duplicate
enhancement
invalid
pull-request
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/WiFiManager#1345
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @lmcbmai on GitHub (Mar 28, 2023).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1578
Hi,
I am very new to WiFiManager and having troubles understanding whether static IP/Gateway/Netmask/DNS values are saved automatically after exiting the portal, or I need to write a code to make them survive power cycle or restart of ESP8266. I tried many code examples published here and I am seeing that SSID and Password values are saved but IPs are not. If additional steps are required to save IPs, I'd appreciate if somebody shares a code snippet or a link to an example showing how to do it.
Thanks
@Bighoneypot commented on GitHub (Mar 29, 2023):
Do you want to configure your device without dhcp?
That is, do you want to manually configure the IP address etc etc?
@Bighoneypot commented on GitHub (Mar 29, 2023):
You need similar this?

@lmcbmai commented on GitHub (Mar 29, 2023):
I want to configure device with static IP. My observation is that unlike SSID and Password, the values of Static IP and other 3 related fields are not saved; they are lost after power cycling or resetting the microcontroller.
Yesterday I wrote a code saving these 4 values in a file in LittleFS and loading them on power up. It is working fine now, and my only remaining question is - do I really need to write my own code to save static IP and related fields, or WiFiManager can do it and I simply do not know how to enable/call this feature.
Thanks
@delugeia commented on GitHub (Mar 29, 2023):
I know this doesn't answer your question, but I have preferred to set the Static IP at the router level using a DHCP IP Reservation.
After connecting to the device using the normal WiFiManager process, I'm able to (in my case with Google Nest WiFi) go to Settings, Advanced Networking, DHCP IP Reservations. From there I can simply assign/change the IP address I want for the device's corresponding MAC address. Likewise, I can set port forwarding if I want the device to be accessible outside of my LAN.
There have always been similar features on every router I've used.
Hope this helps.
@lmcbmai commented on GitHub (Mar 29, 2023):
@delugeia Thanks for your suggestions. That's the right (professional) way of doing things and I am all for it. Unfortunately in some cases that is not possible. For example I have 5G based wireless Internet and 5G modem I got from my ISP is integrated with WiFi router that has extremely limited list of configurable options. I cannot even set the local subnet of my choice, leave alone assigning static IPs to particular clients. Since there is no way to change the netmask, I reduced DHCP pool and using upper IPs outside pool range as static. Adding another WiFi router would be an option, but I don't want to overcomplicate things if not absolutely necessary.
@delugeia commented on GitHub (Mar 29, 2023):
I completely understand. Was just an idea.
Sorry to hear about your limited setup. That would drive me bonkers. Actually, it did nearly drive me bonkers years ago when I was in a similar situation with a cable internet provider. They would change things so frequently and you couldn't do what I suggested with their system either. Before switching providers, I did take the route of purchasing my own intelligent router and just let their router believe there was only one, wired connection and it was on the DMZ.
Not to beat a dead horse, but there are some pretty good, inexpensive routers out there that will do the trick and give you a nice local network as well.
Best of luck.
@tablatronix commented on GitHub (Mar 30, 2023):
Wm does not save anything to any part of flash by design. There are examples already do these things in user code
@lmcbmai commented on GitHub (Apr 1, 2023):
@tablatronix Thanks for clarifying, but than do you know by any chance which other library saves SSID and Password? They somehow survive restarts nevertheless I am not doing anything to save and restore them.
In fact I just found in AutoConnectNonBlocking example the following lines:
This means credentials are saved somehow.
Thanks
@tablatronix commented on GitHub (Apr 1, 2023):
Credentials are saved by the esp library wm doesnt have to handle that
@LewiLim commented on GitHub (Jun 13, 2023):
Hi, is there an examples like this
@tablatronix commented on GitHub (Jun 13, 2023):
I believe there is one in the examples with spiffs, there is a litttlefs example but it does not include params
@debbyagestira commented on GitHub (Apr 3, 2024):
@Bighoneypot, @tablatronix Hello, how do I make those fields blank?
I have tried to delete the hardcoded values like this:
or
but the fields/forms is gone..