Skip to content

Change AP static IP configuration #76

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
luc-github opened this issue Apr 17, 2015 · 5 comments
Closed

Change AP static IP configuration #76

luc-github opened this issue Apr 17, 2015 · 5 comments

Comments

@luc-github
Copy link
Contributor

Seems there is no function to change AP IP configuration, currently setting IP/GW/Subnet works only for Station.
I have modified ESP8266Wifi.cpp/.h to add the missing function and it works so far, it would be good to add it I think.

void ESP8266WiFiClass::configAP(IPAddress local_ip, IPAddress gateway, IPAddress subnet)
{
    struct ip_info info;
    info.ip.addr = static_cast<uint32_t>(local_ip);
    info.gw.addr = static_cast<uint32_t>(gateway);
    info.netmask.addr = static_cast<uint32_t>(subnet);
    wifi_softap_dhcps_stop();
    wifi_set_ip_info(SOFTAP_IF, &info);
    wifi_softap_dhcps_start();
}
@reaper7
Copy link
Contributor

reaper7 commented Apr 21, 2015

works well!
This is very usefull

@igrr igrr closed this as completed in 307ea87 Apr 21, 2015
@igrr
Copy link
Member

igrr commented Apr 21, 2015

Thanks!
Merged with a minor naming change (configAP -> softAPConfig) to be consistent with other functions.

igrr added a commit that referenced this issue Oct 29, 2015
@JanJansen47
Copy link

From the network point of view there appeared also to be an issue with the lease time of my (TP-Link) router. Standard IP address lease time is 120 minutes. In case an ESP8266 request the same fixed IP address within these 120 minutes its "refused" and the DHCP return an "ad-hoc" ip address. So I changed the lease time to one (1) minute.

@khalilst
Copy link

Sorry, i'm a newbie to this field. Could you please write me an example for calling of softAPConfig? I have no idea how to pass the arguments.
Thanks in advance

@joemxwolf
Copy link

what at commands is used for changing ip address of esp8266 (cwmode=3) so that every time the esp connects to the router the router will give static ip for the esp? like having a constant ip for the esp given by the router? big thnx.

Normola pushed a commit to Normola/Arduino that referenced this issue Feb 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants