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