On 10/26/2012 01:01 PM, Gene Czarcinski wrote:
All doc and the libvirt software itself is very insistent that dhcp4
will be supported on one and only one IPv4 subnetwork. Why is true?
Not "will be". "is". It's this way because nobody has submitted a
patch
to support it.
It is possible (as far as I understand) to setup dnsmasq so that it will
hand out leases on multiple subnets that are on the same L2 segment, but
it needs to trigger off of something in the dhcp request to decide which
subnet. Definitely this should be possible for static hosts; for clients
getting an address from a pool, I don't recall how it would work - if
there's some sort of "network id" that can be placed in the request, or
if dnsmasq can have a list of client names/macs and the network they
will be on without specifying the exact IP address.
Certainly dnsmasq supports multiple dhcp-range definitions and the
actual parameters passed to dnsmasq would be more or less the same!
I think the parameters passed to dnsmasq need more work than you think.
Multiple ranges on the same subnet is one thing, but ranges on multiple
subnets are entirely different - each range would have a different
default route and different dns server for starters. And how would it
decide which subnet to put each client on?
I can understand some restriction if there were systems libvirt
suports which does not support the multi-dhcp per interface but not
the blanket restriction.
This, this is OK:
------------------------------------------------------
<ip address='172.16.6.1' prefix='16'>
<dhcp>
<range start='172.16.6.128' end='172.16.6.254' />
<range start='172.16.7.128' end='172.16.7.254' />
</dhcp>
</ip>
------------------------------------------------------
but this is not:
------------------------------------------------------
<ip address='172.16.6.1' prefix='16'>
<dhcp>
<range start='172.16.6.128' end='172.16.6.254' />
<range start='172.16.7.128' end='172.16.7.254' />
</dhcp>
</ip>
<ip address='172.16.7.1' prefix='16'>
<dhcp>
<range start='172.16.7.128' end='172.16.7.254' />
</dhcp>
</ip>
------------------------------------------------------
In both cases, the parameters passed to dnsmasq are:
----------------------------------------------------
dhcp-range=172.16.6.128,172.16.6.254
dhcp-range=172.16.7.128,172.16.7.254
----------------------------------------------------
and, for dhcp, dnsmasq does not care about the specific addresses
since it does its own filtering by listening on 0.0.0.0:67/68
You're specifying two IP addresses on the same subnet, rather than two
different subnets. That's much simpler (aside from deciding which of
those two addresses to use as the default router).
Comments?
Feel free to make some patches. I would be wary if the code started
looking complicated, though - for example detecting when multiple
gateway ip addresses are on the same subnet (that actually doesn't sound
as useful to me as the case where the multiple ip's are each on a
different subnet).