Multiple subnets, wired/wireless

Glenn Satchell Glenn.Satchell at uniq.com.au
Tue Sep 29 04:28:15 UTC 2009


>Date: Mon, 28 Sep 2009 23:02:09 +0100
>From: Alan Buxey <A.L.M.Buxey at lboro.ac.uk>
>To: Users of ISC DHCP <dhcp-users at lists.isc.org>
>Subject: Re: Multiple subnets, wired/wireless
>
>Hi,
>
>>    Can DHCPd actually do this, serve two separate subnets and know what  
>> IP to hand out where and when.  Or am I better off just using a  
>> different server and setting up DHCP on there, specifically for this  
>> purpose?
>
>sure - but it depends on your network topology and equipment - if
>your router can do DHCP relay (eg ip helper-address) then it will
>direct the DHCP broadcast to the DHCP server which will respond
>with the relevant details for that subnet (so long as you have configured
>a suitable range with the required network, subnetmask, gateway etc)
>
>alternatively, the DHCP needs a leg on each of the networks you need 
>to serve - this really doesnt scale if you get up to dozens of
>networks :-)

Hi Ashley

There are two parts of the configuration that are required.

First up you need to connect your dhcp server to the second network.
You can do this directly through a second NIC, or via the first network
through a router.

If you use a router then this needs to support DHCP relay. A DHCP relay
listens for the DHCP broadcast requests and forwards them to the DHCP
server. It also broadcasts the replies from the server to the clients
on it's network.

Secondly you configure the subnet declaration in dhcpd.conf. This looks
exactly the same whether it is a local subnet (like your first one) or
a remote subnet using a DHCP relay.

There is an example in the dhcp.conf man page, but essentially it will
look something like this:

# global options (eg dns servers, domain name and so on)
option domain-name "example.com.au";
option domain-name-servers server1.example.com.au, server2.example.com.au;
default-lease-time 14400;
# wired subnet
subnet 192.168.100.0 netmask 255.255.255.0 {
	option routers 192.168.100.1;
	range 192.168.100.200 192.168.100.250;
}
# wireless subnet
subnet 192.168.200.0 netmask 255.255.255.0 {
	option routers 192.168.200.1;
	range 192.168.200.200 192.168.200.250;
	default-lease-time 3600;
}

If you define an option or a setting outside a subnet, then it is
inherited by al subnets. If you define a setting or option inside a
subnet then it is valid in that subnet only. A value defined in both
uses the most specific value, eg the default-lease-time is shorter for
your wireless subnet. It really only makes sense to define the default
router in each subnet.

You can use a hostname anywhere an IP address is required, as dhcpd
will look that up when it runs and supply the matching IP address.
That's why there's no quotes around the dns server names.

Recommended reading is the included man pages for dhcpd.conf, dhcpd,
dhcp-options and dhcp-eval. There is a lot of tricky stuff you can do,
but the basic config above should get you going.

regards,
-glenn
--
Glenn Satchell   mailto:glenn.satchell at uniq.com.au | Miss 9: What do you
Uniq Advances Pty Ltd       http://www.uniq.com.au | do at work Dad?
PO Box 70 Paddington NSW Australia 2021            | Miss 6: He just
tel:0409-458-580     fax:02-9380-6416              | types random stuff.




More information about the dhcp-users mailing list