Hi, Suppose we have a Debian Wheezy machine with a bunch of network interfaces, some of them VLANs. Some of the interfaces are DHCP-based. For various reasons there is a requirement that DHCPDISCOVER should not be sent out when certain conditions are not fulfilled[*]. The conditions are always known locally, we can assume that there is a program, call it chk4dhcp, that returns 0 or 1, and the DHCP interfaces should only be started when the status is 0. Static interfaces should always be configured and started.
This mechanism should work on boot, on restarting network, on "ifup <iface>", "ifconfig <iface> up", etc. Question: how does one intervene in the DHCP client operation? I found out that /etc/dhcp-enter-hooks.d/* is irrelevant (if a hook fails the failure is ignored). So is /sbin/dhclient-script (I thought I'd create a "chk4dhcp && dhclient-script" script and specify it as "script" in dhclient.conf - does not help). I also failed to write "up" or "pre-up" stanzas in /etc/network/interfaces that would prevent DHCPDISCOVER from being sent. For reasons that should be obvious I am very reluctant to rename /sbin/dhclient binary and place something else in its stead. The existing configuration seems to be Debian default) does *not* have dhcpcd, and I am also reluctant to change (and re-test) the whole framework, even if dhcpcd proves more malleable. Any ideas? [*] <[email protected]> Without discussing the actual requirements, consider a trivial example. Suppose you have several DHCP VLANs configured on eth1, and suppose that for various operational reasons the eth1 link may occasionally be down. What happens in such a case is that dhclient keeps trying, for all VLANs and for a long time, before giving up. You don't want this to keep a machine from booting, to keep other interfaces from starting, etc. One would want to detect this early (e.g., using ethtool or similar) and not even attempt to bring up DHCP interfaces. [In my mind, this is a bug in dhclient, but this is beside the point...] -- Oleg Goldshmidt | [email protected]
_______________________________________________ Linux-il mailing list [email protected] http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
