你好,8266怎样固定自己的IP,不让路由器DHCP自动分配呢?
Re: 你好,8266怎样固定自己的IP,不让路由器DHCP自动分配呢?
Postby ESP_Faye » Mon May 16, 2016 4:45 pm
您好,
在关闭 DHCP 的情况下,调用 wifi_set_ip_info 设置即可。例如,
在关闭 DHCP 的情况下,调用 wifi_set_ip_info 设置即可。例如,
Code: Select all
wifi_set_opmode(STATIONAP_MODE); //Set softAP + station mode
struct ip_info info;
wifi_station_dhcpc_stop();
wifi_softap_dhcps_stop();
IP4_ADDR(&info.ip, 192, 168, 3, 200);
IP4_ADDR(&info.gw, 192, 168, 3, 1);
IP4_ADDR(&info.netmask, 255, 255, 255, 0);
wifi_set_ip_info(STATION_IF, &info);
IP4_ADDR(&info.ip, 10, 10, 10, 1);
IP4_ADDR(&info.gw, 10, 10, 10, 1);
IP4_ADDR(&info.netmask, 255, 255, 255, 0);
wifi_set_ip_info(SOFTAP_IF, &info);
wifi_softap_dhcps_start();
Who is online
Users browsing this forum: No registered users and 235 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.