DHCP server for two physical separate subnets
Simon Hobson
dhcp1 at thehobsons.co.uk
Mon Nov 3 08:05:39 UTC 2008
Franz Edler wrote:
> > Isn't it possible to separate the two subnets also at the DHCP server?
>
>I just found myself the solution: Use separate DHCP server for each of the
>interfaces like:
>
>- dhcpd eth1 -q -cf /etc/dhcpd-eth1.conf
>- dhcpd eth2 -q -cf /etc/dhcpd-eth2.conf
NO NO NO NO NO You do NOT have to do that.
The DHCP server works just fine with multiple subnets - you've just
got something fundamental with the config.
>I have two subnet declarations in my /etc/dhcpd.conf as follows:
>
> subnet 192.168.1.0 netmask 255.255.255.224
> {
> option broadcast-address 192.168.1.31;
> option subnet-mask 255.255.255.224;
> option routers 192.168.1.1;
> option domain-name-servers 172.16.0.1;
> range 192.168.1.2 192.168.1.20;
> default-lease-time 86400;
> max-lease-time 86400;
>
> host wxp.dom11.fhtw
> {
> hardware ethernet 00:11:11:76:6d:76;
> fixed-address 192.168.1.21;
> }
> ...
> }
>
> subnet 192.168.2.0 netmask 255.255.255.224
> {
> option broadcast-address 192.168.2.31;
> option subnet-mask 255.255.255.224;
> option routers 192.168.2.1;
> option domain-name-servers 172.16.0.1;
> range 192.168.2.2 192.168.2.20;
> default-lease-time 86400;
> max-lease-time 86400;
>
> host wxp.dom21.fhtw
> {
> hardware ethernet 00:19:66:2a:4f:9a;
> fixed-address 192.168.2.21;
> }
> ...
> }
Do the clients by any chance have a host statement defined in the
first subnets ? First thing you MUST do is to remove the host
declarations from within the subnet declarations, like this :
I have two subnet declarations in my /etc/dhcpd.conf as follows:
> subnet 192.168.1.0 netmask 255.255.255.224
> {
> option broadcast-address 192.168.1.31;
> option subnet-mask 255.255.255.224;
> option routers 192.168.1.1;
> option domain-name-servers 172.16.0.1;
> range 192.168.1.2 192.168.1.20;
> default-lease-time 86400;
> max-lease-time 86400;
> }
>
> subnet 192.168.2.0 netmask 255.255.255.224
> {
> option broadcast-address 192.168.2.31;
> option subnet-mask 255.255.255.224;
> option routers 192.168.2.1;
> option domain-name-servers 172.16.0.1;
> range 192.168.2.2 192.168.2.20;
> default-lease-time 86400;
> max-lease-time 86400;
>
> }
>
> host wxp.dom11.fhtw
> {
> hardware ethernet 00:11:11:76:6d:76;
> fixed-address 192.168.1.21;
> }
> host wxp.dom21.fhtw
> {
> hardware ethernet 00:19:66:2a:4f:9a;
> fixed-address 192.168.2.21;
> }
> ...
Putting host statements inside a subnet declaration causes all sorts
of undesirable (in most cases) effects as they are always global in
scope and so match even if the client is not in that subnet. The
effect is that a client can get inherit options from the wrong place.
If that doesn't fix it, post the server logs as a client gets a wrong address.
--
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