[Dnsmasq-discuss] dnsmasq dhcp and multiple subnets
Simon Kelley
simon@thekelleys.org.uk
Thu, 17 Feb 2005 08:37:37 +0000
Andreas Grune wrote:
> Hello,
>
> please comment if the following is possible with dnsmasq:
>
> given multiple subnets and virtual interfaces, say eth0:1/192.168.1.0,
> ..., eth0:10/192.168.10.0,
> clients should get subnet membership and corresponding configuration
> data (name server, gateway etc)
> according to their MAC-addresses.
>
> Say, client ff:ff:ff:ff:ff should get the IP address 192.168.1.20 (fixed
> mapping) and 192.168.1.1 for both gw and dns,
> client ee:ee:ee:ee:ee should get the IP address 192.168.2.20 and
> 192.168.2.1 for gw and dns , etc.
>
There's no way to do this: The DHCP server code assumes that requests
are recieved from a unique interface (where aliases are present, it
would be the unaliasesd "base" interface) it isn't clever enough to
search for valid MAC address to IP mappings over a set of interfaces.
Since using DHCP with aliased interfaces doesn't in general make any
sense (there is no way to determine which alias to assign a host to),
then re-working the code would only have benefits in the specific case
that all hosts have static addresses. (ie the situation Andreas describes)
This isn't the first time that this has come up, and before I've always
resisted making the DHCP code significantly more complex to support one
corner case. There's also the problem that there is no portable way to
get _all_ the addresses associated with a physical interface, different
code would be needed on different OSs.
I'm happy to entertain arguments that it would be worth doing (or
patches which do it!) but I'm not currently convinced.
Cheers,
Simon.