|
|
45d60a |
The /etc/dhcp/dhclient.d directory allows other packages and system
|
|
|
45d60a |
administrators to create application-specific option handlers for dhclient.
|
|
|
45d60a |
|
|
|
45d60a |
When dhclient is run, any option listed in the dhcp-options(5) man page can
|
|
|
45d60a |
be requested. dhclient-script does not handle every option available
|
|
|
45d60a |
because doing so would make the script unmaintainable as the components
|
|
|
45d60a |
using those options might change over time. The knowledge of how to handle
|
|
|
45d60a |
those options should be under the responsibility of the package maintainer
|
|
|
45d60a |
for that component (e.g., NTP options belong in a handler in the ntp
|
|
|
45d60a |
package).
|
|
|
45d60a |
|
|
|
45d60a |
To make maintenance easier, application specific DHCP options can be handled
|
|
|
45d60a |
by creating a script with two functions and placing it in /etc/dhcp/dhclient.d
|
|
|
45d60a |
|
|
|
45d60a |
The script must follow a specific form:
|
|
|
45d60a |
|
|
|
45d60a |
(1) The script must be named NAME.sh. NAME can be anything, but it makes
|
|
|
45d60a |
sense to name it for the service it handles. e.g., ntp.sh
|
|
|
45d60a |
|
|
|
45d60a |
(2) The script must provide a NAME_config() function to read the options and
|
|
|
45d60a |
do whatever it takes to put those options in place.
|
|
|
45d60a |
|
|
|
45d60a |
(3) The script must provide a NAME_restore() function to restore original
|
|
|
45d60a |
configuration state when dhclient stops.
|
|
|
45d60a |
|
|
|
45d60a |
(4) The script must be 'chmod +x' or dhclient-script will ignore it.
|
|
|
45d60a |
|
|
|
45d60a |
The scripts execute in the same environment as dhclient-script. That means
|
|
|
45d60a |
all of the functions and variables available to it are available to your
|
|
|
45d60a |
NAME.sh script. Things of note:
|
|
|
45d60a |
|
|
|
45d60a |
${SAVEDIR} is where original configuration files are saved. Save your
|
|
|
45d60a |
original configuration files here before you take the DHCP provided
|
|
|
45d60a |
values and generate new files.
|
|
|
45d60a |
|
|
|
45d60a |
Variables set in /etc/sysconfig/network, /etc/sysconfig/networking/network,
|
|
|
45d60a |
and /etc/sysconfig/network-scripts/ifcfg-$interface are available to
|
|
|
45d60a |
you.
|
|
|
45d60a |
|
|
|
45d60a |
See the scripts in /etc/dhcp/dhclient.d for examples.
|
|
|
45d60a |
|
|
|
45d60a |
NOTE: Do not use functions defined in /usr/sbin/dhclient-script. Consider
|
|
|
45d60a |
dhclient-script a black box. This script may change over time, so the
|
|
|
45d60a |
dhclient.d scripts should not be using functions defined in it.
|
|
|
45d60a |
|
|
|
45d60a |
--
|
|
|
45d60a |
David Cantrell <dcantrell@redhat.com>
|