Multiple subnets with relays

Simon Hobson dhcp1 at thehobsons.co.uk
Mon Jan 19 08:03:07 UTC 2009


Jessica Meyer wrote:

>I have a question about configuring DHCPD to answer requests according
>the value of the "DHCP relay" option. I have tried to find the
>information on the internet as well in the manpage, but could not find
>what I was looking for.
>
>I have to set up a quite complex environment (at least for me). I have
>already compiled the latest version of DHCPD on a debian machine and
>configured it so that I have three address pools.
>
>Now what I need is the following:
>
>   - DHCPD gets a request from a client.
>   - DHCPD looks at the relay agent option.
>   - If the relay agent IP is 10.0.0.1, give out an IP address from
>     10.1.0.0/16 or 10.2.0.0/16, but not from any other address pool.
>   - If the relay agent IP is 192.168.0.1, give out an IP address from
>     192.168.0.0/24.
>
>I hope my explanation is easy to understand... I already configured a
>shared-network for the 10.x.0.0/16 networks, but I am not sure if this
>is the right way.

Congratulations, your config is just what you need (apart from adding 
a few options like routers etc). The rest is automagic - the server 
spots that the GIAddr (Gateway Interface Address) field is filled in 
and uses it to determine which subnet (or shared network) the client 
is connected to.

It's a common source of confusion for new users, though 
shared-network (which you've got right) is usually even more 
confusing.


>Here is my configuration so far (relevant parts):
>
>   server-identifier 192.168.0.2;
>   authorative;
>
>   subnet 192.168.0.0 netmask 255.255.255.0
>   {
>     option subnet-mask 255.255.255.0;
>     range 192.168.0.3 192.168.0.254;
>     default-lease-time 36000;
>     max-lease-time 36000;
>   }
>
>   shared-network RELAY1
>   {
>     subnet 10.1.0.0 netmask 255.255.0.0
>     {
>       range 10.1.0.2 10.1.254.254;
>       ...
>     }
>     subnet 10.2.0.0 netmask 255.255.0.0
>     {
>       range 10.2.0.2 10.2.254.254;
>       ...
>     }
>   }


-- 
Simon Hobson

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.



More information about the dhcp-users mailing list