11

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:

  • 10.0.0.0/8 for the first module. It takes the ip 10.1.0.0
  • It offers 10.2.1.0/16, 10.3.1.0/16 ... 10.254.0.0/16 through DHCP
  • 10.2.1.0/16 can further give 10.2.2.1/24, 10.2.3.0/24 and so on till 10.2.254.0/24 through DHCP
  • 10.2.2.1/24 can give 10.2.2.2/32 through 10.2.2.254/32 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 192.168.1.0 to 192.168.254.254 is OK but I need 192.168.1.0 to 192.168.254.0

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

6

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 Apr 26 '17 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 Apr 26 '17 at 18:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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