Want to change softAP IP block
Want to change softAP IP block
How can I change the IP block used dhcps in softAP mode? The default 192.168.4.x is the same subnet used by the Amazon EERO router and is playing havoc with networking when both AP and STA modes are active.
-
- Posts: 69
- Joined: Thu Nov 01, 2018 8:32 am
Re: Want to change softAP IP block
Hi brewmstr
Instead of creating the default wifi interface, you can create a custom one using `esp_netif_create_wifi()`
You can find some examples of usage in the below links to the test/sample codes of IDF:
https://github.com/espressif/esp-idf/bl ... tif.c#L249
https://github.com/espressif/esp-idf/bl ... .c#L41-L45
Instead of creating the default wifi interface, you can create a custom one using `esp_netif_create_wifi()`
Code: Select all
const esp_netif_ip_info_t my_subnet_ip = {
.ip = { .addr = ESP_IP4TOADDR( 192, 168, xxx, 1) },
.gw = { .addr = ESP_IP4TOADDR( 192, 168, xxx, 1) },
.netmask = { .addr = ESP_IP4TOADDR( 255, 255, 255, 0) },
};
esp_netif_inherent_config_t cfg = ESP_NETIF_INHERENT_DEFAULT_WIFI_AP();
cfg.ip_info = & my_subnet_ip;
esp_netif_create_wifi(WIFI_IF_AP, &cfg);
esp_wifi_set_default_wifi_ap_handlers();
https://github.com/espressif/esp-idf/bl ... tif.c#L249
https://github.com/espressif/esp-idf/bl ... .c#L41-L45
Who is online
Users browsing this forum: MicroController and 208 guests