12

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?

solomon
  • 121
  • 2

1 Answers1

5

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

mico
  • 4,351
  • 1
  • 18
  • 27