I am using an esp8266 wifi module if that matters. What I intend to do is connect the module to my home router and have other modules connect to this module and form a second layer, and to this second layer other modules can connect forming a third layer and the network expands so on, essentially a tree like network topology. The first module that connects to the home router will make it's own private IP range independent from home router ip range and we will further subnet this. So we start from:

  • for the first module. It takes the ip
  • It offers, ... through DHCP
  • can further give, and so on till through DHCP
  • can give through DHCP

Every module runs it's own DHCP server.

Now the problem is that when a module gets a request from another module to assign it an ip address, DHCP server should respond; but the problem is DHCP can't assign ip addresses in the fashion that I have described and I can seem to only set it up for contiguous ip-blocks .

example to is OK but I need to

Is there any way to make a DHCP server assign IP addresses the way I want it to?


1 Answer 1


IP ranges on networks have reserved places for certain addresses. Lets take the first step when splitting network in two as an example:

network #      ip for devices   broadcast 
    0                  1-126          127
  128                 129-254         255

this is mask /25.

For other masks there are also exact boundaries, which limit the allowed addresses and amount of devices with an address in the sub network.

Always the first address is for addressing the network itself and last one is a broadcast address.

So, you cannot select 100% by your own the ranges between which the IPs are.

more info: https://kthx.at/subnetmask/ and in RFC 2131 thats explains DCHP design and working.

If you are interested you can read this RFC to improve your knowledege about address management also. IETF RFC 1466 Guidelines for Management of IP Address Space

  • I have not made my arbitrary rules for IP's, in fact it is the standard subnetting format. In your example of /25 I can use DHCP for assigning 1-126 or 129-254 range, but I am concerned with the previous step where I assign the 1 or 0 (8th bit) in the /24 stage to divide the network into two /25 i.e. How to make DHCP assign x.x.x.0/25 and x.x.x.128/25 in the first place to the two subnet routers connected to main router (i.e. x.x.x.0/24). Is DHCP incapable if the addresses I want to assign are not in-contiguous as is the case with subnetting here.
    – solomon
    Commented Apr 26, 2017 at 17:43
  • Maybe the last fourth step is the only natural for DHCP, at least I did not find anything towards that another way. Maybe someone else knows sth?
    – mico
    Commented Apr 26, 2017 at 18:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.