dhcpcd-discuss

RE: Recommendations for Configuring DHCP on Multiple Interfaces

David Hauck

Fri Jun 06 18:33:15 2014

On Friday, June 06, 2014 11:16 AM, Roy Marples wrote:
> On 06/06/2014 18:32, David Hauck wrote:
>> Actually, I admittedly haven't looked at "interface specific"
>> configurations in dhcpcd.conf before, but isn't this exactly what I
>> need here? Couldn't I do something like:
>> 
>> ...
>> interface eth1
>> nogateway
>> nooption 12 # ignore hostname on this interface
> 
> Ah, you didn't mention it was ok to discard the other interfaces.

I want to make sure I understand your inference here: the dhcpcd.conf "interface <name>" clauses are distinct from other interfaces - specified or not - wrt their contents, right? That is, I could have something like the following

...
interface eth1
nogateway

interface eth2
nooption hostname

And this would allow negotiation of hostname (but not gateway) for eth1 as well as allow negotiation of gateway (but not hostname) for eth2. In addition, full negotiation would occur for any/all other discovered interfaces (e.g., eth0, eth3, etc.)?

> Yes, that should work fine.
> nooption hostname # no need to specify 12 ;)

Nice.
 
>> In a two-interface (eth[01]) DHCP setup this would allow eth0 to do
>> full DHCP negotiation and eth1 to ignore gateway and hostname. Do I
>> have this right?
> 
> Yes!
> 
>>> But Beware!
>>> IF this interface is not configured (ie, link down) and another is
>>> then dhcpcd will install a default interface for that interface and
>>> gateway.
>> 
>> Do you mean "install default route"?
> 
> Yes I do, but as you indicated above it's fine to discard this information.
> What this means is that only eth0 can install a default route, and if
> eth0 is "down" then no default route will be available.

OK.

>>> When the interface is configured (ie, link up) then dhcpcd will
>>> change the default route to the preferred interface and gateway.
>> 
>> I'm not following the specifics of this. Could you maybe provide a
>> concrete example?
> 
> Sure. Keeping with eth0 and eth1, eth0 has metric 0 and eth1 has metric 1.
> Both interfaces request default routes, ie not your options above.
> dhcpcd is compiled with route metrics disabled.
> 
> Order of events:
> eth0 UP, install default route
> eth1 UP, don't change default route as eth0 is UP
> eth0 DOWN, remove default route, install default route from eth1
> eth0 UP, remove default route, install default route from eth0
> eth1 DOWN, no change to default route
> 
> Hope this clarifies the actions :)

Yes, thanks :) and this also confirms that I would *not* want this semantic ;). That is, I definitely wouldn't want the eth1 gateway to be installed when eth0 is DOWN (and so, in my case, the "interface eth1" "nogateway" configuration is preferable). 

Thanks for helping me to distill this into something workable.

Cheers,
-David

> Thanks
> 
> Roy

Follow-Ups:
RE: Recommendations for Configuring DHCP on Multiple InterfacesRoy Marples
References:
Recommendations for Configuring DHCP on Multiple InterfacesDavid Hauck
Re: Recommendations for Configuring DHCP on Multiple InterfacesRoy Marples
RE: Recommendations for Configuring DHCP on Multiple InterfacesDavid Hauck
RE: Recommendations for Configuring DHCP on Multiple InterfacesRoy Marples
RE: Recommendations for Configuring DHCP on Multiple InterfacesDavid Hauck
RE: Recommendations for Configuring DHCP on Multiple InterfacesRoy Marples
Archive administrator: postmaster@marples.name