-->
Page 1 of 1

Narrow DHCP range of IPs for DHCP server to only 1

PostPosted: Thu Jun 18, 2015 5:21 am
by helpme
I want a SoftAP-enabled ESP8266 to be able to talk to a remote peer but the problem is that the ESP8266 does not know the IP address of the remote peer. If I can narrow the DHCP range of IPs to only one, I will be able to know the IP address of the remote peer. At any one time, only 1 DHCP client can connect to the SoftAP.

Can I narrow the range of IP addresses allocated by the DHCP server such that only 1 IP address can be allocated?

Re: Narrow DHCP range of IPs for DHCP server to only 1

PostPosted: Thu Jun 18, 2015 5:42 pm
by FlyingHacker
In theory that should work. Many DHCP servers allow static mapping of ips based on MAC addresses. So you can be sure the same MAC address always gets the same ip... If your router does not allow this perhaps run your own separate Linux DHCP server...

Re: Narrow DHCP range of IPs for DHCP server to only 1

PostPosted: Thu Jun 18, 2015 6:15 pm
by helpme
FlyingHacker wrote:In theory that should work. Many DHCP servers allow static mapping of ips based on MAC addresses. So you can be sure the same MAC address always gets the same ip... If your router does not allow this perhaps run your own separate Linux DHCP server...


Actually, I was asking if the DHCP server inside ESP8266 can do this, not my home router.

Re: Narrow DHCP range of IPs for DHCP server to only 1

PostPosted: Thu Jun 18, 2015 6:35 pm
by lethe
Should be possible, I haven't tested it though.
Have a look at the SDK documentation for wifi_softap_set_dhcps_lease (you might also want to limit the number of supported clients to 1 using wifi_softap_set_config).