NAME [Toc] [Back]
dhcpclient - Client for Dynamic Host Configuration Protocol Server
SYNOPSIS [Toc] [Back]
dhcpclient [-G] [-N hostname] -b interface [-f tracefile] [-g class-id]
[-l debug_level] [-n] [-p] [-s server_ipaddress] [-t log_type]
[-x send_attempts] [-z time_to_wait]
dhcpclient -d interface [-s server_ipaddress]
dhcpclient [-N hostname] [-f tracefile] [-l debug_level] -m interface
[-p] [-s server_ipaddress] [-t log_type] [-z time_to_wait]
dhcpclient [-f tracefile] [-l debug_level] [-p] -r interface
[-s server_ipaddress] [-t log_type]
DESCRIPTION [Toc] [Back]
dhcpclient is used to obtain the configuration parameters from the
Dynamic Host Configuration Protocol (DHCP) server (bootpd(1M)) to
configure the host. Currently, dhcpclient supports 10bt (10BaseT) and
100bt (100BaseT) Ethernet networks only. It does not support
FDDI and Token-Ring networks.
dhcpclient is invoked by the auto_parms script (see auto_parms(1M)) at
boot up. The /etc/rc.config.d/netconf file is used for the
configuration of the interfaces. To invoke dhcpclient using the
auto_parms script, set the DHCP_ENABLE[index] variable to a non-zero
value in the /etc/rc.config.d/netconf file. dhcpclient can also be
invoked at the command prompt, when the interface is not configured.
Once the dhcpclient obtains the configuration parameters from the
server, it is stored in a configuration file named
/etc/dhcpclient.data. The configuration parameters are valid for a
fixed time, lease time.
The configuration information in /etc/dhcpclient.data file will be of
the following format.
<code> <length> <data>
00 <length> IFname
01 <length> hostname
02 <length> sname
03 <length> bootfile
04 <length> NIS_domain
05 <length> domain_name
06 <length> lease_duration
07 <length> lease_expiration
08 <length> T1
Hewlett-Packard Company - 1 - HP-UX 11i Version 2: August 2003
09 <length> T2
10 <length> htype
11 <length> chaddr
12 <length> IP_addr
13 <length> subnet_mask
14 <length> broadcast_addr
15 <length> default_gateway
16 <length> server_addr
17 <length> boot_server
18 <length> dest_gateway
19 <length> DNS_server
20 <length> LPR_server
21 <length> swap_server
22 <length> NIS_server
23 <length> NTP_server
24 <length> raw_options
The length field denotes the length of the data field following it.
All these lines collectively indicate one record. The configuration
file will have series of records.
Since this file contains all the configuration information, it can be
used to identify the server from which the configuration parameters
were obtained. The configuration file can also be used to obtain the
same configuration parameters from the server. So, once the dhcpclient
is invoked, it will try to read the configuration file,
While trying to read the /etc/dhcpclient.data file, the following
conditions are possible:
1. It may be possible that the configuration file had been deleted or
it may not be available for reading.
2. The file may have got corrupted and contains irrelevant data for
the particular interface.
3. There may be no configuration information for the particular
4. User may have specified -n option meaning that a new lease is
For all of the above cases, dhcpclient has to first find the server
which is ready for the service. For this purpose, it will send a
DHCPDISCOVER message. If the user has specified server ip-address
using the -s option, then this message will be sent to that ipaddress,
else, this message is broadcasted. The server in turn will
reply with the configuration parameters that it can offer. This
message is called DHCPOFFER. If the client has sent the DHCPDISCOVER
Hewlett-Packard Company - 2 - HP-UX 11i Version 2: August 2003
to broadcast address, then it will receive DHCPOFFER from more than
one server. The dhcpclient selects one of the DHCPOFFER obtained.
Then, it will send DHCPREQUEST to the server, requesting the
configuration parameters. The server will reply with a positive
acknowledgement called DHCPACK, if it is willing to send the
configuration parameters to the host and with a negative
acknowledgement, if it is not willing to do so. If the dhcpclient has
received DHCPACK, it will copy all the configuration parameters to the
configuration file, else, it will send another DHCPDISCOVER message
and repeat the whole process. This process is called "Obtaining a new
If all the above 4 cases are not true, then the dhcpclient can
directly send the DHCPREQUEST message and obtain the configuration
parameters as mentioned above. This process is called "Renewing the
The various options supported by dhcpclient are as described below.
Options [Toc] [Back]
-G When this option is used, the client will accept the
reply from the DHCP server only if the class-id in the
request and reply packet matches.
-N hostname This option is used to send a hostname. The hostname
should be specified as an ASCII string.
-b interface This option is used during bootup time to obtain a new
lease. If the client is trying to obtain the
configuration parameters from the server for the first
time, then /etc/dhcpclient.data does not exist. So, using
this option, the client obtains a new lease for the
-d interface This option is used for dumping the internal data of an
interface. A sample dump is shown below.
Interface PPA MAC Type Physical Address
lan0 0 ETHER 0x080009709631
-f tracefile This option is used to specify the file name for the
-g class-id This option is used for specifying the class-id of the
device group. class-id should be specified as an ASCII
This option is used for logging of debug information.
debug_level specifies the amount of debug information
logged. The debugging messages are sent to STDERR.
Hewlett-Packard Company - 3 - HP-UX 11i Version 2: August 2003
-m interface This option is used for maintaining the lease. When
invoked with this option, the dhcpclient runs as a
daemon. The dhcpclient calculates how much time it needs
to sleep before the lease needs to be renewed and then
sleeps for that time. When it wakes up, it extends the
lease by sending the request to the DHCP server.
-n This option is used for ignoring the current lease. When
this option is used, the current configuration
information is discarded and request for a new lease is
-p This option is used for tracing the packets. It displays
the packet contents in a readable format.
-r interface This option is used for releasing a lease. The dhcpclient
releases all the assigned configuration parameters. This
is done by sending the DHCPRELEASE message to the server.
The dhcpclient then empties the record corresponding to
that interface in the configuration file,
This option is used to specify the ip address of the DHCP
server to which the request should be sent.
server_ipaddress should be specified in dotted decimal
-t log_type If the log_type is a non zero value and if the
debug_level is low enough for the process to detach from
the tty (see syslog(3C)), then, the logging goes to
syslog, else it goes to STDERR. This option is used when
the dhcpclient is running as a daemon.
-v This option prints the various version strings of the
dhcpclient to stdout.
This option is used to specify the number of attempts the
packet should be sent before obtaining a reply.
send_attempts must be specified as an unsigned number.
This option is used to specify the time interval between
successive packet retransmission. time_to_wait will be
EXAMPLES [Toc] [Back]
To maintain the lease for the interface lan0 and invoke logging in
syslog, the following set of commands is invoked at the command
Hewlett-Packard Company - 4 - HP-UX 11i Version 2: August 2003
dhcpclient -b lan0 -N "dhcp1"
dhcpclient -m lan0 -N "dhcp1" -l 3 -t 1
To trace the packet and get the debugging messages, use:
dhcpclient -b lan0 -N "dhcp1" -p -l 8
This is an example of a /etc/dhcpclient.data file.
00 4 lan0
01 5 dhcph
06 4 4294967295
07 4 4294967295
08 4 0
09 4 0
10 4 1
11 6 8 0 9 25 a5 b1
12 4 22.214.171.124
13 4 255.255.255.0
14 4 0.0.0.0
16 4 126.96.36.199
17 4 188.8.131.52
21 4 0.0.0.0
24 39 63 82 53 63 35 1 5 33 4 ff ff ff ff 36 4 c0 b8
16 3 1 4 ff ff ff 0 c 5 64 68 63 70 68 2 4 ff ff b2 a8 ff
AUTHOR [Toc] [Back]
dhcpclient was developed by HP.
FILES [Toc] [Back]
/etc/dhcpclient.data configuration file.
SEE ALSO [Toc] [Back]
auto_parms(1M), bootpd(1M), bootpquery(1M), dhcptools(1M), syslog(3C).
DARPA Internet Request For Comments: RFC1541, RFC1542, RFC1533,
RFC1534, Assigned Numbers RFC.
Hewlett-Packard Company - 5 - HP-UX 11i Version 2: August 2003 [ Back ]