-->
Page 1 of 1

Change IP 192.168.4.1 Soft AP

PostPosted: Mon Mar 07, 2016 11:15 pm
by Horizontechno
Hello

I looking to change the default IP 192.168.4.1 in AP mode , i like to change for 2.0.0.101

I have try the Wifi.config but not work ,

I need your help

Thanks

Alain

Re: Change IP 192.168.4.1 Soft AP

PostPosted: Tue Sep 20, 2016 7:29 pm
by Daniel Torres

Re: Change IP 192.168.4.1 Soft AP

PostPosted: Fri Sep 23, 2016 12:07 pm
by hadipic
hi add this code in user_init :D

struct softap_config config;
struct dhcps_lease dhcp_lease;
char* start_ip = "192.168.5.100";
char* end_ip = "192.168.5.105";
struct ip_info info;

// char ssid[32]; //= STA_SSID;
// char password[64]; //= STA_PASS;




// wifi_set_opmode(SOFTAP_MODE);
wifi_set_opmode(STATIONAP_MODE);

wifi_set_phy_mode(PHY_MODE_11N); // maximom power




wifi_softap_get_config(&config); // Get config first.
os_memset(config.ssid, 0, 32);
os_memset(config.password, 0, 64);
os_memcpy(config.ssid, "ESP8266", 7);
os_memcpy(config.password, "12345678", 8);
config.authmode = AUTH_WPA_WPA2_PSK;
config.ssid_len = 0;// or its actual length
config.max_connection = 4; // how many stations can connect to ESP8266 softAP at most.


wifi_softap_dhcps_stop();

IP4_ADDR(&info.ip, 192, 168, 5, 1);
IP4_ADDR(&info.gw, 192, 168, 1, 1);
IP4_ADDR(&info.netmask, 255, 255, 255, 0);

dhcp_lease.start_ip = ipaddr_addr(start_ip);
dhcp_lease.end_ip = ipaddr_addr(end_ip);

// IP4_ADDR(&dhcp_lease.start_ip, 192, 168, 4, 100);
//IP4_ADDR(&dhcp_lease.end_ip, 192, 168, 4, 105);

wifi_set_ip_info(SOFTAP_IF, &info);
wifi_softap_set_dhcps_lease(&dhcp_lease);
wifi_softap_dhcps_start();


wifi_softap_set_config(&config);// Set ESP8266 softap config .