NAME
dhcpdb2conf — convert DHCP client database to config file parameters
SYNOPSIS
dhcpdb2conf
[-pac]
[-hdirntwu]
[-s
index]
[lan-interfaces]
DESCRIPTION
The
dhcpdb2conf
command translates a client system's DHCP database parameters (from
dhcpclient)
into a set of standard configuration file parameters.
This is an essential step for configuring a DHCP client system, and is
invoked by
auto_parms
upon every reboot when DHCP is active.
A DHCP client database can contain settings for such items as:
hostname, IP address, and default gateway (a subset of the "initial
identity parameters" managed by
set_parms
and
geocustoms).
You can list the contents of the database to the screen, create a set of
configuration staging files, or execute direct edits on existing
configuration files using the values contained in the client database.
Arguments:
You can provide a list of
lan-interfaces
on which to operate, such as "lan0 lan1".
If you specify no LAN interfaces,
dhcpdb2conf
processes all entries referenced in the client's DHCP database.
The entries are each defined as a unique LAN interface and a
corresponding list of attributes.
Options
The following options determine the results of DHCP parameter processing.
- -p
Print results to the screen (standard output).
This is the default action if neither
-a
nor
-c
is specified.
- -a
Apply directly: Using the results of the specified filters (see below),
directly apply the parameter definitions to the existing configuration
files, for example, to
/etc/rc.config.d/netconf.
(This is how
dhcpdb2conf
is called from
auto_parms.)
- -c
Create copies: Create a set of staging files using the results of the
selected filters (see below).
Each parameter processed is applied to its corresponding copy of one
configuration file [re]created by
dhcpdb2conf.
For example,
/etc/rc.config.d/netconf
is copied to
/etc/rc.config.d/netconf.dhcp.
(If the file already exists and can be written, it is overwritten;
otherwise the command fails.)
Once this staging file is created, the parameter being processed is
applied to the newly created staging file rather than the real
configuration file.
The following "filter" options control which parameters are processed.
The options can be combined in any manner.
The default with no options is to process all attributes for each LAN
interface.
- -h
Hostname: Process the
HOSTNAME
parameter.
- -d
DNS: Process the
DNS
parameter set (in
/etc/resolv.conf):
domain,
nameserver.
- -i
Interface: Process the
INTERFACE
parameter set:
INTERFACE_NAME[],
IP_ADDRESS[],
SUBNET_MASK[],
BROADCAST_MASK[],
LANCONFIG_ARGS[]
- -r
Route: Process the
ROUTE
parameter set:
ROUTE_DESTINATION[],
ROUTE_GATEWAY[],
ROUTE_COUNT[]
- -n
NIS: Process the
NIS
parameter set:
NISDOMAIN,
YPSET_ADDR
- -t
Time: Process the
NTPDATE_SERVER
parameter.
- -w
DHCP_SERVER: Prints the hostname of
DHCP SERVER,
which has the given IP address for the interface.
Options
-a
or
-c
have no effect.
Option
-w
will print results only to the screen (standard output).
- -u
Hostname: Do not update the
HOSTNAME
parameter in configuration files.
If the
-u
option is used with
-a
or
-c,
then the
-h
option has no effect.
- -s index
Set array index for the set of related parameters for one LAN interface
in the configuration files.
For example, with
-s0
(the default) the output would include
INTERFACE_NAME[0]=lan0.
The
dhcpdb2conf
command can be run only by users with appropriate privileges.
Configuration Files and Parameter Names
The following files, and parameters in each file, can be processed by
dhcpdb2conf:
- /etc/resolv.conf
- /etc/rc.config.d/netconf
HOSTNAME
INTERFACE_NAME[index]
IP_ADDRESS[index]
SUBNET_MASK[index]
BROADCAST_MASK[index]
LANCONFIG_ARGS[index]
ROUTE_DESTINATION[index]
ROUTE_GATEWAY[index]
ROUTE_COUNT[index]
- /etc/rc.config.d/namesvrs
- /etc/rc.config.d/netdaemons
EXAMPLES
List the entire contents of the DHCP client database:
List only the
INTERFACE
parameter set for lan0:
List the
INTERFACE
and
ROUTE
parameter sets for lan0 and lan1:
dhcpdb2conf -ir lan0 lan1
Apply the
INTERFACE
and
ROUTE
parameter sets for lan0 to the existing configuration files:
Apply all parameter sets to the existing configuration files using lan0,
and set index = 1:
WARNINGS
Using the
-a
option overrides any existing values which are currently set in the
system's configuration files (while the
-c
option merely revises staging files, if any).
FILES
- /usr/lbin/dhcpdb2conf
The command itself.
- /etc/dhcpclient.data
Current DHCP parameters received from a DHCP server by
dhcpclient.
- /etc/resolv.conf[.dhcp]
- /etc/rc.config.d/netconf[.dhcp]
- /etc/rc.config.d/namesvrs[.dhcp]
- /etc/rc.config.d/netdaemons[.dhcp]
System configuration files that can be modified by
dhcpdb2conf.