RE: Recommendations for Configuring DHCP on Multiple Interfaces
David Hauck
Fri Jun 06 16:10:01 2014
Hi Roy,
On Friday, June 06, 2014 1:17 AM, Roy Marples wrote:
> Hi
>
> Sorry for the late reply.
>
> On 04/06/2014 22:35, David Hauck wrote:
>> I've been researching various techniques for using DHCP configured
>> interfaces in a multi-homed environment. Unfortunately, I haven't
>> uncovered any clear guidance on the various aspects of this with
>> DHCPCD. One particular question I have relates to all of the (DHCP)
>> interfaces communicating with the same DHCP server and being
>> subsequently served addressing information from a pool of addresses
>> on the same subnet (e.g., 192.168.2.[234]/24). This isn't
>> problematic in and of itself, but generally each exchange also
>> includes any number
>> of: hostname, gateway, name server, ntp servers, static routes,
>> etcetera. I've seen some material that indicates interface-specific
>> DHCP configuration can be used to control which interfaces ignore
>> these duplicated, global settings and, correspondingly, which
>> interface might be configured to accept them (e.g., to ensure only
>> one negotiates the configuration for hostname, default gateway, name
>> servers, etc.).
>>
>> I recognize that there might be some configurations where it *may*
>> be desirable to have, for e.g., multiple default gateways, but even
>> this is generally frowned upon (note that my current focus is IPv4).
>> However, I'd like to constrain possibilities like this in my
>> configurations.
>>
>> What is the recommended way to do this under a Debian-based
>> (sysvinit) system? I saw a reference somewhere that mentioned using
>> an /etc/default/dhcpcd file to help with something like this, but I
>> don't think this is standard. I'm guessing there's something similar
>> built into DHCPCD (i.e., some way to configure interface-specific
>> parameters/environment variables), but I've not yet been able to
>> isolate this.
>
> The recommended dhcpcd way is just to run dhcpcd and let it manage
> things :) Basically it will internally manage ip addressing and routing
> per interface. On Linux there will be multiple default gateways, but
> this is *fine* because they are split out by routing metric (lowest
> wins). In the typical multi-homed system (ie a laptop with ethernet and
> wireless) dhcpcd will automatically prefer the wired host rather than
> the wireless. It should be a fairly seamless transition between the two
> as well (unplug / plug the wired cable)
Can you say more about how dhcpcd manages this? Our system has very diverse network configurations (including up to 6+ network interfaces - all wired) and we need fairly explicit control of these. One configuration that I'm currently pondering is the "all interfaces configured for DHCP" scenario and it is this scenario that I'm curious about. Unless I understand exactly how dhcpcd controls this case (in any/all circumstances) I would like to be able to control its operation on an interface by interface basis (for e.g., I know about the lowest metric wins, multi-default gateway scenario, but I need to prevent this configuration from occurring - i.e., enforce a single gateway on a specific interface only).
As far as I know (under my Debian-like sysvinit system) the network is brought up during init via an RC script with 'ifup -a'. I'm not exactly sure how ifup/down iterates interfaces, but my understanding is that it invokes dhcpcd "an interface at a time". If so, I wonder if these invocations can be parameterized in any particular way (e.g., the reference I saw somewhere to /etc/default/dhcpcd), or whether the recommendation is to do this via the dhcpdh-hooks mechanism instead (which would be somewhat intricate).
> As to information duplication, well all of the hook scripts take this
> into account.
> So for resolv.conf and ntp{d}.conf it's all managed.
> You may want to look into using resolvconf (I personally recommend
> openresolv ;) ) as that can handle it better than dhcpcd.
Interesting. So multiple identical incoming nameserver parameters are merged/normalized across interfaces (resulting in a single recolve.conf file with the merged nameserver list - including removed duplicates)?
If I wanted to do the same for hostname and gateway across interfaces I would need to do something similar? This would be instead of doing some other kind of interface-specific invocation of dhcpcd from ifup that just informed this interface negotiation to ignore/not negotiate (for e.g.) gateway and/or hostname? Personally, I'd prefer the former if it was available since it seems easier ;).
Thanks Roy,
-David
> Thanks
>
> Roy
Archive administrator: postmaster@marples.name