DHCP-Setup to serve two networks

Simon Hobson dhcp1 at thehobsons.co.uk
Mon May 19 19:44:08 UTC 2008


Oliver Emslers wrote:

>is there a easy way to share two (or more) public networks equally 
>to internal clients to do some kind of minimal load balancing with 
>DHCP? Just to have for instance approx. 50% clients on Network-A and 
>50% on Network-B with minimal Lease-Times. I know all the 
>disadvantages this setup has, but that's not the question, please 
>don't remind me! ;-) A working setup would be something like that:
>
>subnet 87.1.1.0 netmask 255.255.255.128 { range 87.1.1.1; option 
>routers 87.1.1.126; option domain-name-servers 192.168.9.254; }
>
>subnet 87.2.1.0 netmask 255.255.255.128 { range 87.2.1.1; option 
>routers 87.2.1.126; option domain-name-servers 192.168.9.254;  }
>
>
>[...]
>
>and add every single ip to a separate subnet declaration. I already 
>tried that out, it works. Isn't there a easier, more elegant way?

The question is really unclear ! You give an example of two subnets 
with one usable IP in each, then make the statement "and add every 
single ip to a separate subnet declaration" - do you mean you intend 
doing something like this :

subnet 87.1.1.0 netmask 255.255.255.128 { range 87.1.1.1; option 
routers 87.1.1.126; option domain-name-servers 192.168.9.254; }
subnet 87.1.1.0 netmask 255.255.255.128 { range 87.1.1.2; option 
routers 87.1.1.126; option domain-name-servers 192.168.9.254; }
subnet 87.1.1.0 netmask 255.255.255.128 { range 87.1.1.3; option 
routers 87.1.1.126; option domain-name-servers 192.168.9.254; }
...

or something like :
subnet 87.1.1.0 netmask 255.255.255.128 {
  range 87.1.1.1;
  range 87.1.1.2;
  range 87.1.1.3;
  ...
  option routers 87.1.1.126;
  option domain-name-servers 192.168.9.254; }

The first is not valid, the second gives no advantage over :
subnet 87.1.1.0 netmask 255.255.255.128 {
  range 87.1.1.1 87.1.1.125;
  option routers 87.1.1.126;
  option domain-name-servers 192.168.9.254; }

Whichever way you define the ranges, the server allocates "never 
used" addresses in a specific order (implementation dependent and not 
defined) which at the moment is 'top down' - ie highest address first.

After a bit of churn, the address allocation will end up being 
pseudo-random as addresses are reallocated on a least-recently-used 
manner. If you wanted to randomise the allocation of leases to new 
clients from the outset, then the simplest way would be to write a 
script that generated random leases with a very short time and a 
bogus client-id so as to 'seed' the leases file with leases that have 
randomised expiry times.


More information about the dhcp-users mailing list