[libvirt] Another curiosity question

Gene Czarcinski gene at czarc.net
Fri Oct 26 19:52:18 UTC 2012


On 10/26/2012 01:19 PM, Laine Stump wrote:
> 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.
OK, work (patch) in progress :}}  ... because I would like to have both 
dhcp4 AND dhcp6 on a dual-stack (dual subnet) network.

And speaking of dhcp6, I thought I would need to do a lot of programming 
to see it implemented.  So far, it is more a matter of figuring out 
where is put a (very) little more code.  I am a bit surprised someone 
has not done it already.  You folks have already done 98% (or more) of 
what needs to be done to support dhcp6.  My current code is either/or 
(dhcp4, but if dhcp4 is not defined, then try dhcp6.  I also need to 
tweak things so that radvd has the correct parameters when dhcp6 is 
specified.

[I had visions of needing to delve into virsh but ... no adds, no 
deletes, no changes ... and dhcpv6 works with virsh net-edit, etc. happy 
as can be.]

What I have so far has given me something that works.  Then it is a 
matter of adding/changes tests (you folks sure do love those tests) and 
how about those things like bootp, dhcp-host, etc. ... well, OK, I just 
started.
>
> 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?
You ask the tough questions ... IIRC, for dhcp6 I believe that dnsmasq 
does know which subnet the packet came in on.  dhcp4 ... don't know.
>
>
>> 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).
The above examples show what is dnsmasq gets but if you look at the 
dnsmasq man-page, there are a lot of other things like prefix, etc. The 
above examples would be the same if prefix=24 rather than prefix=16.  It 
might be interesting to ask Simon what he wants sent to dnsmasq.  Is 
what is done currently sufficient?
>
>> 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).
>
I am just adding a few lines here and a few lines there.  Most of the 
code already does what is needed.

However, I do believe that we need to explore more with Simon Kelley 
(Mr. Dnsmasq) so that we are specifying things correctly.

BTW, this only helps those whose systems are supported with 
bridge_driver.  Anything else is ??

Gene




More information about the libvir-list mailing list